Skip to content

Commit 4009961

Browse files
committed
Test fix of 1.7 ETL topology, add further debugging info in MTDDetSector and tracking geometry classes, update printout in ETL geometry to allow comparisons
Protection in MTDDetSector against memory leaks due to incorrect navigation
1 parent 7a8aff4 commit 4009961

File tree

9 files changed

+51
-25
lines changed

9 files changed

+51
-25
lines changed

Configuration/Geometry/python/defaultPhase2ConditionsEra_cff.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from Configuration.AlCa.autoCond import autoCond
33
from Configuration.StandardSequences.Eras import eras
44

5-
DEFAULT_VERSION = "Run4D110"
5+
# DEFAULT_VERSION = "Run4D110"
6+
DEFAULT_VERSION = "Run4D119"
67

78
def get_era_and_conditions(version_key):
89
"""Retrieve the era and global tag for a given version key.

DataFormats/GeometrySurface/src/RectangularPlaneBounds.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#define EDM_ML_DEBUG
2+
#include "FWCore/MessageLogger/interface/MessageLogger.h"
3+
14
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
25
#include "DataFormats/GeometrySurface/interface/LocalError.h"
36
#include <cmath>
@@ -8,13 +11,19 @@ RectangularPlaneBounds::RectangularPlaneBounds(float w, float h, float t)
811
RectangularPlaneBounds::~RectangularPlaneBounds() {}
912

1013
bool RectangularPlaneBounds::inside(const Local3DPoint& p, const LocalError& err, float scale) const {
14+
LogDebug("RectangularPlaneBounds") << "pos " << p << " errors x/y " << std::sqrt(err.xx()) << " "
15+
<< std::sqrt(err.yy()) << " scale " << scale << " halfT/W/L " << halfThickness
16+
<< " " << halfWidth << " " << halfLength << " inside(p) " << inside(p);
1117
if ((scale >= 0) && inside(p))
1218
return true;
1319
return std::abs(p.z()) < halfThickness && (std::abs(p.x()) < halfWidth + std::sqrt(err.xx()) * scale) &&
1420
(std::abs(p.y()) < halfLength + std::sqrt(err.yy()) * scale);
1521
}
1622

1723
bool RectangularPlaneBounds::inside(const Local2DPoint& p, const LocalError& err, float scale) const {
24+
LogDebug("RectangularPlaneBounds") << "pos " << p << " errors x/y " << std::sqrt(err.xx()) << " "
25+
<< std::sqrt(err.yy()) << " scale " << scale << " halfT/W/L " << halfThickness
26+
<< " " << halfWidth << " " << halfLength << " inside(p) " << inside(p);
1827
if ((scale >= 0) && inside(p))
1928
return true;
2029
return (std::abs(p.x()) < halfWidth + std::sqrt(err.xx()) * scale) &&

Geometry/MTDCommonData/data/etl/v10/etl.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@
146146
477, 511, 549, 585, 625, 669, 709, 747, 781, 811, 835, 849
147147
</Vector>
148148

149-
<Vector name="StartCopyNo_Back_Disc_2" type="numeric" nEntries="27">
149+
<Vector name="StartCopyNo_Back_Disc_2" type="numeric" nEntries="19">
150150
1, 7, 21, 41, 65, 89, 109, 129, 149, 167, 185, 205, 225, 245, 269,
151-
293, 313, 327, 333, 333, 333, 333, 333, 333, 333, 333, 333
151+
293, 313, 327, 333
152152
</Vector>
153153

154154
<Vector name="Offset_Front_Disc_1" type="numeric" nEntries="27">
@@ -163,8 +163,8 @@
163163
4, 4, 0, 0, 0, 0, 0, 0, 2, 4, 8, 12, 14, 16, 14, 12, 8, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0
164164
</Vector>
165165

166-
<Vector name="Offset_Back_Disc_2" type="numeric" nEntries="27">
167-
0, 0, 0, 0, 4, 8, 12, 12, 16, 16, 12, 12, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0 ,0, 0 ,0
166+
<Vector name="Offset_Back_Disc_2" type="numeric" nEntries="19">
167+
0, 0, 0, 0, 4, 8, 12, 12, 16, 16, 12, 12, 8, 4, 0, 0, 0, 0, 0
168168
</Vector>
169169

170170

Geometry/MTDGeometryBuilder/plugins/MTDTopologyEP.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//#define EDM_ML_DEBUG
1+
#define EDM_ML_DEBUG
22

33
#include "FWCore/MessageLogger/interface/MessageLogger.h"
44
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
@@ -92,8 +92,14 @@ void MTDTopologyEP::fillETLtopology(const PMTDParameters& ptp, int& mtdTopologyM
9292
// Check on the internal consistency of thr ETL layout information provided by parameters
9393

9494
for (size_t it = 3; it <= 9; it++) {
95+
bool exception = ((MTDTopologyMode::etlLayoutFromTopoMode(mtdTopologyMode) == MTDTopologyMode::EtlLayout::v10) &&
96+
(it == 5 || it == 9));
9597
if (ptp.vitems_[it].vpars_.size() != ptp.vitems_[2].vpars_.size()) {
96-
throw cms::Exception("MTDTopologyEP") << "Inconsistent size of ETL structure arrays";
98+
if (!exception) {
99+
throw cms::Exception("MTDTopologyEP") << "Inconsistent size of ETL structure arrays";
100+
} else {
101+
LogDebug("MTDTopologyEP") << "Building ETL topology for scenario 1.7";
102+
}
97103
}
98104
}
99105

RecoMTD/DetLayers/src/MTDDetSector.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//#define EDM_ML_DEBUG
1+
#define EDM_ML_DEBUG
22

33
#include "RecoMTD/DetLayers/interface/MTDDetSector.h"
44
#include "DataFormats/ForwardDetId/interface/ETLDetId.h"
@@ -87,9 +87,12 @@ vector<GeometricSearchDet::DetWithState> MTDDetSector::compatibleDets(const Traj
8787

8888
TrajectoryStateOnSurface& tsos = compat.second;
8989
GlobalPoint startPos = tsos.globalPosition();
90+
LocalTrajectoryError startLocalErr = tsos.localError();
9091

9192
LogTrace("MTDDetLayers") << "Starting position: " << startPos << " starting p/pT: " << tsos.globalMomentum().mag()
92-
<< " / " << tsos.globalMomentum().perp();
93+
<< " / " << tsos.globalMomentum().perp() << " local error x/y "
94+
<< std::sqrt(startLocalErr.positionError().xx()) << " "
95+
<< std::sqrt(startLocalErr.positionError().yy());
9396

9497
// determine distance of det center from extrapolation on the surface, sort dets accordingly
9598

@@ -171,11 +174,15 @@ bool MTDDetSector::add(size_t idet,
171174

172175
if (compat.first) {
173176
result.push_back(DetWithState(theDets[idet], compat.second));
174-
LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det idetMin " << idet
177+
LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det idetMin " << idet + 1
175178
<< " detId = " << theDets[idet]->geographicalId().rawId() << " at "
176179
<< theDets[idet]->position()
177180
<< " dist = " << std::sqrt((tsos.globalPosition() - theDets[idet]->position()).mag2());
178181
}
182+
if (result.size() > basicComponents().size()) {
183+
throw cms::Exception("MTDDetLayersFailure")
184+
<< "ETL compatibleDets in sector in excess of collection size: " << basicComponents().size();
185+
}
179186

180187
return compat.first;
181188
}

RecoMTD/DetLayers/src/MTDSectorForwardDoubleLayer.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//#define EDM_ML_DEBUG
1+
#define EDM_ML_DEBUG
22

33
#include <RecoMTD/DetLayers/interface/MTDSectorForwardDoubleLayer.h>
44
#include <RecoMTD/DetLayers/interface/MTDDetSector.h>
@@ -140,7 +140,8 @@ vector<DetGroup> MTDSectorForwardDoubleLayer::groupedCompatibleDets(const Trajec
140140
result.push_back(DetGroup(detWithStates1));
141141
if (!detWithStates2.empty())
142142
result.push_back(DetGroup(detWithStates2));
143-
LogTrace("MTDDetLayers") << "DoubleLayer Compatible dets: " << result.size();
143+
LogTrace("MTDDetLayers") << "DoubleLayer Compatible dets: " << result.size() << " front: " << detWithStates1.size()
144+
<< " back: " << detWithStates2.size();
144145
return result;
145146
}
146147

RecoMTD/DetLayers/src/MTDSectorForwardLayer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//#define EDM_ML_DEBUG
1+
#define EDM_ML_DEBUG
22

33
#include <RecoMTD/DetLayers/interface/MTDSectorForwardLayer.h>
44
#include <RecoMTD/DetLayers/interface/MTDDetSector.h>

RecoMTD/DetLayers/test/TestETLNavigation.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ void TestETLNavigation::analyze(edm::StreamID, edm::Event const&, edm::EventSetu
108108
} else {
109109
ETLDetId newId(isector->basicComponents()[idetNew]->geographicalId().rawId());
110110
LogVerbatim("MTDLayerDumpFull")
111-
<< std::fixed << "...............hshift= " << std::setw(2) << iside << " side = " << std::setw(4)
112-
<< newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " << std::setw(4)
113-
<< newId.discSide() << " " << std::setw(4) << newId.sector() << " mod/type = " << std::setw(4)
114-
<< newId.module() << " " << std::setw(4) << newId.modType()
111+
<< std::fixed << "...............hshift= " << std::setw(2) << iside << " ETLDetId " << newId.rawId()
112+
<< " side = " << std::setw(4) << newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4)
113+
<< newId.nDisc() << " " << std::setw(4) << newId.discSide() << " " << std::setw(4) << newId.sector()
114+
<< " mod/type = " << std::setw(4) << newId.module() << " " << std::setw(4) << newId.modType()
115115
<< " pos = " << fvecround(isector->basicComponents()[idetNew]->position(), 4);
116116
LogVerbatim("MTDLayerDump") << std::fixed << "...............hshift= " << std::setw(2) << iside
117117
<< " side = " << std::setw(4) << newId.mtdSide()
@@ -133,10 +133,10 @@ void TestETLNavigation::analyze(edm::StreamID, edm::Event const&, edm::EventSetu
133133
if (closest < isector->basicComponents().size()) {
134134
ETLDetId newId(isector->basicComponents()[closest]->geographicalId().rawId());
135135
LogVerbatim("MTDLayerDumpFull")
136-
<< std::fixed << ".......closest.vshift= " << std::setw(2) << iside << " side = " << std::setw(4)
137-
<< newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " << std::setw(4)
138-
<< newId.discSide() << " " << std::setw(4) << newId.sector() << " mod/type = " << std::setw(4)
139-
<< newId.module() << " " << std::setw(4) << newId.modType()
136+
<< std::fixed << ".......closest.vshift= " << std::setw(2) << iside << " ETLDetId " << newId.rawId()
137+
<< " side = " << std::setw(4) << newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4)
138+
<< newId.nDisc() << " " << std::setw(4) << newId.discSide() << " " << std::setw(4) << newId.sector()
139+
<< " mod/type = " << std::setw(4) << newId.module() << " " << std::setw(4) << newId.modType()
140140
<< " pos = " << fvecround(isector->basicComponents()[closest]->position(), 4);
141141
LogVerbatim("MTDLayerDump")
142142
<< std::fixed << ".......closest.vshift= " << std::setw(2) << iside << " side = " << std::setw(4)
@@ -148,10 +148,10 @@ void TestETLNavigation::analyze(edm::StreamID, edm::Event const&, edm::EventSetu
148148
} else {
149149
ETLDetId newId(isector->basicComponents()[idetNew]->geographicalId().rawId());
150150
LogVerbatim("MTDLayerDumpFull")
151-
<< std::fixed << "...............vshift= " << std::setw(2) << iside << " side = " << std::setw(4)
152-
<< newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " << std::setw(4)
153-
<< newId.discSide() << " " << std::setw(4) << newId.sector() << " mod/type = " << std::setw(4)
154-
<< newId.module() << " " << std::setw(4) << newId.modType()
151+
<< std::fixed << "...............vshift= " << std::setw(2) << iside << " ETLDetId " << newId.rawId()
152+
<< " side = " << std::setw(4) << newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4)
153+
<< newId.nDisc() << " " << std::setw(4) << newId.discSide() << " " << std::setw(4) << newId.sector()
154+
<< " mod/type = " << std::setw(4) << newId.module() << " " << std::setw(4) << newId.modType()
155155
<< " pos = " << fvecround(isector->basicComponents()[idetNew]->position(), 4);
156156
LogVerbatim("MTDLayerDump") << std::fixed << "...............vshift= " << std::setw(2) << iside
157157
<< " side = " << std::setw(4) << newId.mtdSide()

RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define EDM_ML_DEBUG
2+
13
#include <sstream>
24

35
#include <CLHEP/Units/GlobalPhysicalConstants.h>

0 commit comments

Comments
 (0)