diff --git a/DDCond/src/ConditionTest.cpp b/DDCond/src/ConditionTest.cpp index 903d243c55fb36c121ef79cb9e221d3a4ad56879..a9bf27c5c4b7362d4ed60bf41e4efd1714b5cade 100644 --- a/DDCond/src/ConditionTest.cpp +++ b/DDCond/src/ConditionTest.cpp @@ -90,6 +90,8 @@ DECLARE_APPLY(ConditionsTest1,conditions_test) namespace { struct Callee { + int m_param; + Callee() : m_param(0) {} void call(unsigned long tags, DetElement& det, void* param) { if ( DetElement::CONDITIONS_CHANGED == (tags&DetElement::CONDITIONS_CHANGED) ) printout(INFO,"Callee","+++ Conditions update %s param:%p",det.path().c_str(),param); diff --git a/DDCore/src/Evaluator/Evaluator.cpp b/DDCore/src/Evaluator/Evaluator.cpp index 14cd8b46d81158f0b36c3d3220835db04d3511eb..ab833a5de1bd564adab33d019a268f9c0bbc6a76 100644 --- a/DDCore/src/Evaluator/Evaluator.cpp +++ b/DDCore/src/Evaluator/Evaluator.cpp @@ -21,10 +21,10 @@ struct Item { string expression; void *function; - Item() : what(UNKNOWN), variable(0),expression(), function(0) {} - Item(double x) : what(VARIABLE), variable(x),expression(), function(0) {} - Item(string x) : what(EXPRESSION),variable(0),expression(x),function(0) {} - Item(void *x) : what(FUNCTION), variable(0),expression(), function(x) {} + explicit Item() : what(UNKNOWN), variable(0),expression(), function(0) {} + explicit Item(double x) : what(VARIABLE), variable(x),expression(), function(0) {} + explicit Item(string x) : what(EXPRESSION),variable(0),expression(x),function(0) {} + explicit Item(void *x) : what(FUNCTION), variable(0),expression(), function(x) {} }; typedef char * pchar; diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/LCDDImp.cpp index 080043b165200489dc94b47f5d81dd273e462600..016d0a6841b6412cc36b2b827db34dfc960c6573 100644 --- a/DDCore/src/LCDDImp.cpp +++ b/DDCore/src/LCDDImp.cpp @@ -86,11 +86,17 @@ namespace { } /// Disable copy constructor -LCDDImp::LCDDImp(const LCDDImp&) : LCDD(), LCDDData(), LCDDLoad(this), m_buildType(BUILD_NONE) { +LCDDImp::LCDDImp(const LCDDImp& copy) : LCDD(copy), LCDDData(copy), LCDDLoad(this), + m_detectorTypes(copy.m_detectorTypes), + m_buildType(copy.m_buildType) +{ } /// Disable assignment operator -LCDDImp& LCDDImp::operator=(const LCDDImp&) { +LCDDImp& LCDDImp::operator=(const LCDDImp& c) { + // Useless, but keep code checker happy.... + m_detectorTypes = c.m_detectorTypes; + m_buildType = c.m_buildType; return *this; } diff --git a/DDCore/src/LCDDImp.h b/DDCore/src/LCDDImp.h index 5dd269977ca1d59dc170c54bc2889d0704d0e96d..e3af755d1c7f85d22a2580caaa12762885afa528 100644 --- a/DDCore/src/LCDDImp.h +++ b/DDCore/src/LCDDImp.h @@ -41,14 +41,19 @@ namespace DD4hep { protected: /// Cached map with detector types: typedef std::map<std::string, std::vector<DetElement> > DetectorTypeMap; + + /// Inventory of detector types DetectorTypeMap m_detectorTypes; + /// VolumeManager m_volManager; + LCDDBuildType m_buildType; + private: /// Disable copy constructor - LCDDImp(const LCDDImp&); + LCDDImp(const LCDDImp& copy); /// Disable assignment operator - LCDDImp& operator=(const LCDDImp&); + LCDDImp& operator=(const LCDDImp& copy); /// Internal helper to map detector types once the geometry is closed void mapDetectorTypes(); @@ -57,9 +62,6 @@ namespace DD4hep { /// Local method (no interface): Load volume manager. void imp_loadVolumeManager(); - /// VolumeManager m_volManager; - LCDDBuildType m_buildType; - /// Default constructor LCDDImp(); diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index 5601fff6022dbd137e7e9b1606aa581bea5f2f09..446f44eb8ac61c6c99855376aa2eb593b7a4ba49 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -153,7 +153,7 @@ namespace { } /// Compute the encoding for a set of VolIDs within a readout descriptor - pair<VolumeID, VolumeID> encoding(const IDDescriptor iddesc, const VolIDs& ids) const { + static pair<VolumeID, VolumeID> encoding(const IDDescriptor iddesc, const VolIDs& ids) const { VolumeID volume_id = 0, mask = 0; for (VolIDs::const_iterator i = ids.begin(); i != ids.end(); ++i) { const PlacedVolume::VolID& id = (*i); @@ -202,7 +202,7 @@ namespace { } void print_node(SensitiveDetector sd, DetElement parent, DetElement e, - const TGeoNode* n, const VolIDs& ids, const Chain& /* nodes */) + const TGeoNode* n, const VolIDs& ids, const Chain& /* nodes */) const { static int s_count = 0; Readout ro = sd.readout(); diff --git a/DDEve/src/EventControl.cpp b/DDEve/src/EventControl.cpp index 950df9b078f3bad2172bee244839eb8bddc96ddf..0cbd788713576238d33681f8f4440b0f87e1b04a 100644 --- a/DDEve/src/EventControl.cpp +++ b/DDEve/src/EventControl.cpp @@ -90,7 +90,8 @@ bool EventControl::Open() { /// EventConsumer overload: New event data file void EventControl::OnFileOpen(EventHandler* handler) { char text[1024], fname[1024]; - ::strncpy(fname, handler->datasourceName().c_str(), sizeof(fname)); + ::strncpy(fname, handler->datasourceName().c_str(), sizeof(fname)-1); + fname[sizeof(fname)-1] = 0; // ----------------------------------------------------------------------------------------- if ( handler && handler->hasFile() ) { ::snprintf(text,sizeof(text),"Number of events: %ld",handler->numEvents()); diff --git a/DDG4/lcio/LCIOSDTestActions.cpp b/DDG4/lcio/LCIOSDTestActions.cpp index 0377f7b94f565cf6b1d2a04c2f45bf18c2a8bcc8..1603f814b842205ce55331e563ee56677ea49cd3 100644 --- a/DDG4/lcio/LCIOSDTestActions.cpp +++ b/DDG4/lcio/LCIOSDTestActions.cpp @@ -140,7 +140,7 @@ namespace Tests { // hit->momentum = direction; // hit->length = hit_len; collection(m_collectionID)->add(hit); - return hit != 0; + return true; } typedef Geant4SensitiveAction<LcioTestTracker> LcioTestTrackerAction; diff --git a/DDG4/plugins/Geant4EventReaderHepEvt.cpp b/DDG4/plugins/Geant4EventReaderHepEvt.cpp index 2369ca88b9c08a2cb67ba47f2a1d6daf2d904577..f8fc997375abcb2287bcecd010e33bad75f52c25 100644 --- a/DDG4/plugins/Geant4EventReaderHepEvt.cpp +++ b/DDG4/plugins/Geant4EventReaderHepEvt.cpp @@ -42,7 +42,7 @@ namespace DD4hep { public: /// Initializing constructor - Geant4EventReaderHepEvt(const std::string& nam, int format); + explicit Geant4EventReaderHepEvt(const std::string& nam, int format); /// Default destructor virtual ~Geant4EventReaderHepEvt(); /// Read an event and fill a vector of MCParticles. @@ -81,14 +81,14 @@ namespace { class Geant4EventReaderHepEvtShort : public Geant4EventReaderHepEvt { public: /// Initializing constructor - Geant4EventReaderHepEvtShort(const string& nam) : Geant4EventReaderHepEvt(nam,HEPEvtShort) {} + explicit Geant4EventReaderHepEvtShort(const string& nam) : Geant4EventReaderHepEvt(nam,HEPEvtShort) {} /// Default destructor virtual ~Geant4EventReaderHepEvtShort() {} }; class Geant4EventReaderHepEvtLong : public Geant4EventReaderHepEvt { public: /// Initializing constructor - Geant4EventReaderHepEvtLong(const string& nam) : Geant4EventReaderHepEvt(nam,HEPEvtLong) {} + explicit Geant4EventReaderHepEvtLong(const string& nam) : Geant4EventReaderHepEvt(nam,HEPEvtLong) {} /// Default destructor virtual ~Geant4EventReaderHepEvtLong() {} }; diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index 306158256f048c37ceacfee31fdd6636dc663cdb..d032b2d8abbd3be43f657dae004d232ff9201a00 100644 --- a/DDG4/plugins/Geant4EventReaderHepMC.cpp +++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp @@ -46,7 +46,7 @@ namespace DD4hep { EventStream* m_events; public: /// Initializing constructor - Geant4EventReaderHepMC(const std::string& nam); + explicit Geant4EventReaderHepMC(const std::string& nam); /// Default destructor virtual ~Geant4EventReaderHepMC(); /// Read an event and fill a vector of MCParticles. diff --git a/DDG4/python/DDG4Dict.C b/DDG4/python/DDG4Dict.C index 2378a28ed174a34c776e900347492960dfa2f393..150a19a731c4b08a44144647c9d0be6bcc2ce4dc 100644 --- a/DDG4/python/DDG4Dict.C +++ b/DDG4/python/DDG4Dict.C @@ -29,16 +29,16 @@ namespace DD4hep { using std::string; -#define ACTIONHANDLE(x) \ - struct x##Handle { \ - Geant4##x* action; \ - x##Handle(Geant4##x* a) : action(a) { if ( action ) action->addRef();} \ +#define ACTIONHANDLE(x) \ + struct x##Handle { \ + Geant4##x* action; \ + explicit x##Handle(Geant4##x* a) : action(a) { if ( action ) action->addRef();} \ x##Handle(const x##Handle& h) : action(h.action) { if ( action ) action->addRef();} \ ~x##Handle() { if ( action) action->release(); } \ Geant4##x* release() { Geant4##x* tmp = action; action=0; return tmp; } \ - operator DD4hep::Simulation::Geant4##x* () const { return action; } \ - Geant4##x* operator->() const { return action; } \ - Geant4##x* get() const { return action; } \ + operator DD4hep::Simulation::Geant4##x* () const { return action; } \ + Geant4##x* operator->() const { return action; } \ + Geant4##x* get() const { return action; } \ } ACTIONHANDLE(Filter);