From 950ef0a8cd1f7edcd602a026b571229fff9c9beb Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Tue, 6 May 2014 14:05:41 +0000
Subject: [PATCH]   - teveDisplay:      - draw sensitive surfaces in red and
 helper surfaces in gray      - protect against missing lcio input file   -
 reduced printout from VolumeManager  (changed INFO to DEBUG)

---
 DDCore/src/VolumeManager.cpp             | 10 +++++-----
 DDSurfaces/include/DDSurfaces/ISurface.h | 10 ++++++++++
 UtilityApps/src/teve_display.cpp         | 25 +++++++++++-------------
 doc/release.notes                        | 13 +++++++++---
 examples/ILDExDet/src/ILDExTPC_geo.cpp   |  6 +-----
 5 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp
index 1266898f3..e9f59f7f1 100644
--- a/DDCore/src/VolumeManager.cpp
+++ b/DDCore/src/VolumeManager.cpp
@@ -203,13 +203,13 @@ namespace {
         log << id.first << "=" << id.second << "," << value << " [" << f->offset() << "," << f->width() << "] ";
       }
       log << " Sensitive:" << yes_no(sensitive);
-      printout(INFO, "VolumeManager", log.str().c_str());
+      printout(DEBUG, "VolumeManager", log.str().c_str());
 #if 0
       log.str("");
       log << s_count << ": " << e.name() << " Detector GeoNodes:";
       for(vector<const TGeoNode*>::const_iterator j=nodes.begin(); j!=nodes.end();++j)
       log << (void*)(*j) << " ";
-      printout(INFO,"VolumeManager",log.str().c_str());
+      printout(DEBUG,"VolumeManager",log.str().c_str());
 #endif
     }
   };
