diff --git a/DDCore/include/DD4hep/Factories.h b/DDCore/include/DD4hep/Factories.h index 215e2cde9a2ca1629579cb907aeb128abeea5c6e..6f07541dacf3fd3b94897c59b804731092f09dd3 100644 --- a/DDCore/include/DD4hep/Factories.h +++ b/DDCore/include/DD4hep/Factories.h @@ -30,12 +30,18 @@ namespace DD4hep { } class NamedObject; + /// Namespace describing generic detector segmentations + namespace DDSegmentation { + class BitField64; + } + /// Namespace for the geometry part of the AIDA detector description toolkit namespace Geometry { // Forward declarations class LCDD; class SensitiveDetector; + class SegmentationObject; class DetElement; } @@ -52,7 +58,11 @@ namespace DD4hep { }; template <typename T> class LCDDConstructionFactory : public PluginFactoryBase { public: - static void* create(lcdd_t& lcdd, int argc, char** argv); + static void* create(Geometry::LCDD& lcdd, int argc, char** argv); + }; + template <typename T> class SegmentationFactory : public PluginFactoryBase { + public: + static Geometry::SegmentationObject* create(DDSegmentation::BitField64* decoder); }; /// Template class with a generic signature to apply LCDD plugins @@ -67,7 +77,7 @@ namespace DD4hep { */ template <typename T> class ApplyFactory : public PluginFactoryBase { public: - static long create(lcdd_t& lcdd, int argc, char** argv); + static long create(Geometry::LCDD& lcdd, int argc, char** argv); }; /// Specialized factory to translate objects, which can be retrieved from LCDD @@ -81,7 +91,7 @@ namespace DD4hep { */ template <typename T> class TranslationFactory : public PluginFactoryBase { public: - static ref_t create(lcdd_t& lcdd); + static ref_t create(Geometry::LCDD& lcdd); }; /// Create an arbitrary object from it's XML representation. @@ -94,7 +104,7 @@ namespace DD4hep { */ template <typename T> class XMLElementFactory : public PluginFactoryBase { public: - static ref_t create(lcdd_t& lcdd, xml_h e); + static ref_t create(Geometry::LCDD& lcdd, xml_h e); }; /// Read an arbitrary XML document and analyze it's content @@ -107,7 +117,7 @@ namespace DD4hep { */ template <typename T> class XMLDocumentReaderFactory : public PluginFactoryBase { public: - static long create(lcdd_t& lcdd, xml_h e); + static long create(Geometry::LCDD& lcdd, xml_h e); }; /// Read an arbitrary XML document and analyze it's content @@ -120,7 +130,7 @@ namespace DD4hep { */ template <typename T> class XMLConversionFactory : public PluginFactoryBase { public: - static long create(lcdd_t& lcdd, ref_t& handle, xml_h element); + static long create(Geometry::LCDD& lcdd, ref_t& handle, xml_h element); }; /// Standard factory to create Detector elements from the compact XML representation. @@ -147,6 +157,8 @@ namespace { typedef DD4hep::Geometry::LCDD LCDD; typedef DD4hep::XML::Handle_t xml_h; typedef DD4hep::Geometry::Ref_t ref_t; + typedef DD4hep::Geometry::SegmentationObject SegmentationObject; + typedef DD4hep::DDSegmentation::BitField64 BitField64; }; DD4HEP_PLUGIN_FACTORY_ARGS_1(void*,const char*) @@ -155,6 +167,9 @@ namespace { DD4HEP_PLUGIN_FACTORY_ARGS_1(ns::Named*,ns::LCDD*) { return DD4hep::TranslationFactory<P>::create(*a0).ptr(); } + DD4HEP_PLUGIN_FACTORY_ARGS_1(ns::SegmentationObject*,ns::BitField64*) + { return DD4hep::SegmentationFactory<P>::create(a0); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(void*,ns::LCDD*,int,char**) { return DD4hep::LCDDConstructionFactory<P>::create(*a0,a1,a2); } @@ -182,11 +197,18 @@ namespace { #define DECLARE_NAMED_XMLELEMENT_FACTORY(n,x) namespace DD4hep \ { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(Geometry::LCDD*,XML::Handle_t*),__LINE__) } #define DECLARE_NAMED_DETELEMENT_FACTORY(n,x) namespace DD4hep \ - { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::*(),__LINE__) } + +// Call function of the type [Geometry::SegmentationObject (*func)(Geometry::LCDD*,DDSegmentation::BitField64*)] +#define DECLARE_SEGMENTATION(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ + template <> Geometry::SegmentationObject* \ + SegmentationFactory<name>::create(DDSegmentation::BitField64* d) { return func(d); } \ + DD4HEP_PLUGINSVC_FACTORY(name,segmentation_constructor__##name, \ + Geometry::SegmentationObject*(DDSegmentation::BitField64*),__LINE__)} // Call function of the type [long (*func)(const char* arg)] #define DECLARE_APPLY(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ - template <> long ApplyFactory<name>::create(lcdd_t& l,int n,char** a) {return func(l,n,a);} \ + template <> long ApplyFactory<name>::create(Geometry::LCDD& l,int n,char** a) {return func(l,n,a);} \ DD4HEP_PLUGINSVC_FACTORY(name,name,long(Geometry::LCDD*,int,char**),__LINE__)} // Call function of the type [void* (*func)(const char* arg)] @@ -194,29 +216,29 @@ namespace { template <> void* ConstructionFactory<name>::create(const char* n) { return func(n);} \ DD4HEP_PLUGINSVC_FACTORY(name,name,void*(const char*),__LINE__) } -// Call function of the type [void* (*func)(lcdd_t& lcdd, int argc,char** argv)] +// Call function of the type [void* (*func)(Geometry::LCDD& lcdd, int argc,char** argv)] #define DECLARE_LCDD_CONSTRUCTOR(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ - template <> void* LCDDConstructionFactory<name>::create(lcdd_t& l, int n,char** a) { return func(l,n,a);} \ + template <> void* LCDDConstructionFactory<name>::create(Geometry::LCDD& l, int n,char** a) { return func(l,n,a);} \ DD4HEP_PLUGINSVC_FACTORY(name,name,void*(Geometry::LCDD*,int,char**),__LINE__) } -// Call function of the type [void* (*func)(lcdd_t& lcdd)] +// Call function of the type [void* (*func)(Geometry::LCDD& lcdd)] #define DECLARE_TRANSLATION(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ - template <> Geometry::Ref_t TranslationFactory<name>::create(lcdd_t& l) {return func(l);} \ + template <> Geometry::Ref_t TranslationFactory<name>::create(Geometry::LCDD& l) {return func(l);} \ DECLARE_NAMED_TRANSLATION_FACTORY(Geometry,name) } -// Call function of the type [void* (*func)(lcdd_t& lcdd, xml_h handle)] +// Call function of the type [void* (*func)(Geometry::LCDD& lcdd, xml_h handle)] #define DECLARE_XMLELEMENT(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_element_##name) {\ - template <> Geometry::Ref_t XMLElementFactory<xml_element_##name>::create(lcdd_t& l,xml_h e) {return func(l,e);} \ + template <> Geometry::Ref_t XMLElementFactory<xml_element_##name>::create(Geometry::LCDD& l,xml_h e) {return func(l,e);} \ DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,NamedObject*(Geometry::LCDD*,XML::Handle_t*),__LINE__) } -// Call function of the type [long (*func)(lcdd_t& lcdd, xml_h handle)] +// Call function of the type [long (*func)(Geometry::LCDD& lcdd, xml_h handle)] #define DECLARE_XML_DOC_READER(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_document_##name) { \ - template <> long XMLDocumentReaderFactory<xml_document_##name>::create(lcdd_t& l,xml_h e) {return func(l,e);} \ + template <> long XMLDocumentReaderFactory<xml_document_##name>::create(Geometry::LCDD& l,xml_h e) {return func(l,e);} \ DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(Geometry::LCDD*,XML::Handle_t*),__LINE__) } -// Call function of the type [NamedObject* (*func)(lcdd_t& lcdd, xml_h handle, ref_t reference)] +// Call function of the type [NamedObject* (*func)(Geometry::LCDD& lcdd, xml_h handle, ref_t reference)] #define DECLARE_XML_PROCESSOR_BASIC(name,func,deprecated) DD4HEP_OPEN_PLUGIN(DD4hep,det_element_##name) {\ - template <> Geometry::Ref_t DetElementFactory< det_element_##name >::create(lcdd_t& l,xml_h e,ref_t h) \ + template <> Geometry::Ref_t DetElementFactory< det_element_##name >::create(Geometry::LCDD& l,xml_h e,ref_t h) \ { if (deprecated) warning_deprecated_xml_factory(#name); return func(l,e,h);} \ DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } diff --git a/DDCore/include/DD4hep/Segmentations.h b/DDCore/include/DD4hep/Segmentations.h index 4f75e77743456536ab72baee7ccab8c9e6211ac2..9a98c85cf215219e3a2ca2303b7dd550d7f2fe3c 100644 --- a/DDCore/include/DD4hep/Segmentations.h +++ b/DDCore/include/DD4hep/Segmentations.h @@ -96,7 +96,30 @@ namespace DD4hep { BaseSegmentation* segmentation; }; + /// Concrete wrapper class for segmentation implementation based on DDSegmentation objects + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename IMP> class SegmentationImplementation : public SegmentationObject { + public: + /// DDSegmentation aggregate + IMP implementation; + public: + /// Standard constructor + SegmentationImplementation(DDSegmentation::BitField64* decoder); + /// Default destructor + virtual ~SegmentationImplementation() {} + }; + template <typename IMP> inline + SegmentationImplementation<IMP>::SegmentationImplementation(DDSegmentation::BitField64* decoder) + : SegmentationObject(0), implementation(decoder) + { + this->segmentation = &implementation; + } + /// Handle class supporting generic Segmentation of sensitive detectors /** * @@ -113,7 +136,7 @@ namespace DD4hep { public: /// Initializing constructor creating a new object of the given DDSegmentation type - Segmentation(const std::string& type, const std::string& name); + Segmentation(const std::string& type, const std::string& name, BitField64* decoder); /// Default constructor Segmentation() : Handle<Object>() { } /// Copy Constructor from object diff --git a/DDCore/src/Segmentations.cpp b/DDCore/src/Segmentations.cpp index 2a4d53a10d9deca156024c2c5efaeb91196278c2..4578eac6a67bdefd065f69189ce7314b59582fa4 100644 --- a/DDCore/src/Segmentations.cpp +++ b/DDCore/src/Segmentations.cpp @@ -16,6 +16,7 @@ #include "DD4hep/Segmentations.h" #include "DD4hep/InstanceCount.h" #include "DD4hep/Printout.h" +#include "DD4hep/Plugins.h" #include "DD4hep/Handle.inl" // C/C++ include files @@ -121,13 +122,22 @@ void SegmentationObject::neighbours(const CellID& cell, std::set<CellID>& nb) co } /// Constructor to used when creating a new object -Segmentation::Segmentation(const string& typ, const string& nam) : - Handle<Implementation>() { +Segmentation::Segmentation(const string& typ, const string& nam, BitField64* decoder) : Handle<Implementation>() +{ + string type = "segmentation_constructor__"+typ; + SegmentationObject* obj = PluginService::Create<SegmentationObject*>(type, decoder); + if ( obj != 0 ) { + assign(obj, nam, typ); + if ( !nam.empty() ) obj->setName(nam); + } +#if 0 BaseSegmentation* s = DDSegmentation::SegmentationFactory::instance()->create(typ); if (s != 0) { assign(new Object(s), nam, ""); if ( !nam.empty() ) s->setName(nam); - } else { + } +#endif + else { throw runtime_error("FAILED to create segmentation: " + typ + ". Missing factory method for: " + typ + "!"); } } diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index 96ba65161d312fe93dbea67ecf7ab039d6a75686..9fd9848d3e575d8e6cd931bb54676cee44e34f98 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -546,8 +546,10 @@ template <> void Converter<Region>::operator()(xml_h elt) const { template <> void Converter<Segmentation>::operator()(xml_h seg) const { string type = seg.attr<string>(_U(type)); string name = seg.hasAttr(_U(name)) ? seg.attr<string>(_U(name)) : string(); - SegmentationObject** object = _option<SegmentationObject*>(); - Segmentation segment(type, name); + std::pair<Segmentation,IDDescriptor>* opt = _option<pair<Segmentation,IDDescriptor> >(); + + BitField64* bitfield = opt->second.ptr(); + Segmentation segment(type, name, bitfield); if (segment.isValid()) { typedef Segmentation::Parameters _PARS; const _PARS& pars = segment.parameters(); @@ -587,10 +589,11 @@ template <> void Converter<Segmentation>::operator()(xml_h seg) const { long key_min = 0, key_max = 0; DDSegmentation::Segmentation* base = segment->segmentation; for(xml_coll_t sub(seg,_U(segmentation)); sub; ++sub) { - SegmentationObject* sub_object = 0; + std::pair<Segmentation,IDDescriptor> sub_object(Segmentation(),opt->second); Converter<Segmentation> sub_conv(lcdd,param,&sub_object); sub_conv(sub); - if ( sub_object ) { + if ( sub_object.first.isValid() ) { + Segmentation sub_seg = sub_object.first; xml_dim_t s(sub); if ( sub.hasAttr(_U(key_value)) ) { key_min = key_max = s.key_value(); @@ -606,15 +609,15 @@ template <> void Converter<Segmentation>::operator()(xml_h seg) const { } printout(DEBUG,"Compact","++ Segmentation [%s/%s]: Add sub-segmentation %s [%s]", name.c_str(), type.c_str(), - sub_object->segmentation->name().c_str(), - sub_object->segmentation->type().c_str()); - base->addSubsegmentation(key_min, key_max, sub_object->segmentation); - sub_object->segmentation = 0; - delete sub_object; + sub_seg->segmentation->name().c_str(), + sub_seg->segmentation->type().c_str()); + base->addSubsegmentation(key_min, key_max, sub_seg->segmentation); + sub_seg->segmentation = 0; + delete sub_seg.ptr(); } } } - if ( object ) *object = segment.ptr(); + opt->first = segment; } /** Specialized converter for compact readout objects. @@ -628,24 +631,23 @@ template <> void Converter<Readout>::operator()(xml_h e) const { xml_h seg = e.child(_U(segmentation), false); xml_h id = e.child(_U(id)); string name = e.attr<string>(_U(name)); + std::pair<Segmentation,IDDescriptor> opt; Readout ro(name); - + printout(DEBUG, "Compact", "++ Converting readout structure: %s.",ro.name()); if (id) { // <id>system:6,barrel:3,module:4,layer:8,slice:5,x:32:-16,y:-16</id> - Ref_t idSpec = IDDescriptor(id.text()); - idSpec->SetName(ro.name()); - ro.setIDDescriptor(idSpec); - lcdd.addIDSpecification(idSpec); + opt.second = IDDescriptor(id.text()); + opt.second->SetName(ro.name()); + ro.setIDDescriptor(opt.second); + lcdd.addIDSpecification(opt.second); } if (seg) { // Segmentation is not mandatory! - SegmentationObject* object = 0; - Converter<Segmentation> converter(lcdd,param,&object); + Converter<Segmentation> converter(lcdd,param,&opt); converter(seg); - if ( object ) { - object->setName(name); - Segmentation segment(object); - ro.setSegmentation(segment); + if ( opt.first.isValid() ) { + opt.first->setName(name); + ro.setSegmentation(opt.first); } } for(xml_coll_t colls(e,_U(hits_collections)); colls; ++colls) { diff --git a/DDSegmentation/include/DDSegmentation/CartesianGrid.h b/DDSegmentation/include/DDSegmentation/CartesianGrid.h index f04409902f09e70c6904a99bebe612c246ab077c..bef731766c49bdde7f06e39d815e18fbfb02c74e 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGrid.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGrid.h @@ -20,6 +20,8 @@ public: protected: /// Default constructor used by derived classes passing the encoding string CartesianGrid(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + CartesianGrid(BitField64* decoder); }; } /* namespace DDSegmentation */ diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXY.h b/DDSegmentation/include/DDSegmentation/CartesianGridXY.h index ca9e6cdda6d944ecadd1a29f37d0b88260eb3678..b0b1d0ed15dcec04aeb0f71d6ff7c8f9e38349b8 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXY.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXY.h @@ -17,6 +17,8 @@ class CartesianGridXY: public CartesianGrid { public: /// Default constructor passing the encoding string CartesianGridXY(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + CartesianGridXY(BitField64* decoder); /// destructor virtual ~CartesianGridXY(); diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h index c8e45780f8540514498971bb4cc90ae104cda66e..99c3729a47febab9cf64aa6fca47cffbb45884a9 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h @@ -17,6 +17,8 @@ class CartesianGridXYZ: public CartesianGridXY { public: /// default constructor using an arbitrary type CartesianGridXYZ(const std::string& cellEncoding); + /// Default constructor used by derived classes passing an existing decoder + CartesianGridXYZ(BitField64* decoder); /// destructor virtual ~CartesianGridXYZ(); diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h index 0719bcbf84eb0f8952fcfb30c06e1d61e1ebb76b..98e575ccd6590358083d0aebe22b695af1ff3522 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h @@ -17,6 +17,8 @@ class CartesianGridXZ: public CartesianGrid { public: /// default constructor using an arbitrary type CartesianGridXZ(const std::string& cellEncoding); + /// Default constructor used by derived classes passing an existing decoder + CartesianGridXZ(BitField64* decoder); /// destructor virtual ~CartesianGridXZ(); diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h index 9060b60a1ee2f5c3960b75f93dd4ca3e9f3e888d..08785d961622df0372e3f9e88052f1e5a65d7763 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h @@ -19,6 +19,8 @@ class CartesianGridYZ: public CartesianGrid { public: /// Default constructor passing the encoding string CartesianGridYZ(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + CartesianGridYZ(BitField64* decoder); /// destructor virtual ~CartesianGridYZ(); diff --git a/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h b/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h index 5d12401d6891f012414423519d412e21137f94fd..565dae3df67c2c35b839bb8983cbf2905cd38cf7 100644 --- a/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h @@ -23,6 +23,8 @@ public: protected: /// default constructor using an arbitrary type CylindricalSegmentation(const std::string& cellEncoding); + /// Default constructor used by derived classes passing an existing decoder + CylindricalSegmentation(BitField64* decoder); }; diff --git a/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h b/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h index 72f9afd15e0ba5f037b26fcf6b91ec07f12ffb01..01516591bd7f7702f9f3cd7622c8983007a7e865 100644 --- a/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h +++ b/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h @@ -20,6 +20,8 @@ class MegatileLayerGridXY: public CartesianGrid { public: /// Default constructor passing the encoding string MegatileLayerGridXY(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + MegatileLayerGridXY(BitField64* decoder); /// destructor virtual ~MegatileLayerGridXY(); diff --git a/DDSegmentation/include/DDSegmentation/MultiSegmentation.h b/DDSegmentation/include/DDSegmentation/MultiSegmentation.h index 557919d89956d34235c912bc17a051933d234473..24a9f46c40e89357b80b364417d10baab816721a 100644 --- a/DDSegmentation/include/DDSegmentation/MultiSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/MultiSegmentation.h @@ -32,6 +32,9 @@ namespace DD4hep { /// Default constructor passing the encoding string MultiSegmentation(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + MultiSegmentation(BitField64* decoder); + /// Default destructor virtual ~MultiSegmentation(); diff --git a/DDSegmentation/include/DDSegmentation/PolarGrid.h b/DDSegmentation/include/DDSegmentation/PolarGrid.h index e147c8ff082b840166005ed722849aa2a327fa3a..5dde8535f30aab0b51dce48bb10ddc627050d397 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGrid.h +++ b/DDSegmentation/include/DDSegmentation/PolarGrid.h @@ -20,6 +20,8 @@ public: protected: /// Default constructor used by derived classes passing the encoding string PolarGrid(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + PolarGrid(BitField64* decoder); }; } /* namespace DDSegmentation */ diff --git a/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h b/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h index 508d32286b05493b0754b796b393b52d0e1a894f..a2110bf3fec0fb1784b32059e653d1a233b0d5c3 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h +++ b/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h @@ -18,6 +18,8 @@ class PolarGridRPhi: public PolarGrid { public: /// Default constructor passing the encoding string PolarGridRPhi(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + PolarGridRPhi(BitField64* decoder); /// destructor virtual ~PolarGridRPhi(); diff --git a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h index 985ab80dd976be37a7d322db6f7a82a6eb33398f..5b69cad324578c5a2580cb4967742ed1b1173cc1 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h +++ b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h @@ -46,6 +46,8 @@ class PolarGridRPhi2: public PolarGrid { public: /// Default constructor passing the encoding string PolarGridRPhi2(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + PolarGridRPhi2(BitField64* decoder); /// destructor virtual ~PolarGridRPhi2(); diff --git a/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h b/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h index 6ab7c68fc177c67bbe70ab8491cceac65ed21c1a..b565fe9fb10509df122fc281c66268757548f199 100644 --- a/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h +++ b/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h @@ -17,6 +17,8 @@ class ProjectiveCylinder: public CylindricalSegmentation { public: /// default constructor using an arbitrary type ProjectiveCylinder(const std::string& cellEncoding); + /// Default constructor used by derived classes passing an existing decoder + ProjectiveCylinder(BitField64* decoder); /// destructor virtual ~ProjectiveCylinder(); diff --git a/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h b/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h index c1cb91a61397b263f06f6a4303a03bd62cd00d7c..2175a377f0eb3a29e817ff79262d7501046afb3a 100644 --- a/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h +++ b/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h @@ -21,6 +21,8 @@ class TiledLayerGridXY: public CartesianGrid { public: /// Default constructor passing the encoding string TiledLayerGridXY(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + TiledLayerGridXY(BitField64* decoder); /// destructor virtual ~TiledLayerGridXY(); diff --git a/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h b/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h index 9b6f9b0afa913a429efad31e9f602007dc815b81..3027bd27387e542650e75e70dd3e16503a8328c7 100644 --- a/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h @@ -28,6 +28,8 @@ public: /// Default constructor passing the encoding string TiledLayerSegmentation(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + TiledLayerSegmentation(BitField64* decoder); /// destructor virtual ~TiledLayerSegmentation(); diff --git a/DDSegmentation/include/DDSegmentation/WaferGridXY.h b/DDSegmentation/include/DDSegmentation/WaferGridXY.h index 8dd758b4e282fc4ec636d67f73b367ae08cc02ce..042ff2476f11e60f6cd4020a9e609b254072c802 100644 --- a/DDSegmentation/include/DDSegmentation/WaferGridXY.h +++ b/DDSegmentation/include/DDSegmentation/WaferGridXY.h @@ -20,6 +20,8 @@ class WaferGridXY: public CartesianGrid { public: /// Default constructor passing the encoding string WaferGridXY(const std::string& cellEncoding = ""); + /// Default constructor used by derived classes passing an existing decoder + WaferGridXY(BitField64* decoder); /// destructor virtual ~WaferGridXY(); diff --git a/DDSegmentation/src/CartesianGrid.cpp b/DDSegmentation/src/CartesianGrid.cpp index bc81ba2ebc7ba13baafae3d1273e55e64f0dfeaf..8774fa8d64c341bf81d3c6a4231dd9358e4366d5 100644 --- a/DDSegmentation/src/CartesianGrid.cpp +++ b/DDSegmentation/src/CartesianGrid.cpp @@ -8,16 +8,20 @@ #include "DDSegmentation/CartesianGrid.h" namespace DD4hep { -namespace DDSegmentation { + namespace DDSegmentation { -/// Default constructor used by derived classes passing the encoding string -CartesianGrid::CartesianGrid(const std::string& cellEncoding) : - Segmentation(cellEncoding) { -} + /// Default constructor used by derived classes passing the encoding string + CartesianGrid::CartesianGrid(const std::string& cellEncoding) : + Segmentation(cellEncoding) { + } -/// Destructor -CartesianGrid::~CartesianGrid() { -} + /// Default constructor used by derived classes passing an existing decoder + CartesianGrid::CartesianGrid(BitField64* decoder) : Segmentation(decoder) { + } -} /* namespace DDSegmentation */ + /// Destructor + CartesianGrid::~CartesianGrid() { + } + + } /* namespace DDSegmentation */ } /* namespace DD4hep */ diff --git a/DDSegmentation/src/CartesianGridXY.cpp b/DDSegmentation/src/CartesianGridXY.cpp index 7be3cdf18e0b70437ba9c87f5c11ac6010b9318e..b474cc13e672635f6fb18c2841a31d1b79daa431 100644 --- a/DDSegmentation/src/CartesianGridXY.cpp +++ b/DDSegmentation/src/CartesianGridXY.cpp @@ -26,6 +26,23 @@ CartesianGridXY::CartesianGridXY(const std::string& cellEncoding) : registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "y"); } +/// Default constructor used by derived classes passing an existing decoder +CartesianGridXY::CartesianGridXY(BitField64* decoder) : + CartesianGrid(decoder) +{ + // define type and description + _type = "CartesianGridXY"; + _description = "Cartesian segmentation in the local XY-plane"; + + // register all necessary parameters + registerParameter("grid_size_x", "Cell size in X", _gridSizeX, 1., SegmentationParameter::LengthUnit); + registerParameter("grid_size_y", "Cell size in Y", _gridSizeY, 1., SegmentationParameter::LengthUnit); + registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true); + registerParameter("offset_y", "Cell offset in Y", _offsetY, 0., SegmentationParameter::LengthUnit, true); + registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "x"); + registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "y"); +} + /// destructor CartesianGridXY::~CartesianGridXY() { diff --git a/DDSegmentation/src/CartesianGridXYZ.cpp b/DDSegmentation/src/CartesianGridXYZ.cpp index 626b5065d4ffac3bfc874890d7f34c7c2bc50109..9937b7216b82735b85bdc41d94e2c4ca872f3eb3 100644 --- a/DDSegmentation/src/CartesianGridXYZ.cpp +++ b/DDSegmentation/src/CartesianGridXYZ.cpp @@ -23,6 +23,19 @@ CartesianGridXYZ::CartesianGridXYZ(const std::string& cellEncoding) : registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z"); } +/// Default constructor used by derived classes passing an existing decoder +CartesianGridXYZ::CartesianGridXYZ(BitField64* decoder) : + CartesianGridXY(decoder) { + // define type and description + _type = "CartesianGridXYZ"; + _description = "Cartesian segmentation in the local coordinates"; + + // register all necessary parameters + registerParameter("grid_size_z", "Cell size in Z", _gridSizeZ, 1., SegmentationParameter::LengthUnit); + registerParameter("offset_z", "Cell offset in Z", _offsetZ, 0., SegmentationParameter::LengthUnit, true); + registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z"); +} + /// destructor CartesianGridXYZ::~CartesianGridXYZ() { diff --git a/DDSegmentation/src/CartesianGridXZ.cpp b/DDSegmentation/src/CartesianGridXZ.cpp index 13afe2204cfe5fefd21551f46c92c7329dff9ef7..07f88b0a16e6f42f5b26456416d253100a405181 100644 --- a/DDSegmentation/src/CartesianGridXZ.cpp +++ b/DDSegmentation/src/CartesianGridXZ.cpp @@ -29,6 +29,22 @@ CartesianGridXZ::CartesianGridXZ(const std::string& cellEncoding) : registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z"); } +/// Default constructor used by derived classes passing an existing decoder +CartesianGridXZ::CartesianGridXZ(BitField64* decoder) : + CartesianGrid(decoder) { + // define type and description + _type = "CartesianGridXZ"; + _description = "Cartesian segmentation in the local XZ-plane"; + + // register all necessary parameters + registerParameter("grid_size_x", "Cell size in X", _gridSizeX, 1., SegmentationParameter::LengthUnit); + registerParameter("grid_size_z", "Cell size in Z", _gridSizeZ, 1., SegmentationParameter::LengthUnit); + registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true); + registerParameter("offset_z", "Cell offset in Z", _offsetZ, 0., SegmentationParameter::LengthUnit, true); + registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "x"); + registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z"); +} + /// destructor CartesianGridXZ::~CartesianGridXZ() { diff --git a/DDSegmentation/src/CartesianGridYZ.cpp b/DDSegmentation/src/CartesianGridYZ.cpp index 7e07065fae8cf719e30f466280f3ee3b42bc6459..3498e871184c196e252822818927a9797442b5c5 100644 --- a/DDSegmentation/src/CartesianGridYZ.cpp +++ b/DDSegmentation/src/CartesianGridYZ.cpp @@ -27,6 +27,23 @@ CartesianGridYZ::CartesianGridYZ(const std::string& cellEncoding) : registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z"); } + +/// Default constructor used by derived classes passing an existing decoder +CartesianGridYZ::CartesianGridYZ(BitField64* decoder) : + CartesianGrid(decoder) { + // define type and description + _type = "CartesianGridYZ"; + _description = "Cartesian segmentation in the local YZ-plane"; + + // register all necessary parameters + registerParameter("grid_size_y", "Cell size in Y", _gridSizeY, 1., SegmentationParameter::LengthUnit); + registerParameter("grid_size_z", "Cell size in Z", _gridSizeZ, 1., SegmentationParameter::LengthUnit); + registerParameter("offset_y", "Cell offset in Y", _offsetY, 0., SegmentationParameter::LengthUnit, true); + registerParameter("offset_z", "Cell offset in Z", _offsetZ, 0., SegmentationParameter::LengthUnit, true); + registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "y"); + registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z"); +} + /// destructor CartesianGridYZ::~CartesianGridYZ() { diff --git a/DDSegmentation/src/CylindricalSegmentation.cpp b/DDSegmentation/src/CylindricalSegmentation.cpp index ffe5da2e68211fe463f55afe0d879b5bf7afbb77..dbb4b1b4ca388196cb8deccbcae953269049b91f 100644 --- a/DDSegmentation/src/CylindricalSegmentation.cpp +++ b/DDSegmentation/src/CylindricalSegmentation.cpp @@ -15,6 +15,11 @@ CylindricalSegmentation::CylindricalSegmentation(const std::string& cellEncoding Segmentation(cellEncoding) { } +/// Default constructor used by derived classes passing an existing decoder +CylindricalSegmentation::CylindricalSegmentation(BitField64* decoder) : + Segmentation(decoder) { +} + /// destructor CylindricalSegmentation::~CylindricalSegmentation() { diff --git a/DDSegmentation/src/MegatileLayerGridXY.cpp b/DDSegmentation/src/MegatileLayerGridXY.cpp index d425b74c57bd05647f50ee09e0537800e76e6037..bf4093a4048610502d5d42c759944d881afd7640 100644 --- a/DDSegmentation/src/MegatileLayerGridXY.cpp +++ b/DDSegmentation/src/MegatileLayerGridXY.cpp @@ -24,6 +24,46 @@ namespace DD4hep { // _description = "Cartesian segmentation in the local XY-plane for both Normal wafer and Magic wafer(depending on the layer dimensions)"; _description = "Cartesian segmentation in the local XY-plane: megatiles with dead areas; integer number of megatiles and cells"; +//////// setup in the compact-steering file (i.e., ILD_o3_v05.xml)//// +// for example, +// <segmentation type="MegatileLayerGridXY" yer_nCells="36" layer_nStripsX="2" layer_nStripsY="36" deadWidth="0" layer_configuration="TL"/> +//// +// + registerParameter("nMegaY", "number of megatiles along Z", _nMegaY , 1 , SegmentationParameter::NoUnit, true); +// _nMegaY is given by Ecal_n_wafers_per_tower from "model_parameters_ILD_o3_v05.xml" + + registerParameter("layer_nCells", "division of megatile into square tiles", _nCells, 36 , SegmentationParameter::NoUnit, true); + registerParameter("layer_nStripsX", "division of megatile into strips (1)", _nStripsX, 4 , SegmentationParameter::NoUnit, true); + registerParameter("layer_nStripsY", "division of megatile into strips (2)", _nStripsY, 36 , SegmentationParameter::NoUnit, true); + + registerParameter("deadWidth", "width of dead region at edge of megatile", _deadWidth, 0., SegmentationParameter::LengthUnit, true); + + registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "cellX"); + registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "cellY"); + + registerParameter("identifier_wafer", "Cell encoding identifier for wafer", _identifierWafer, std::string("wafer"), + SegmentationParameter::NoUnit, true); + + registerParameter("identifier_layer", "Cell encoding identifier for layer", _identifierLayer, std::string("layer"), + SegmentationParameter::NoUnit, true); + + registerParameter("identifier_module", "Cell encoding identifier for module", _identifierModule, std::string("module"), + SegmentationParameter::NoUnit, true); + + registerParameter("layer_configuration", "layer configuration (S, T, L)", _layerConfig, std::string("TLS"), SegmentationParameter::NoUnit, true); + + _calculated=false; + + } + + /// default constructor using an encoding string + MegatileLayerGridXY::MegatileLayerGridXY(BitField64* decoder) : + CartesianGrid(decoder) { + // define type and description + _type = "MegatileLayerGridXY"; + // _description = "Cartesian segmentation in the local XY-plane for both Normal wafer and Magic wafer(depending on the layer dimensions)"; + _description = "Cartesian segmentation in the local XY-plane: megatiles with dead areas; integer number of megatiles and cells"; + //////// setup in the compact-steering file (i.e., ILD_o3_v05.xml)//// // for example, // <segmentation type="MegatileLayerGridXY" yer_nCells="36" layer_nStripsX="2" layer_nStripsY="36" deadWidth="0" layer_configuration="TL"/> diff --git a/DDSegmentation/src/MultiSegmentation.cpp b/DDSegmentation/src/MultiSegmentation.cpp index facaeb59218d406ea02388006a5e2e508f53ec01..17ab760c0c1b2d46bcaeca56e5175e5156b25654 100644 --- a/DDSegmentation/src/MultiSegmentation.cpp +++ b/DDSegmentation/src/MultiSegmentation.cpp @@ -25,6 +25,17 @@ namespace DD4hep { registerParameter<string>("key", "Diskriminating field", m_discriminatorId, ""); } + /// Default constructor used by derived classes passing an existing decoder + MultiSegmentation::MultiSegmentation(BitField64* decoder) + : Segmentation(decoder), m_discriminator(0), m_debug(0) + { + // define type and description + _type = "MultiSegmentation"; + _description = "Multi-segmenation wrapper segmentation"; + //registerParameter<int>("debug", "Debug flag", m_debug, 0); + registerParameter<string>("key", "Diskriminating field", m_discriminatorId, ""); + } + /// destructor MultiSegmentation::~MultiSegmentation() { for(Segmentations::iterator i=m_segmentations.begin(); i!=m_segmentations.end(); ++i) diff --git a/DDSegmentation/src/PolarGrid.cpp b/DDSegmentation/src/PolarGrid.cpp index 32a2bc92a1a4d49a523e9f203fb9b4d7cca8eec8..88099ec3e87f588f2f4fe50eb2845f14f91fe27f 100644 --- a/DDSegmentation/src/PolarGrid.cpp +++ b/DDSegmentation/src/PolarGrid.cpp @@ -8,16 +8,19 @@ #include "DDSegmentation/PolarGrid.h" namespace DD4hep { -namespace DDSegmentation { + namespace DDSegmentation { -/// Default constructor used by derived classes passing the encoding string -PolarGrid::PolarGrid(const std::string& cellEncoding) : - Segmentation(cellEncoding) { -} + /// Default constructor used by derived classes passing the encoding string + PolarGrid::PolarGrid(const std::string& cellEncoding) : + Segmentation(cellEncoding) { + } + /// Default constructor used by derived classes passing an existing decoder + PolarGrid::PolarGrid(BitField64* decoder) : Segmentation(decoder) { + } -/// Destructor -PolarGrid::~PolarGrid() { -} + /// Destructor + PolarGrid::~PolarGrid() { + } -} /* namespace DDSegmentation */ + } /* namespace DDSegmentation */ } /* namespace DD4hep */ diff --git a/DDSegmentation/src/PolarGridRPhi.cpp b/DDSegmentation/src/PolarGridRPhi.cpp index 0b2a1058adfdf892314fe025602d4a1f7faff82d..a44569455ecb7137774098287af09472f53f2722 100644 --- a/DDSegmentation/src/PolarGridRPhi.cpp +++ b/DDSegmentation/src/PolarGridRPhi.cpp @@ -26,6 +26,23 @@ PolarGridRPhi::PolarGridRPhi(const std::string& cellEncoding) : registerIdentifier("identifier_phi", "Cell ID identifier for Phi", _phiId, "phi"); } + +/// Default constructor used by derived classes passing an existing decoder +PolarGridRPhi::PolarGridRPhi(BitField64* decoder) : + PolarGrid(decoder) { + // define type and description + _type = "PolarGridRPhi"; + _description = "Polar RPhi segmentation in the local XY-plane"; + + // register all necessary parameters + registerParameter("grid_size_r", "Cell size in R", _gridSizeR, 1., SegmentationParameter::LengthUnit); + registerParameter("grid_size_phi", "Cell size in Phi", _gridSizePhi, 1., SegmentationParameter::AngleUnit); + registerParameter("offset_r", "Cell offset in R", _offsetR, 0., SegmentationParameter::LengthUnit, true); + registerParameter("offset_phi", "Cell offset in Phi", _offsetPhi, 0., SegmentationParameter::AngleUnit, true); + registerIdentifier("identifier_r", "Cell ID identifier for R", _rId, "r"); + registerIdentifier("identifier_phi", "Cell ID identifier for Phi", _phiId, "phi"); +} + /// destructor PolarGridRPhi::~PolarGridRPhi() { diff --git a/DDSegmentation/src/PolarGridRPhi2.cpp b/DDSegmentation/src/PolarGridRPhi2.cpp index f776d910237e5938143c9b1f763f8cf8e285d5db..98c76fe5333c25a8fedca0e9fe05a00798659ede 100644 --- a/DDSegmentation/src/PolarGridRPhi2.cpp +++ b/DDSegmentation/src/PolarGridRPhi2.cpp @@ -26,6 +26,22 @@ PolarGridRPhi2::PolarGridRPhi2(const std::string& cellEncoding) : registerIdentifier("identifier_phi", "Cell ID identifier for Phi", _phiId, "phi"); } +/// Default constructor used by derived classes passing an existing decoder +PolarGridRPhi2::PolarGridRPhi2(BitField64* decoder) : + PolarGrid(decoder) { + // define type and description + _type = "PolarGridRPhi2"; + _description = "Polar RPhi segmentation in the local XY-plane"; + + // register all necessary parameters + registerParameter("grid_r_values", "Vector of R values", _gridRValues, std::vector<double>(), SegmentationParameter::LengthUnit, true); + registerParameter("grid_phi_values", "Cell size in Phi", _gridPhiValues, std::vector<double>(), SegmentationParameter::AngleUnit); + registerParameter("offset_r", "Cell offset in R", _offsetR, double(0.), SegmentationParameter::LengthUnit, true); + registerParameter("offset_phi", "Cell offset in Phi", _offsetPhi, double(0.), SegmentationParameter::AngleUnit, true); + registerIdentifier("identifier_r", "Cell ID identifier for R", _rId, "r"); + registerIdentifier("identifier_phi", "Cell ID identifier for Phi", _phiId, "phi"); +} + /// destructor PolarGridRPhi2::~PolarGridRPhi2() { diff --git a/DDSegmentation/src/ProjectiveCylinder.cpp b/DDSegmentation/src/ProjectiveCylinder.cpp index 47883b91c5748f0361b0530fb022fc8bd741b848..6e5e6179679b1ba668af6295bd65841a73936848 100644 --- a/DDSegmentation/src/ProjectiveCylinder.cpp +++ b/DDSegmentation/src/ProjectiveCylinder.cpp @@ -33,6 +33,23 @@ ProjectiveCylinder::ProjectiveCylinder(const std::string& cellEncoding) : registerIdentifier("identifier_phi", "Cell ID identifier for phi", _phiID, "phi"); } + +/// Default constructor used by derived classes passing an existing decoder +ProjectiveCylinder::ProjectiveCylinder(BitField64* decoder) : + CylindricalSegmentation(decoder) { + // define type and description + _type = "ProjectiveCylinder"; + _description = "Projective segmentation in the global coordinates"; + + // register all necessary parameters + registerParameter("theta_bins", "Number of bins theta", _thetaBins, 1); + registerParameter("phi_bins", "Number of bins phi", _phiBins, 1); + registerParameter("offset_theta", "Angular offset in theta", _offsetTheta, 0., SegmentationParameter::AngleUnit, true); + registerParameter("offset_phi", "Angular offset in phi", _offsetPhi, 0., SegmentationParameter::AngleUnit, true); + registerIdentifier("identifier_theta", "Cell ID identifier for theta", _thetaID, "theta"); + registerIdentifier("identifier_phi", "Cell ID identifier for phi", _phiID, "phi"); +} + /// destructor ProjectiveCylinder::~ProjectiveCylinder() { diff --git a/DDSegmentation/src/TiledLayerGridXY.cpp b/DDSegmentation/src/TiledLayerGridXY.cpp index 6d7b4bf5505050a5b61e2e971f3f3157c560444e..58afea8a4d268cd001f6c8e755d82200bea17b7c 100644 --- a/DDSegmentation/src/TiledLayerGridXY.cpp +++ b/DDSegmentation/src/TiledLayerGridXY.cpp @@ -39,6 +39,29 @@ TiledLayerGridXY::TiledLayerGridXY(const std::string& cellEncoding) : SegmentationParameter::NoUnit, true); } +/// Default constructor used by derived classes passing an existing decoder +TiledLayerGridXY::TiledLayerGridXY(BitField64* decoder) : + CartesianGrid(decoder) { + // define type and description + _type = "TiledLayerGridXY"; + _description = "Cartesian segmentation in the local XY-plane using optimal tiling depending on the layer dimensions"; + + std::cout << " ######### DD4hep::DDSegmentation::TiledLayerGridXY() " << std::endl ; + + // register all necessary parameters + registerParameter("grid_size_x", "Cell size in X", _gridSizeX, 1., SegmentationParameter::LengthUnit); + registerParameter("grid_size_y", "Cell size in Y", _gridSizeY, 1., SegmentationParameter::LengthUnit); + registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true); + registerParameter("offset_y", "Cell offset in Y", _offsetY, 0., SegmentationParameter::LengthUnit, true); + registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "x"); + registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "y"); + registerIdentifier("identifier_layer", "Cell encoding identifier for layer", _identifierLayer, "layer"); + registerParameter("layer_offsetX", "List of layer x offset", _layerOffsetX, std::vector<double>(), + SegmentationParameter::NoUnit, true); + registerParameter("layer_offsetY", "List of layer y offset", _layerOffsetY, std::vector<double>(), + SegmentationParameter::NoUnit, true); +} + /// destructor TiledLayerGridXY::~TiledLayerGridXY() { diff --git a/DDSegmentation/src/TiledLayerSegmentation.cpp b/DDSegmentation/src/TiledLayerSegmentation.cpp index ab0c6c544bd5ee59393646d73fb12f8fe3a800b2..0a35ac6a5b1c0a452b89fe4975b2df57b1a4bdb0 100644 --- a/DDSegmentation/src/TiledLayerSegmentation.cpp +++ b/DDSegmentation/src/TiledLayerSegmentation.cpp @@ -41,6 +41,28 @@ TiledLayerSegmentation::TiledLayerSegmentation(const std::string& cellEncoding) } +/// Default constructor used by derived classes passing an existing decoder +TiledLayerSegmentation::TiledLayerSegmentation(BitField64* decoder) : + Segmentation(decoder) { + _type = "TiledLayerSegmentation"; + _description = "Cartesian segmentation using optimal tiling depending on the layer dimensions"; + + // register all necessary parameters + registerParameter("grid_size_x", "Default cell size in X", _gridSizeX, 1., SegmentationParameter::LengthUnit); + registerParameter("grid_size_y", "Default cell size in Y", _gridSizeY, 1., SegmentationParameter::LengthUnit); + registerIdentifier("identifier_x", "Cell encoding identifier for X", _identifierX, "x"); + registerIdentifier("identifier_y", "Cell encoding identifier for Y", _identifierY, "y"); + registerParameter("identifier_layer", "Cell encoding identifier for layer", _identifierLayer, std::string("layer"), + SegmentationParameter::NoUnit, true); + registerParameter("layer_identifiers", "List of valid layer identifiers", _layerIndices, vector<int>(), + SegmentationParameter::NoUnit, true); + registerParameter("x_dimensions", "List of layer x dimensions", _layerDimensionsX, vector<double>(), + SegmentationParameter::NoUnit, true); + registerParameter("y_dimensions", "List of layer y dimensions", _layerDimensionsY, vector<double>(), + SegmentationParameter::NoUnit, true); + +} + TiledLayerSegmentation::~TiledLayerSegmentation() { } diff --git a/DDSegmentation/src/WaferGridXY.cpp b/DDSegmentation/src/WaferGridXY.cpp index d11adf21fe83eff480a19d56d334215a4fec325b..c55d2b0d360883f8a832d041e09e2fa138abc871 100644 --- a/DDSegmentation/src/WaferGridXY.cpp +++ b/DDSegmentation/src/WaferGridXY.cpp @@ -30,6 +30,26 @@ WaferGridXY::WaferGridXY(const std::string& cellEncoding) : SegmentationParameter::NoUnit, true); } +/// Default constructor used by derived classes passing an existing decoder +WaferGridXY::WaferGridXY(BitField64* decoder) : + CartesianGrid(decoder) { + // define type and description + _type = "WaferGridXY"; + _description = "Cartesian segmentation in the local XY-plane for both Normal wafer and Magic wafer(depending on the layer dimensions)"; + + // register all necessary parameters + registerParameter("grid_size_x", "Cell size in X", _gridSizeX, 1., SegmentationParameter::LengthUnit); + registerParameter("grid_size_y", "Cell size in Y", _gridSizeY, 1., SegmentationParameter::LengthUnit); + registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true); + registerParameter("offset_y", "Cell offset in Y", _offsetY, 0., SegmentationParameter::LengthUnit, true); + registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "x"); + registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "y"); + registerParameter("identifier_groupMGWafer", "Cell encoding identifier for Magic Wafer group", _identifierMGWaferGroup, std::string("layer"), + SegmentationParameter::NoUnit, true); + registerParameter("identifier_wafer", "Cell encoding identifier for wafer", _identifierWafer, std::string("wafer"), + SegmentationParameter::NoUnit, true); +} + /// destructor WaferGridXY::~WaferGridXY() {