From 0edde6c42c0c6da56625af74ff707a4323374c91 Mon Sep 17 00:00:00 2001
From: Markus Frank <markus.frank@cern.ch>
Date: Mon, 12 Oct 2015 09:54:50 +0000
Subject: [PATCH] Remove some CppCheck warnings from the nightly builds

---
 DDCore/src/plugins/LCDDConverter.cpp          |  33 ++--
 DDDetectors/src/MultiLayerTracker_geo.cpp     |   1 -
 .../src/PolyhedraBarrelCalorimeter2_geo.cpp   |   8 +-
 DDDetectors/src/SubdetectorAssembly_geo.cpp   |   6 +-
 DDG4/lcio/LCIOConversions.cpp                 |  14 +-
 DDG4/lcio/LCIOEventReader.cpp                 |   5 +-
 DDG4/plugins/Geant4EventReaderHepMC.cpp       |   6 +-
 DDG4/plugins/Geant4SDActions.cpp              |   4 +-
 DDG4/scripts/dumpDDG4.C                       | 157 +++++++++---------
 DDG4/src/Geant4Action.cpp                     |   4 +-
 DDG4/src/Geant4Converter.cpp                  |   7 +-
 DDG4/src/Geant4InputHandling.cpp              |   3 +-
 DDG4/src/IoStreams.cpp                        |   4 +-
 examples/ClientTests/src/MiniTel.cpp          |  39 ++---
 14 files changed, 145 insertions(+), 146 deletions(-)

diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp
index a7eea5d65..81ab0fea6 100644
--- a/DDCore/src/plugins/LCDDConverter.cpp
+++ b/DDCore/src/plugins/LCDDConverter.cpp
@@ -186,7 +186,7 @@ xml_h LCDDConverter::handleMaterial(const string& name, Material medium) const {
       }
       for (int i = 0, n = mix->GetNelements(); i < n; i++) {
         TGeoElement *elt = mix->GetElement(i);
-        string formula = elt->GetTitle() + string("_elm");
+        //string formula = elt->GetTitle() + string("_elm");
         if (nmix) {
           mat.append(obj = xml_elt_t(geo.doc, _U(composite)));
           obj.setAttr(_U(n), nmix[i]);
@@ -688,10 +688,10 @@ xml_h LCDDConverter::handleVolume(const string& /* name */, Volume volume) const
     }
     geo.doc_structure.append(vol);
     geo.xmlVolumes[v] = vol;
-    const TObjArray* dau = ((TGeoVolume*) v)->GetNodes();
+    const TObjArray* dau = const_cast<TGeoVolume*>(v)->GetNodes();
     if (dau && dau->GetEntries() > 0) {
       for (Int_t i = 0, n_dau = dau->GetEntries(); i < n_dau; ++i) {
-        TGeoNode* node = (TGeoNode*) dau->At(i);
+        TGeoNode* node = reinterpret_cast<TGeoNode*>(dau->At(i));
         handlePlacement(node->GetName(), node);
       }
     }
@@ -1007,8 +1007,8 @@ xml_h LCDDConverter::handleField(const std::string& /* name */, OverlayedField f
     if (!fld.isValid()) {
       PluginDebug dbg;
       PluginService::Create<NamedObject*>(type + "_Convert2LCDD", &m_lcdd, &field, &fld);
-      throw runtime_error(
-                          "Failed to locate plugin to convert electromagnetic field:" + string(f->GetName()) + " of type " + type + ". "
+      throw runtime_error("Failed to locate plugin to convert electromagnetic field:"
+                          + string(f->GetName()) + " of type " + type + ". "
                           + dbg.missingFactory(type));
     }
     geo.doc_fields.append(field);
@@ -1176,7 +1176,8 @@ xml_doc_t LCDDConverter::createVis(DetElement top) {
   GeometryInfo& geo = *(m_dataPtr = new GeometryInfo);
   m_data->clear();
   collect(top, geo);
-  printout(ALWAYS,"LCDDConverter","++ ==> Dump visualisation attributes from in memory detector description...");
+  printout(ALWAYS,"LCDDConverter","++ ==> Dump visualisation attributes "
+           "from in memory detector description...");
   const char comment[] = "\n"
     "      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
     "      ++++   Linear collider detector description LCDD in C++  ++++\n"
@@ -1229,7 +1230,8 @@ xml_doc_t LCDDConverter::createLCDD(DetElement top) {
   geo.doc_root = geo.doc.root();
   geo.doc_root.setAttr(Unicode("xmlns:lcdd"), "http://www.lcsim.org/schemas/lcdd/1.0");
   geo.doc_root.setAttr(Unicode("xmlns:xs"), "http://www.w3.org/2001/XMLSchema-instance");
-  geo.doc_root.setAttr(Unicode("xs:noNamespaceSchemaLocation"), "http://www.lcsim.org/schemas/lcdd/1.0/lcdd.xsd");
+  geo.doc_root.setAttr(Unicode("xs:noNamespaceSchemaLocation"), 
+                       "http://www.lcsim.org/schemas/lcdd/1.0/lcdd.xsd");
 
   geo.doc_root.append(geo.doc_header = xml_elt_t(geo.doc, _U(header)));
   geo.doc_root.append(geo.doc_idDict = xml_elt_t(geo.doc, _U(iddict)));
@@ -1295,8 +1297,10 @@ xml_doc_t LCDDConverter::createLCDD(DetElement top) {
 
 /// Helper constructor
 LCDDConverter::GeometryInfo::GeometryInfo()
-  : doc(0), doc_root(0), doc_header(0), doc_idDict(0), doc_detectors(0), doc_limits(0), doc_regions(0), doc_display(0), doc_gdml(
-                                                                                                                                 0), doc_fields(0), doc_define(0), doc_materials(0), doc_solids(0), doc_structure(0), doc_setup(0) {
+  : doc(0), doc_root(0), doc_header(0), doc_idDict(0), doc_detectors(0), doc_limits(0), 
+    doc_regions(0), doc_display(0), doc_gdml(0), doc_fields(0), doc_define(0),
+    doc_materials(0), doc_solids(0), doc_structure(0), doc_setup(0)
+{
 }
 
 static long dump_output(xml_doc_t doc, int argc, char** argv) {
@@ -1334,10 +1338,13 @@ static long create_visASCII(LCDD& lcdd, int /* argc */, char** argv) {
     xml_comp_t ref = c.child(_U(visref));
     xml_comp_t vis = (*vis_map.find(ref.refStr())).second;
     xml_comp_t col = vis.child(_U(color));
-    os << "vol:" << vol.nameStr() << sep << "vis:" << vis.nameStr() << sep << "visible:" << vis.visible() << sep << "r:"
-       << col.R() << sep << "g:" << col.G() << sep << "b:" << col.B() << sep << "alpha:" << col.alpha() << sep << "line_style:"
-       << vis.attr < string > (_U(line_style)) << sep << "drawing_style:" << vis.attr < string
-                                                                                        > (_U(drawing_style)) << sep << "show_daughters:" << vis.show_daughters() << sep << endl;
+    os << "vol:" << vol.nameStr() << sep << "vis:" << vis.nameStr() << sep 
+       << "visible:" << vis.visible() << sep << "r:"
+       << col.R() << sep << "g:" << col.G() << sep << "b:" << col.B() << sep 
+       << "alpha:" << col.alpha() << sep << "line_style:"
+       << vis.attr < string > (_U(line_style)) << sep 
+       << "drawing_style:" << vis.attr < string> (_U(drawing_style)) << sep 
+       << "show_daughters:" << vis.show_daughters() << sep << endl;
   }
   os.close();
   return 1;
diff --git a/DDDetectors/src/MultiLayerTracker_geo.cpp b/DDDetectors/src/MultiLayerTracker_geo.cpp
index c4028601a..b36119793 100644
--- a/DDDetectors/src/MultiLayerTracker_geo.cpp
+++ b/DDDetectors/src/MultiLayerTracker_geo.cpp
@@ -24,7 +24,6 @@ using namespace DD4hep::Geometry;
 static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
   xml_det_t  x_det     = e;
   string     det_name  = x_det.nameStr();
-  string     det_type  = x_det.typeStr();
   Material   air       = lcdd.air();
   DetElement sdet        (det_name,x_det.id());
   Assembly   assembly    (det_name+"_assembly");
diff --git a/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp b/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp
index 9c4a61f87..5fb587b8d 100644
--- a/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp
+++ b/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp
@@ -52,11 +52,8 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) {
   xml_comp_t staves = x_det.staves();
   xml_dim_t dim = x_det.dimensions();
   string det_name = x_det.nameStr();
-  string det_type = x_det.typeStr();
   Material air = lcdd.air();
   double totalThickness = layering.totalThickness();
-  int totalRepeat = 0;
-  int totalSlices = 0;
   double gap = xml_dim_t(x_det).gap();
   int numSides = dim.numsides();
   double detZ = dim.z();
@@ -65,13 +62,16 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) {
   DetElement stave("stave1", x_det.id());
   Volume motherVol = lcdd.pickMotherVolume(sdet);
 
+#if 0
+  int totalRepeat = 0;
+  int totalSlices = 0;
   for (xml_coll_t c(x_det, _U(layer)); c; ++c) {
     xml_comp_t x_layer = c;
     int repeat = x_layer.repeat();
     totalRepeat += repeat;
     totalSlices += x_layer.numChildren(_U(slice));
   }
-
+#endif
   PolyhedraRegular polyhedra(numSides, rmin, rmin + totalThickness, detZ);
   Volume envelopeVol(det_name, polyhedra, air);
 
diff --git a/DDDetectors/src/SubdetectorAssembly_geo.cpp b/DDDetectors/src/SubdetectorAssembly_geo.cpp
index f72ff8a95..b2444dcf4 100644
--- a/DDDetectors/src/SubdetectorAssembly_geo.cpp
+++ b/DDDetectors/src/SubdetectorAssembly_geo.cpp
@@ -29,14 +29,12 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t)  {
   DetElement sdet(det_name, x_det.id());
   Volume     vol;
 
-  bool useRot = false;
-  bool usePos = false; 
+  bool useRot = x_det.hasChild(_U(rotation));
+  bool usePos = x_det.hasChild(_U(position));
   Position    pos;
   RotationZYX rot;
 
   sdet.setType("compound");
-  usePos = x_det.hasChild(_U(position));
-  useRot = x_det.hasChild(_U(rotation));
   if( usePos ) {
     pos = Position(x_det.position().x(), x_det.position().y(), x_det.position().z());
   }
diff --git a/DDG4/lcio/LCIOConversions.cpp b/DDG4/lcio/LCIOConversions.cpp
index 7ce88363b..c98770a68 100644
--- a/DDG4/lcio/LCIOConversions.cpp
+++ b/DDG4/lcio/LCIOConversions.cpp
@@ -190,12 +190,14 @@ namespace DD4hep {
         for(Contributions::const_iterator j=hit->truth.begin(); j!=hit->truth.end(); ++j)   {
           const Geant4HitData::Contribution& c = *j;
           int trackID = pm->particleID(c.trackID);
-          float contrib_pos[] = {float(c.x/mm), float(c.y/mm), float(c.z/mm)};
           EVENT::MCParticle* lc_mcp = (EVENT::MCParticle*)lc_parts->getElementAt(trackID);
-          if ( hit_creation_mode == Geant4Sensitive::DETAILED_MODE )
+          if ( hit_creation_mode == Geant4Sensitive::DETAILED_MODE )     {
+            float contrib_pos[] = {float(c.x/mm), float(c.y/mm), float(c.z/mm)};
             lc_hit->addMCParticleContribution(lc_mcp, c.deposit/GeV, c.time/ns, c.pdgID, contrib_pos);
-          else
+          }
+          else    {
             lc_hit->addMCParticleContribution(lc_mcp, c.deposit/GeV, c.time/ns);
+          }
         }
       }
       return lc_coll;
@@ -266,9 +268,9 @@ namespace DD4hep {
                          pair<const Geant4Context*,Geant4HitCollection*>,
                          lcio::SimCalorimeterHitImpl>::operator()(const arg_t& args)  const
     {
-      Geant4Sensitive* sd  = args.second->sensitive();
-      string           dsc = encoding(args.second->sensitive()->sensitiveDetector());
-      output_t*        lc  = new lcio::LCCollectionVec(lcio::LCIO::SIMCALORIMETERHIT);
+      Geant4Sensitive*  sd  = args.second->sensitive();
+      //string          dsc = encoding(args.second->sensitive()->sensitiveDetector());
+      output_t*         lc  = new lcio::LCCollectionVec(lcio::LCIO::SIMCALORIMETERHIT);
       int hit_creation_mode = sd->hitCreationMode();
 
       if ( hit_creation_mode == Geant4Sensitive::DETAILED_MODE )
diff --git a/DDG4/lcio/LCIOEventReader.cpp b/DDG4/lcio/LCIOEventReader.cpp
index a79badf86..df551e800 100644
--- a/DDG4/lcio/LCIOEventReader.cpp
+++ b/DDG4/lcio/LCIOEventReader.cpp
@@ -63,10 +63,7 @@ LCIOEventReader::readParticles(int event_number, vector<Particle*>& particles)
   EVENT::LCCollection*        primaries = 0;
   map<EVENT::MCParticle*,int> mcparts;
   vector<EVENT::MCParticle*>  mcpcoll;
-  EventReaderStatus ret = EVENT_READER_OK;
-
-  ret = readParticleCollection(event_number,&primaries);
-  //ret = EVENT_READER_NO_DIRECT;
+  EventReaderStatus ret = readParticleCollection(event_number,&primaries);
 
   ++m_numEvent;
   if ( ret != EVENT_READER_OK ) return ret;
diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp
index b76d5705a..1b6c347e7 100644
--- a/DDG4/plugins/Geant4EventReaderHepMC.cpp
+++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp
@@ -102,7 +102,8 @@ namespace DD4hep {
         float alpha_qed;
         vector<float>      weights;
         vector<long>       random;
-        EventHeader() {}
+        EventHeader() : id(0), num_vertices(0), signal_process_id(0), signal_process_vertex(0),
+                        scale(0.0), alpha_qcd(0.0), alpha_qed(0.0), weights(), random() {}
       };
 
       /// The known_io enum is used to track which type of input is being read
@@ -126,7 +127,8 @@ namespace DD4hep {
         Particles m_particles;
 
 
-        EventStream(istream& in) : instream(in), io_type(0)
+        EventStream(istream& in) : instream(in), mom_unit(0.0), pos_unit(0.0),
+                                   io_type(0), xsection(0.0), xsection_err(0.0)
         { use_default_units();                       }
         /// Check if data stream is in proper state and has data
         bool ok()  const;
diff --git a/DDG4/plugins/Geant4SDActions.cpp b/DDG4/plugins/Geant4SDActions.cpp
index 2b76038da..7a3825cbd 100644
--- a/DDG4/plugins/Geant4SDActions.cpp
+++ b/DDG4/plugins/Geant4SDActions.cpp
@@ -269,7 +269,9 @@ namespace DD4hep {
       int               combined;
       long long int     cell;
 
-      TrackerCombine() : pre(), post(), sensitive(0), e_cut(0.0), current(-1), combined(0), cell(0)  {
+      TrackerCombine() : pre(), post(), sensitive(0), mean_time(0.0), 
+                         e_cut(0.0), current(-1), combined(0), cell(0)
+      {
       }
 
       /// Start a new hit
diff --git a/DDG4/scripts/dumpDDG4.C b/DDG4/scripts/dumpDDG4.C
index aaf7e1fa6..b76e3e103 100644
--- a/DDG4/scripts/dumpDDG4.C
+++ b/DDG4/scripts/dumpDDG4.C
@@ -43,10 +43,10 @@ namespace {
 
   int usage()  {
     printf("\ndumpDDG4 -opt [-opt]                                                                   \n"
-	   "    -compact <compact-geometry>   Supply geometry file to check hits with volume manager.\n"
-	   "    -input   <root-file>          File generated with DDG4                               \n"
-	   "    -event   <event-number>       Specify event to be dumped. Default: ALL.              \n"
-	   "\n\n");
+           "    -compact <compact-geometry>   Supply geometry file to check hits with volume manager.\n"
+           "    -input   <root-file>          File generated with DDG4                               \n"
+           "    -event   <event-number>       Specify event to be dumped. Default: ALL.              \n"
+           "\n\n");
     return EINVAL;
   }
 
@@ -67,32 +67,31 @@ namespace {
       Segmentation seg = sd.readout().segmentation();
       VolumeManager vm = lcdd.volumeManager();
       for(_H::const_iterator i=hits->begin(); i!=hits->end(); ++i)  {
-	const Geant4Tracker::Hit* h = *i;
-	const Geometry::Position& pos = h->position;
-	Geometry::Position pos_cell = seg.position(h->cellID);
-	PlacedVolume pv = vm.lookupPlacement(h->cellID);
-	printout(ALWAYS,container,
-		 "+++ Track:%3d PDG:%6d Pos:(%+.2e,%+.2e,%+.2e)[mm] Pixel:(%+.2e,%+.2e,%+.2e)[mm] %s Deposit:%7.3f MeV CellID:%16lX",
-		 h->truth.trackID,h->truth.pdgID,
-		 pos.x()/mm,pos.y()/mm,pos.z()/mm,
-		 pos_cell.x()/dd4hep::mm,pos_cell.y()/dd4hep::mm,pos_cell.z()/dd4hep::mm,
-		 pv.name(),h->truth.deposit/MeV,h->cellID
-		 );
-	delete h;
+        const Geant4Tracker::Hit* h = *i;
+        const Geometry::Position& pos = h->position;
+        Geometry::Position pos_cell = seg.position(h->cellID);
+        PlacedVolume pv = vm.lookupPlacement(h->cellID);
+        printout(ALWAYS,container,
+                 "+++ Track:%3d PDG:%6d Pos:(%+.2e,%+.2e,%+.2e)[mm] Pixel:(%+.2e,%+.2e,%+.2e)[mm] %s Deposit:%7.3f MeV CellID:%16lX",
+                 h->truth.trackID,h->truth.pdgID,
+                 pos.x()/mm,pos.y()/mm,pos.z()/mm,
+                 pos_cell.x()/dd4hep::mm,pos_cell.y()/dd4hep::mm,pos_cell.z()/dd4hep::mm,
+                 pv.name(),h->truth.deposit/MeV,h->cellID
+                 );
+        delete h;
       }
     }
     else  {
-      string det_name = container;
       for(_H::const_iterator i=hits->begin(); i!=hits->end(); ++i)  {
-	const Geant4Tracker::Hit* h = *i;
-	const Geometry::Position& pos = h->position;
-	printout(ALWAYS,container,
-		 "+++ Track:%3d PDG:%6d Pos:(%+.2e,%+.2e,%+.2e)[mm] Deposit:%7.3f MeV CellID:%16lX",
-		 h->truth.trackID,h->truth.pdgID,
-		 pos.x()/mm,pos.y()/mm,pos.z()/mm,
-		 h->truth.deposit/MeV,h->cellID
-		 );
-	delete h;
+        const Geant4Tracker::Hit* h = *i;
+        const Geometry::Position& pos = h->position;
+        printout(ALWAYS,container,
+                 "+++ Track:%3d PDG:%6d Pos:(%+.2e,%+.2e,%+.2e)[mm] Deposit:%7.3f MeV CellID:%16lX",
+                 h->truth.trackID,h->truth.pdgID,
+                 pos.x()/mm,pos.y()/mm,pos.z()/mm,
+                 h->truth.deposit/MeV,h->cellID
+                 );
+        delete h;
       }
     }
     return 0;
@@ -114,17 +113,17 @@ namespace {
       Segmentation seg = sd.readout().segmentation();
       VolumeManager vm = lcdd.volumeManager();
       for(_H::const_iterator i=hits->begin(); i!=hits->end(); ++i)  {
-	const Geant4Calorimeter::Hit* h = *i;
-	const Geometry::Position& pos = h->position;
-	Geometry::Position pos_cell = seg.position(h->cellID);
-	PlacedVolume pv = vm.lookupPlacement(h->cellID);
-	printout(ALWAYS,container,
-		 "+++ Pos:(%+.2e,%+.2e,%+.2e)[mm] Pixel:(%+.2e,%+.2e,%+.2e)[mm] %s Deposit:%7.3f MeV CellID:%16lX",
-		 pos.x()/mm,pos.y()/mm,pos.z()/mm,
-		 pos_cell.x()/dd4hep::mm,pos_cell.y()/dd4hep::mm,pos_cell.z()/dd4hep::mm,
-		 pv.name(),h->energyDeposit/MeV,h->cellID
-		 );
-	delete h;
+        const Geant4Calorimeter::Hit* h = *i;
+        const Geometry::Position& pos = h->position;
+        Geometry::Position pos_cell = seg.position(h->cellID);
+        PlacedVolume pv = vm.lookupPlacement(h->cellID);
+        printout(ALWAYS,container,
+                 "+++ Pos:(%+.2e,%+.2e,%+.2e)[mm] Pixel:(%+.2e,%+.2e,%+.2e)[mm] %s Deposit:%7.3f MeV CellID:%16lX",
+                 pos.x()/mm,pos.y()/mm,pos.z()/mm,
+                 pos_cell.x()/dd4hep::mm,pos_cell.y()/dd4hep::mm,pos_cell.z()/dd4hep::mm,
+                 pv.name(),h->energyDeposit/MeV,h->cellID
+                 );
+        delete h;
       }
     }
     return 0;
@@ -140,26 +139,26 @@ namespace {
     }
     else   {
       for(_P::const_iterator i=particles->begin(); i!=particles->end(); ++i)  {
-	DD4hep::Simulation::Geant4ParticleHandle p(*i);
-	char text[256];
-	text[0]=0;
-	if ( p->parents.size() == 1 )
-	  ::snprintf(text,sizeof(text),"/%d",*(p->parents.begin()));
-	else if ( p->parents.size() >  1 )   {
-	  text[0]='/';text[1]=0;
-	  for(set<int>::const_iterator i=p->parents.begin(); i!=p->parents.end(); ++i)
-	    ::snprintf(text+strlen(text),sizeof(text)-strlen(text),"%d ",*i);
-	}
-	printout(ALWAYS,container,
-		 "+++%s %3d stat:%08X PDG:%6d Mom:(%+.2e,%+.2e,%+.2e)[MeV] "
-		 "Vtx:(%+.2e,%+.2e,%+.2e)[mm] #Dau:%3d #Par:%1d%-6s",
-		 "",p->id,p->status,p->pdgID,
-		 p->psx/MeV,p->psy/MeV,p->psz/MeV,
-		 p->vsx/mm,p->vsy/mm,p->vsz/mm,
-		 int(p->daughters.size()),
-		 int(p->parents.size()),
-		 text);
-	delete (*i);
+        DD4hep::Simulation::Geant4ParticleHandle p(*i);
+        char text[256];
+        text[0]=0;
+        if ( p->parents.size() == 1 )
+          ::snprintf(text,sizeof(text),"/%d",*(p->parents.begin()));
+        else if ( p->parents.size() >  1 )   {
+          text[0]='/';text[1]=0;
+          for(set<int>::const_iterator i=p->parents.begin(); i!=p->parents.end(); ++i)
+            ::snprintf(text+strlen(text),sizeof(text)-strlen(text),"%d ",*i);
+        }
+        printout(ALWAYS,container,
+                 "+++%s %3d stat:%08X PDG:%6d Mom:(%+.2e,%+.2e,%+.2e)[MeV] "
+                 "Vtx:(%+.2e,%+.2e,%+.2e)[mm] #Dau:%3d #Par:%1d%-6s",
+                 "",p->id,p->status,p->pdgID,
+                 p->psx/MeV,p->psy/MeV,p->psz/MeV,
+                 p->vsx/mm,p->vsy/mm,p->vsz/mm,
+                 int(p->daughters.size()),
+                 int(p->parents.size()),
+                 text);
+        delete (*i);
       }
     }
     return 0;
@@ -184,25 +183,25 @@ int dumpDDG4(const char* fname, int event_num)  {
       b->SetAddress(&e);
       int nbytes = b->GetEvent(event);
       if ( nbytes > 0 )   {
-	if ( e->empty() )    {
-	  continue;
-	}
-	string br_name = b->GetName();
-	string cl_name = b->GetClassName();
-	if ( cl_name.find("DD4hep::Simulation::Geant4Tracker::Hit") != string::npos )  {
-	  typedef vector<Geant4Tracker::Hit*> _H;
-	  printHits(br_name,(_H*)e);
-	}
-	else if ( cl_name.find("DD4hep::Simulation::Geant4Calorimeter::Hit") != string::npos )  {
-	  typedef vector<Geant4Calorimeter::Hit*> _H;
-	  printHits(br_name,(_H*)e);
-	}
-	else if ( cl_name.find("DD4hep::Simulation::Geant4Particle") != string::npos )  {
-	  typedef vector<Geant4Particle*> _H;
-	  ::printf("%s\n+    Particle Dump of event %8d  [%8d bytes]        +\n%s\n",
-		   line,event,nbytes,line);
-	  printParticles(br_name,(_H*)e);
-	}
+        if ( e->empty() )    {
+          continue;
+        }
+        string br_name = b->GetName();
+        string cl_name = b->GetClassName();
+        if ( cl_name.find("DD4hep::Simulation::Geant4Tracker::Hit") != string::npos )  {
+          typedef vector<Geant4Tracker::Hit*> _H;
+          printHits(br_name,(_H*)e);
+        }
+        else if ( cl_name.find("DD4hep::Simulation::Geant4Calorimeter::Hit") != string::npos )  {
+          typedef vector<Geant4Calorimeter::Hit*> _H;
+          printHits(br_name,(_H*)e);
+        }
+        else if ( cl_name.find("DD4hep::Simulation::Geant4Particle") != string::npos )  {
+          typedef vector<Geant4Particle*> _H;
+          ::printf("%s\n+    Particle Dump of event %8d  [%8d bytes]        +\n%s\n",
+                   line,event,nbytes,line);
+          printParticles(br_name,(_H*)e);
+        }
       }
     }
     if ( event_num >= 0 ) break;
@@ -229,11 +228,11 @@ int main(int argc, char** argv)  {                            // Main program if
   for(int i=1; i<argc;++i) {
     if ( argv[i][0]=='-' ) {
       if ( strncmp(argv[i],"-input",2) == 0 )
-	fname = argv[++i];
+        fname = argv[++i];
       else if ( strncmp(argv[i],"-compact",2) == 0 )
-	dumpddg4_load_geometry(argv[++i]);
+        dumpddg4_load_geometry(argv[++i]);
       else if ( strncmp(argv[i],"-event",2) == 0 )
-	event_num = ::atol(argv[++i]);
+        event_num = ::atol(argv[++i]);
     }
   }
   if ( !fname )  {
diff --git a/DDG4/src/Geant4Action.cpp b/DDG4/src/Geant4Action.cpp
index cc982f47f..9e72d1cf7 100644
--- a/DDG4/src/Geant4Action.cpp
+++ b/DDG4/src/Geant4Action.cpp
@@ -248,7 +248,6 @@ bool Geant4Action::error(bool return_value, const char* fmt, ...) const {
 
 /// Support of fatal messages. Throws exception if required.
 void Geant4Action::fatal(const char* fmt, ...) const {
-  string err;
   va_list args;
   va_start(args, fmt);
   DD4hep::printout(DD4hep::FATAL, m_name, fmt, args);
@@ -257,11 +256,10 @@ void Geant4Action::fatal(const char* fmt, ...) const {
 
 /// Support of exceptions: Print fatal message and throw runtime_error.
 void Geant4Action::except(const char* fmt, ...) const {
-  string err;
   va_list args;
   va_start(args, fmt);
   DD4hep::printout(DD4hep::FATAL, m_name, fmt, args);
-  err = DD4hep::format(m_name, fmt, args);
+  string err = DD4hep::format(m_name, fmt, args);
   va_end(args);
   throw runtime_error(err);
 }
diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp
index 7e6b0cdec..04cf9004d 100644
--- a/DDG4/src/Geant4Converter.cpp
+++ b/DDG4/src/Geant4Converter.cpp
@@ -353,7 +353,9 @@ void* Geant4Converter::handleMaterial(const string& name, Material medium) const
           TGeoElement* e = mix->GetElement(i);
           G4Element* g4e = (G4Element*) handleElement(e->GetName(), Atom(e));
           if (!g4e) {
-            printout(ERROR, "Material", "Missing component %s for material %s.", e->GetName(), mix->GetName());
+            printout(ERROR, "Material", 
+                     "Missing component %s for material %s. A=%f W=%f", 
+                     e->GetName(), mix->GetName(), A_total, W_total);
           }
           //mat->AddElement(g4e, (mix->GetAmixt())[i] / A_total);
           mat->AddElement(g4e, (mix->GetWmixt())[i] / W_total);
@@ -760,9 +762,6 @@ void* Geant4Converter::handlePlacement(const string& name, const TGeoNode* node)
       else if ( node != gGeoManager->GetTopNode() && volIt == info.g4Volumes.end() )  {
         throw logic_error("Geant4Converter: Invalid mother volume found!");
       }
-      else if ( node_is_assembly ) {  // g4mot is NULL !
-        throw logic_error("Geant4Converter: Invalid mother - daughter relationship in assembly! ["+name+"]");
-      }
       G4LogicalVolume* g4vol = info.g4Volumes[vol];
       G4LogicalVolume* g4mot = info.g4Volumes[mot_vol];
       g4 = new G4PVPlacement(transform,   // no rotation
diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp
index c5345b688..82dc8df2b 100644
--- a/DDG4/src/Geant4InputHandling.cpp
+++ b/DDG4/src/Geant4InputHandling.cpp
@@ -410,7 +410,6 @@ int DD4hep::Simulation::generatePrimaries(const Geant4Action* caller,
   Interaction::VertexMap&   vm  = interaction->vertices;
   map<int,G4PrimaryParticle*> prim;
   set<int> visited;
-  char text[64];
 
   if ( interaction->locked )  {
     caller->abortRun("Locked interactions may not be used to generate primaries!",
@@ -438,6 +437,8 @@ int DD4hep::Simulation::generatePrimaries(const Geant4Action* caller,
             Geant4ParticleHandle r = (*j).first;
             G4PrimaryParticle* p4 = (*j).second;
             PropertyMask reason(r->reason);
+            char text[64];
+
             reason.set(G4PARTICLE_PRIMARY);
             v4->SetPrimary(p4);
             ::snprintf(text,sizeof(text),"-> G4Primary[%3d]",num_part);
diff --git a/DDG4/src/IoStreams.cpp b/DDG4/src/IoStreams.cpp
index d963cb1e4..861fe9c56 100644
--- a/DDG4/src/IoStreams.cpp
+++ b/DDG4/src/IoStreams.cpp
@@ -94,7 +94,7 @@ namespace DD4hep {
       throw 1;
     }
   }
-#define _p(x) ((MyTFile*)x)
+#define _p(x) (reinterpret_cast<MyTFile*>(x))
 
   /// Specialization for the usage of TFile structures
   template<> dd4hep_file<TFile*>::dd4hep_file(handle_type fd, dd4hep_file_flags flags)
@@ -108,7 +108,7 @@ namespace DD4hep {
   template<> std::streamsize dd4hep_file<TFile*>::read(char_type* s, std::streamsize n)  {
     if ( m_handle )   {
       Long64_t nb1 = m_handle->GetBytesRead();
-      Bool_t res = _p(m_handle)->ReadBuffer(s,nb1,n);
+      Bool_t   res = _p(m_handle)->ReadBuffer(s,nb1,n);
       if ( res )  {
         Long64_t nb2 = m_handle->GetBytesRead();
         return nb2-nb1;
diff --git a/examples/ClientTests/src/MiniTel.cpp b/examples/ClientTests/src/MiniTel.cpp
index 626769203..b9240a4d9 100644
--- a/examples/ClientTests/src/MiniTel.cpp
+++ b/examples/ClientTests/src/MiniTel.cpp
@@ -19,13 +19,16 @@ namespace  {
     double pixelX, pixelY, pixelZ;
     DetElement detector;
 
-    MyDetExtension(DetElement e) : detector(e) {}
+    MyDetExtension(DetElement e) : idD(0), Ni(0), Nj(0),
+        posDX(0.0), posDY(0.0), posDZ(0.0),
+        dimDX(0.0), dimDY(0.0), dimDZ(0.0),
+        pixelX(0.0), pixelY(0.0), pixelZ(0.0), detector(e) {}
     MyDetExtension(const MyDetExtension& e, DetElement d) 
       : idD(e.idD), Ni(e.Ni), Nj(e.Nj),
-	posDX(e.posDX), posDY(e.posDY), posDZ(e.posDZ),
-	dimDX(e.dimDX), dimDY(e.dimDY), dimDZ(e.dimDZ),
-	pixelX(e.pixelX), pixelY(e.pixelY), pixelZ(e.pixelZ),
-	detector(d)						       
+        posDX(e.posDX), posDY(e.posDY), posDZ(e.posDZ),
+        dimDX(e.dimDX), dimDY(e.dimDY), dimDZ(e.dimDZ),
+        pixelX(e.pixelX), pixelY(e.pixelY), pixelZ(e.pixelZ),
+        detector(d)						       
     {
     }
   };
@@ -35,11 +38,8 @@ typedef MyDetExtension DetectorExtension;
 static Ref_t create_detector(LCDD &lcdd, xml_h e, SensitiveDetector sens)  {
   xml_det_t x_det = e;	//xml-detelemnt of the detector taken as an argument
   string det_name = x_det.nameStr();	//det_name is the name of the xml-detelement
-  string det_type = x_det.typeStr();	//det_type is the type of the xml-detelement
   Assembly assembly (det_name);
   int detectors_id = x_det.id();
-  string visualisation = x_det.visStr();
-
 
   DetElement sdet(det_name,x_det.id());        //sdet is the detelement of the detector!!(actually is a Handle,already a pointer to m_element)
   DetectorExtension* ext = new MyDetExtension(sdet);
@@ -52,35 +52,30 @@ static Ref_t create_detector(LCDD &lcdd, xml_h e, SensitiveDetector sens)  {
 
   double det_y = det_po.y();     // det_y is the y dimension of the xml-detelement
   double det_x = det_po.x();     // det_x is the x dimension of  the xml-detelement
-  double det_z = det_po.z();	 // det_z is the z dimension of the xml-detelement
+  double det_z = det_po.z();     // det_z is the z dimension of the xml-detelement
   ext->posDY = det_y;
   ext->posDX = det_x;
   ext->posDZ = det_z;
 
   xml_coll_t dim(x_det, _U(dimensions));
   xml_comp_t det_dim = dim;
-  double dim_x = det_dim.x();    //det_x is the x dimension of  the xml-detelement
-  double dim_y = det_dim.y();    //det_y is the y dimension of the xml-detelement
-  double dim_z = det_dim.z();    //det_z is the z dimension of the xml-detelement
+  double dim_x = det_dim.x();    // det_x is the x dimension of  the xml-detelement
+  double dim_y = det_dim.y();    // det_y is the y dimension of the xml-detelement
+  double dim_z = det_dim.z();    // det_z is the z dimension of the xml-detelement
 
-  string det_vis = x_det.visStr();
-  //Material air = lcdd.air();	//the material of the air of the lcdd detector
   Material mat = lcdd.material("Silicon");
 
   Volume motherVol = lcdd.pickMotherVolume(sdet); //the mothers volume of our detector
 
-  //int mi_id = 0;	//the id of the first pixel
   PlacedVolume pv;	//struct of Handle giving the volume id(ayto pou 8a kanw volume kai 8a to steilw me setplacement),dld o detector mou
 
   xml_coll_t mi(x_det, _U(module));
-  xml_comp_t dtc_mod = mi;	 //considering the module-pixel of the detector
-  string mi_nam = dtc_mod.nameStr();    //the name of the module
-
-  double pixelX = dtc_mod.x();  //The x dimension of the module
-  double pixelY = dtc_mod.y();  //The y dimension of the module
-  double pixelZ = dtc_mod.z();  //The z dimension of the module
+  xml_comp_t dtc_mod = mi;	    // considering the module-pixel of the detector
+  double pixelX = dtc_mod.x();  // The x dimension of the module
+  double pixelY = dtc_mod.y();  // The y dimension of the module
+  double pixelZ = dtc_mod.z();  // The z dimension of the module
 
-  int Ni = dim_x/pixelX;         //how many pixels in the x dimension
+  int Ni = dim_x/pixelX;         // how many pixels in the x dimension
   int Nj = dim_y/pixelY;
 
   ext->dimDX = dim_x;
-- 
GitLab