From df776161d9ed5f6eb902d730937cb6fe7a8c39da Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Tue, 18 Oct 2016 22:15:35 +0200 Subject: [PATCH] Convert segmentations to DD4hep handles --- DDCore/include/DD4hep/Factories.h | 58 +++++++++++++------ DDCore/include/DD4hep/Segmentations.h | 25 +++++++- DDCore/src/Segmentations.cpp | 16 ++++- DDCore/src/plugins/Compact2Objects.cpp | 44 +++++++------- .../include/DDSegmentation/CartesianGrid.h | 2 + .../include/DDSegmentation/CartesianGridXY.h | 2 + .../include/DDSegmentation/CartesianGridXYZ.h | 2 + .../include/DDSegmentation/CartesianGridXZ.h | 2 + .../include/DDSegmentation/CartesianGridYZ.h | 2 + .../DDSegmentation/CylindricalSegmentation.h | 2 + .../DDSegmentation/MegatileLayerGridXY.h | 2 + .../DDSegmentation/MultiSegmentation.h | 3 + .../include/DDSegmentation/PolarGrid.h | 2 + .../include/DDSegmentation/PolarGridRPhi.h | 2 + .../include/DDSegmentation/PolarGridRPhi2.h | 2 + .../DDSegmentation/ProjectiveCylinder.h | 2 + .../include/DDSegmentation/TiledLayerGridXY.h | 2 + .../DDSegmentation/TiledLayerSegmentation.h | 2 + .../include/DDSegmentation/WaferGridXY.h | 2 + DDSegmentation/src/CartesianGrid.cpp | 22 ++++--- DDSegmentation/src/CartesianGridXY.cpp | 17 ++++++ DDSegmentation/src/CartesianGridXYZ.cpp | 13 +++++ DDSegmentation/src/CartesianGridXZ.cpp | 16 +++++ DDSegmentation/src/CartesianGridYZ.cpp | 17 ++++++ .../src/CylindricalSegmentation.cpp | 5 ++ DDSegmentation/src/MegatileLayerGridXY.cpp | 40 +++++++++++++ DDSegmentation/src/MultiSegmentation.cpp | 11 ++++ DDSegmentation/src/PolarGrid.cpp | 21 ++++--- DDSegmentation/src/PolarGridRPhi.cpp | 17 ++++++ DDSegmentation/src/PolarGridRPhi2.cpp | 16 +++++ DDSegmentation/src/ProjectiveCylinder.cpp | 17 ++++++ DDSegmentation/src/TiledLayerGridXY.cpp | 23 ++++++++ DDSegmentation/src/TiledLayerSegmentation.cpp | 22 +++++++ DDSegmentation/src/WaferGridXY.cpp | 20 +++++++ 34 files changed, 390 insertions(+), 61 deletions(-) diff --git a/DDCore/include/DD4hep/Factories.h b/DDCore/include/DD4hep/Factories.h index 215e2cde9..6f07541da 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 4f75e7774..9a98c85cf 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 2a4d53a10..4578eac6a 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 96ba65161..9fd9848d3 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 f04409902..bef731766 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 ca9e6cdda..b0b1d0ed1 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 c8e45780f..99c3729a4 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 0719bcbf8..98e575ccd 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 9060b60a1..08785d961 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 5d12401d6..565dae3df 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 72f9afd15..01516591b 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 557919d89..24a9f46c4 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 e147c8ff0..5dde8535f 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 508d32286..a2110bf3f 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 985ab80dd..5b69cad32 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 6ab7c68fc..b565fe9fb 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 c1cb91a61..2175a377f 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 9b6f9b0af..3027bd273 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 8dd758b4e..042ff2476 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 bc81ba2eb..8774fa8d6 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 7be3cdf18..b474cc13e 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 626b5065d..9937b7216 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 13afe2204..07f88b0a1 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 7e07065fa..3498e8711 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 ffe5da2e6..dbb4b1b4c 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 d425b74c5..bf4093a40 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 facaeb592..17ab760c0 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 32a2bc92a..88099ec3e 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 0b2a1058a..a44569455 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 f776d9102..98c76fe53 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 47883b91c..6e5e61796 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 6d7b4bf55..58afea8a4 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 ab0c6c544..0a35ac6a5 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 d11adf21f..c55d2b0d3 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() { -- GitLab