Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up errors reported by static analyzer #1222

Merged
merged 2 commits into from Oct 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Geometry/DTGeometry/interface/DTGeometry.h
Expand Up @@ -117,9 +117,9 @@ class DTGeometry : public TrackingGeometry {

// Replace local static with mutable members
// to allow lazy evaluation if (ever) needed.
mutable DetTypeContainer theDetTypes;
mutable DetIdContainer theDetUnitIds;
mutable DetIdContainer theDetIds;
DetTypeContainer theDetTypes;
DetIdContainer theDetUnitIds;
DetIdContainer theDetIds;
};

#endif
3 changes: 0 additions & 3 deletions Geometry/DTGeometry/interface/DTLayerType.h
Expand Up @@ -21,9 +21,6 @@ class DTLayerType : public GeomDetType {

/* Operations */
virtual const Topology& topology() const;

private:

};
#endif // DTLAYERTYPE_H

2 changes: 1 addition & 1 deletion Geometry/DTGeometry/src/DTLayerType.cc
Expand Up @@ -18,7 +18,7 @@ DTLayerType::DTLayerType() :

/* Operations */
const Topology& DTLayerType::topology() const {
static DTTopology result(0,0,0.);
static const DTTopology result(0,0,0.);
return result;
}

Expand Down
61 changes: 34 additions & 27 deletions Geometry/DTGeometry/test/DTGeometryAnalyzer.cc
Expand Up @@ -14,7 +14,6 @@

#include <Geometry/DTGeometry/interface/DTGeometry.h>
#include <Geometry/Records/interface/MuonGeometryRecord.h>
//#include <Geometry/DTGeometry/interface/DTLayer.h>

#include <iostream>
#include <string>
Expand Down Expand Up @@ -144,32 +143,40 @@ void DTGeometryAnalyzer::analyze( const edm::Event& iEvent,

DTChamberId id(w,st,se);
const DTChamber* ch = pDD->chamber(id);
if (!ch) cout << "ERROR ch not found " << id << endl;
if (id!=ch->id()) cout << "ERROR: got wrong chamber: Cerco camera " << id << " e trovo " << ch->id() << endl;
// test idToDet for chamber
const GeomDet* gdetc=pDD->idToDet(id);
assert(gdetc==ch);

for (int sl=1; sl<= 3 ; ++sl) {
if (sl==2 && st==4) continue;
DTSuperLayerId slid(id,sl);
const DTSuperLayer* dtsl = pDD->superLayer(slid);
if (!dtsl) cout << "ERROR sl not found " << slid << endl;
if (slid!=dtsl->id()) cout << "ERROR: got wrong sl! Cerco sl " << slid << " e trovo " << dtsl->id() << endl;
// test idToDet for superLayer
const GeomDet* gdets=pDD->idToDet(slid);
assert(gdets==dtsl);

for (int l=1; l<=4; ++l) {
DTLayerId lid(slid,l);
const DTLayer* lay = pDD->layer(lid);
if (!lay) cout << "ERROR lay not found " << lid << endl;
if (lid!=lay->id()) cout << "ERROR: got wrong layer Cerco lay " << lid << " e trovo " << lay->id() << endl;
// test idToDet for layer
const GeomDet* gdetl=pDD->idToDet(lid);
assert(gdetl==lay);
}
}
if (!ch)
cout << "ERROR ch not found " << id << endl;
else
{
if (id!=ch->id()) cout << "ERROR: got wrong chamber: Cerco camera " << id << " e trovo " << ch->id() << endl;
// test idToDet for chamber
const GeomDet* gdetc=pDD->idToDet(id);
assert(gdetc==ch);

for (int sl=1; sl<= 3 ; ++sl) {
if (sl==2 && st==4) continue;
DTSuperLayerId slid(id,sl);
const DTSuperLayer* dtsl = pDD->superLayer(slid);
if (!dtsl)
cout << "ERROR sl not found " << slid << endl;
else
{
if (slid!=dtsl->id()) cout << "ERROR: got wrong sl! Cerco sl " << slid << " e trovo " << dtsl->id() << endl;
// test idToDet for superLayer
const GeomDet* gdets=pDD->idToDet(slid);
assert(gdets==dtsl);

for (int l=1; l<=4; ++l) {
DTLayerId lid(slid,l);
const DTLayer* lay = pDD->layer(lid);
if (!lay) cout << "ERROR lay not found " << lid << endl;
if (lid!=lay->id()) cout << "ERROR: got wrong layer Cerco lay " << lid << " e trovo " << lay->id() << endl;
// test idToDet for layer
const GeomDet* gdetl=pDD->idToDet(lid);
assert(gdetl==lay);
}
}
}
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Geometry/DTGeometry/test/testDTGeometryFromDB_cfg.py
Expand Up @@ -4,7 +4,9 @@
process.load("Configuration.StandardSequences.GeometryDB_cff")
process.load("CondCore.DBCommon.CondDBSetup_cfi")
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.GlobalTag.globaltag = 'MC_31X_V8::All'
from Configuration.AlCa.autoCond import autoCond
process.GlobalTag.globaltag = autoCond['mc']

process.source = cms.Source("EmptySource")

process.maxEvents = cms.untracked.PSet(
Expand Down
4 changes: 3 additions & 1 deletion Geometry/DTGeometry/test/testDTGeometryFromLocalDB_cfg.py
Expand Up @@ -4,7 +4,9 @@
process.load("Configuration.StandardSequences.GeometryDB_cff")
process.load("CondCore.DBCommon.CondDBSetup_cfi")
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.GlobalTag.globaltag = 'MC_31X_V8::All'
from Configuration.AlCa.autoCond import autoCond
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general you should use two different pull requests for logically orthogonal changes.

process.GlobalTag.globaltag = autoCond['mc']

process.source = cms.Source("EmptySource")

process.maxEvents = cms.untracked.PSet(
Expand Down
3 changes: 2 additions & 1 deletion Geometry/DTGeometry/test/testDTGeometry_cfg.py
Expand Up @@ -5,8 +5,9 @@
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.load('Geometry.CommonDetUnit.globalTrackingGeometry_cfi')
process.load('Geometry.MuonNumbering.muonNumberingInitialization_cfi')
from Configuration.AlCa.autoCond import autoCond
process.GlobalTag.globaltag = autoCond['mc']

process.GlobalTag.globaltag = 'MC_31X_V8::All'
process.load("Alignment.CommonAlignmentProducer.FakeAlignmentSource_cfi")
process.preferFakeAlign = cms.ESPrefer("FakeAlignmentSource")

Expand Down
2 changes: 2 additions & 0 deletions Geometry/DTGeometryBuilder/src/DTGeometryBuilderFromCondDB.cc
Expand Up @@ -116,6 +116,7 @@ DTGeometryBuilderFromCondDB::buildSuperLayer(DTChamber* chamber,
DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);

// cout << "adding slayer " << slayer->id() << " to chamber "<< chamber->id() << endl;
assert(chamber);
chamber->add(slayer);
return slayer;
}
Expand Down Expand Up @@ -147,6 +148,7 @@ DTGeometryBuilderFromCondDB::buildLayer(DTSuperLayer* sl,
DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
// cout << "adding layer " << layer->id() << " to sl "<< sl->id() << endl;

assert(sl);
sl->add(layer);
return layer;
}
Expand Down