From 906049ce2c30828daad01ca5329486ed29b83d87 Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Wed, 26 Jun 2013 15:44:43 +0000
Subject: [PATCH]   - added missing IDDescriptor description string   - tried
 to change encoding (starting with LSB)      did not work : commented out
 again

---
 DDCore/include/DD4hep/IDDescriptor.h | 5 ++++-
 DDCore/src/IDDescriptor.cpp          | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/DDCore/include/DD4hep/IDDescriptor.h b/DDCore/include/DD4hep/IDDescriptor.h
index 906148cdb..c42d281bd 100644
--- a/DDCore/include/DD4hep/IDDescriptor.h
+++ b/DDCore/include/DD4hep/IDDescriptor.h
@@ -35,7 +35,7 @@ namespace DD4hep {
      *  @date    2012/07/31
      */
     struct IDDescriptor : public Ref_t  {
-      public:
+    public:
       typedef unsigned long long int VolumeID;
       //typedef std::pair<int,int>          Field;
       struct Field  {
@@ -43,9 +43,12 @@ namespace DD4hep {
 	VolumeID mask;
 	VolumeID encode(int value)  const  {
 	  VolumeID v = value;
+	  //FGxx return  ( (  v  << first )  & mask  ) ;
 	  return mask|((v<<(64-second))>>first);
+
 	}
 	int decode(VolumeID value)  const  {
+	  //FGxx return  ( mask & value ) >> first  ;
 	  return (~mask&value)>>(64-second-first);
 	}
       };
diff --git a/DDCore/src/IDDescriptor.cpp b/DDCore/src/IDDescriptor.cpp
index 671b25499..0b738b3b6 100644
--- a/DDCore/src/IDDescriptor.cpp
+++ b/DDCore/src/IDDescriptor.cpp
@@ -39,6 +39,8 @@ namespace {
     o->maxBit = 0;
     o->fieldIDs.clear();
     o->fieldMap.clear();
+    o->description = dsc ;
+
     for(Elements::const_iterator i=elements.begin();i!=elements.end();++i)  {
       const string& s = *i;
       f.clear();
@@ -48,7 +50,10 @@ namespace {
       field.first  = f.size() == 3 ? ::atoi(f[1].c_str()) : pos;
       field.second = f.size() == 3 ? ::atoi(f[2].c_str()) : ::atoi(f[1].c_str());
       field.second = ::abs(field.second);
+
+      //FG:   field.mask = ( ( 0x0001LL << (field.second) ) - 1 ) << field.first ;
       field.mask   = ~((~0x0ull<<(64-field.second))>>(64-field.second)<<(64-field.first-field.second));
+
       pos = field.first + ::abs(field.second);
       if ( pos>o->maxBit ) o->maxBit = pos;
       o->fieldIDs.push_back(make_pair(o->fieldMap.size(),f[0]));
-- 
GitLab