@@ -243,13 +243,13 @@ VolumeManager::Object::~Object() {
 /// Update callback when alignment has changed (called only for subdetectors....)
 void VolumeManager::Object::update(unsigned long tags, DetElement& det, void* param)   {
   if ( DetElement::CONDITIONS_CHANGED == (tags&DetElement::CONDITIONS_CHANGED) )
-    printout(INFO,"VolumeManager","+++ Conditions update %s param:%p",det.path().c_str(),param);
+    printout(DEBUG,"VolumeManager","+++ Conditions update %s param:%p",det.path().c_str(),param);
   if ( DetElement::PLACEMENT_CHANGED == (tags&DetElement::PLACEMENT_CHANGED) )  
-    printout(INFO,"VolumeManager","+++ Alignment update %s param:%p",det.path().c_str(),param);
+    printout(DEBUG,"VolumeManager","+++ Alignment update %s param:%p",det.path().c_str(),param);
 
   for(Volumes::iterator i=volumes.begin(); i != volumes.end(); ++i)  {
     Context* c = (*i).second;
-    printout(INFO,"VolumeManager","+++ Alignment update %s",c->placement.name());
+    printout(DEBUG,"VolumeManager","+++ Alignment update %s",c->placement.name());
     
   }
 }
diff --git a/DDSurfaces/include/DDSurfaces/ISurface.h b/DDSurfaces/include/DDSurfaces/ISurface.h
index 549f5ba44..aabed8529 100644
--- a/DDSurfaces/include/DDSurfaces/ISurface.h
+++ b/DDSurfaces/include/DDSurfaces/ISurface.h
@@ -79,6 +79,7 @@ namespace DDSurfaces {
     virtual double radius() const=0 ;
   };
   
+  //==============================================================================================
   
   /** Helper class for describing surface properties.
    *  Usage: SurfaceType type(  SurfaceType::Plane, SurfaceType::Sensitive ) ; 
@@ -165,6 +166,15 @@ namespace DDSurfaces {
     bool isZDisk() const  { return ( _bits[ SurfaceType::Plane ] &&  _bits[ SurfaceType::OrthogonalToZ ] ) ; } 
 
 
+    /// true if all properties of otherType are also true for this type.
+    bool isSimilar( const SurfaceType& otherType) const {
+      unsigned long otherBits = otherType._bits.to_ulong() ;
+      unsigned long theseBits = _bits.to_ulong() ;
+            //      std::cout << " ** isSimilar : " << otherType._bits.to_string() << " - " << _bits.to_string() << " : " <<  ((  otherBits & theseBits ) == otherBits) << std::endl ;
+      return (  otherBits & theseBits ) == otherBits ;
+    }
+
+
     /** True if surface is parallel to Z with accuracy epsilon - result is cached in bit SurfaceType::ParallelToZ */
     bool checkParallelToZ( const ISurface& surf , double epsilon=1.e-6 ) const { 
       
diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp
index 25713053a..4433192ca 100644
--- a/UtilityApps/src/teve_display.cpp
+++ b/UtilityApps/src/teve_display.cpp
@@ -60,8 +60,8 @@ using namespace DDSurfaces ;
 void next_event();
 void make_gui();
 
-TEveStraightLineSet* getSurfaces() ;
-TEveStraightLineSet* getSurfaceVectors() ;
+TEveStraightLineSet* getSurfaces(int col=kRed, const SurfaceType& type=SurfaceType() ) ;
+TEveStraightLineSet* getSurfaceVectors( ) ;
 
 //=====================================================================================
 
@@ -93,10 +93,12 @@ static long teve_display(LCDD& lcdd, int /* argc */, char** /* argv */) {
 
   gEve->AddGlobalElement( tn );
 
-  TEveElement* surfaces = getSurfaces() ;
+  TEveElement* surfaces = getSurfaces(  kRed, SurfaceType( SurfaceType::Sensitive ) ) ;
+  TEveElement* helperSurfaces = getSurfaces(  kGray, SurfaceType( SurfaceType::Helper ) ) ;
   TEveElement* surfaceVectors = getSurfaceVectors() ;
 
   gEve->AddGlobalElement( surfaces ) ;
+  gEve->AddGlobalElement( helperSurfaces ) ;
   gEve->AddGlobalElement( surfaceVectors ) ;
 
   TGLViewer *v = gEve->GetDefaultGLViewer();
@@ -107,15 +109,10 @@ static long teve_display(LCDD& lcdd, int /* argc */, char** /* argv */) {
   v->RefreshPadEditor(v);
   //  v->CurrentCamera().RotateRad(-1.2, 0.5);
 
-
-  // -- tgeo shapes cannot be projected ...
-  // MultiView::instance()->ImportGeomRPhi( tn );
-  // MultiView::instance()->ImportGeomRhoZ( tn );
   MultiView::instance()->ImportGeomRPhi( surfaces );
   MultiView::instance()->ImportGeomRhoZ( surfaces ) ;
-  //-- don't show the surface vectors...
-  //MultiView::instance()->ImportGeomRPhi( surfaceVectors );
-  //MultiView::instance()->ImportGeomRhoZ( surfaceVectors );
+  MultiView::instance()->ImportGeomRPhi( helperSurfaces );
+  MultiView::instance()->ImportGeomRhoZ( helperSurfaces ) ;
 
 
   make_gui();
@@ -179,7 +176,7 @@ TEveStraightLineSet* getSurfaceVectors() {
   return ls;
 }
 //=====================================================================================
-TEveStraightLineSet* getSurfaces() {
+TEveStraightLineSet* getSurfaces(int col, const SurfaceType& type) {
 
   TEveStraightLineSet* ls = new TEveStraightLineSet("Surfaces");
 
@@ -198,7 +195,7 @@ TEveStraightLineSet* getSurfaces() {
 
     Surface* surf = *it ;
 
-    if( ! surf->type().isVisible() ) 
+    if( ! ( surf->type().isVisible() && ( surf->type().isSimilar( type ) ) ) ) 
       continue ;
 
     const std::vector< std::pair<Vector3D,Vector3D> > lines = surf->getLines() ;
@@ -216,8 +213,8 @@ TEveStraightLineSet* getSurfaces() {
 		   lines[i].second.x(), lines[i].second.y(), lines[i].second.z() ) ;
     }
     
-    ls->SetLineColor( kRed ) ;
-    ls->SetMarkerColor( kRed ) ;
+    ls->SetLineColor( col ) ;
+    ls->SetMarkerColor( col ) ;
     ls->SetMarkerSize(.1);
     ls->SetMarkerStyle(4);
 
diff --git a/doc/release.notes b/doc/release.notes
index 4313aa88a..ccda81c52 100644
--- a/doc/release.notes
+++ b/doc/release.notes
@@ -1,7 +1,15 @@
 DD4hep  ----  Release Notes
 =================================
 
-
+2014/05/06 Frank Gaede
+-----------------------
+  - DDSurfaces/DDRec:
+    - added ICylinder and CylinderSurface to provide
+      access to cylinder radius for the tracking
+  - teveDisplay: 
+     - draw sensitive surfaces in red and helper surfaces in gray
+     - protect against missing lcio input file
+  - reduced printout from VolumeManager  (changed INFO to DEBUG)
 
 2014/04/05-2014/04/29 Frank Gaede
 ---------------------------------
@@ -19,8 +27,7 @@ DD4hep  ----  Release Notes
    - added some surfaces to ILDExDet: VXD, SIT, TPC
    - added test_surfaces to ILDExSimu
      (fails currently for some hits that are not created on the surface ...)
-     
-   
+   - added some assemblies to ILDExDet to better structure the geometry hierarchy   
 
 2014/04/28  Markus Frank
 ------------------------
diff --git a/examples/ILDExDet/src/ILDExTPC_geo.cpp b/examples/ILDExDet/src/ILDExTPC_geo.cpp
index 81a7cf31b..49a0a965d 100644
--- a/examples/ILDExDet/src/ILDExTPC_geo.cpp
+++ b/examples/ILDExDet/src/ILDExTPC_geo.cpp
@@ -180,11 +180,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
       tpcData->endplate=part_det;
 
       // add a plane to the endcap volume 
-      // note: u and v are exchanged: normal is along z ...
-      // Vector3D u( 0. , 1. , 0. ) ;
-      // Vector3D v( 0. , 0. , 1. ) ;
-      // Vector3D n( 1. , 0. , 0. ) ;
-      
+      // note: u and v are exchanged: normal is along z ...      
       VolPlane surf( part_vol , SurfaceType( SurfaceType::Helper ) , px_tube.zhalf() , x_tube.zhalf(), u , n , v ) ;
       volSurfaceList( part_det )->push_back( surf ) ;
 
-- 
GitLab