Skip to content

Commit

Permalink
Merge pull request #33181 from fabiocos/fc-detlayers
Browse files Browse the repository at this point in the history
MTD geometry/reconstruction: update tests, invert order of forward DetLayers
  • Loading branch information
cmsbuild authored Mar 19, 2021
2 parents c2e5c91 + bc4619b commit b27fcd0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
24 changes: 17 additions & 7 deletions Geometry/MTDGeometryBuilder/test/MTDDigiGeometryAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
#include "Geometry/CommonTopologies/interface/PixelTopology.h"
#include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetType.h"
#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h"
#include "Geometry/Records/interface/MTDTopologyRcd.h"
#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h"

#include "DataFormats/ForwardDetId/interface/MTDDetId.h"
#include "DataFormats/ForwardDetId/interface/BTLDetId.h"
#include "DataFormats/ForwardDetId/interface/ETLDetId.h"
#include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetUnit.h"
#include "DataFormats/GeometrySurface/interface/MediumProperties.h"
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
Expand Down Expand Up @@ -47,9 +48,6 @@ using cms_rounding::roundIfNear0, cms_rounding::roundVecIfNear0;

// ------------ method called to produce the data ------------
void MTDDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
edm::ESHandle<MTDTopology> mtdTopo;
iSetup.get<MTDTopologyRcd>().get(mtdTopo);

//
// get the MTDGeometry
//
Expand All @@ -67,10 +65,22 @@ void MTDDigiGeometryAnalyzer::analyze(const edm::Event& iEvent, const edm::Event
for (auto const& it : pDD->detUnits()) {
if (dynamic_cast<const MTDGeomDetUnit*>((it)) != nullptr) {
const BoundPlane& p = (dynamic_cast<const MTDGeomDetUnit*>((it)))->specificSurface();
const MTDDetId mtdId(it->geographicalId());
std::stringstream moduleLabel;
if (mtdId.mtdSubDetector() == 1) {
moduleLabel << " BTL side " << mtdId.mtdSide() << " Rod " << mtdId.mtdRR() << " mod "
<< (static_cast<const BTLDetId>(mtdId)).module();
} else if (mtdId.mtdSubDetector() == 2) {
const ETLDetId etlId(it->geographicalId());
moduleLabel << " ETL side " << mtdId.mtdSide() << " Disc/Side/Sector " << etlId.nDisc() << " "
<< etlId.discSide() << " " << etlId.sector();
} else {
edm::LogWarning("MTDDigiGeometryanalyzer") << (it->geographicalId()).rawId() << " unknown MTD subdetector!";
}
edm::LogVerbatim("MTDDigiGeometryAnalyzer")
<< "---------------------------------------------------------- \n"
<< mtdTopo->print(it->geographicalId()) << " RadLeng Pixel " << p.mediumProperties().radLen() << " Xi Pixel "
<< p.mediumProperties().xi();
<< it->geographicalId().rawId() << moduleLabel.str() << " RadLeng Pixel " << p.mediumProperties().radLen()
<< " Xi Pixel " << p.mediumProperties().xi();

const GeomDetUnit theDet = *(dynamic_cast<const MTDGeomDetUnit*>(it));
analyseRectangle(theDet);
Expand Down
5 changes: 4 additions & 1 deletion RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ pair<vector<DetLayer*>, vector<DetLayer*> > ETLDetLayerGeometryBuilder::buildLay
}
}
}
pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[0], result[1]);
//
// the first entry is Z+ ( MTD side 1), the second is Z- (MTD side 0)
//
pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[1], result[0]);
return res_pair;
}

Expand Down
29 changes: 29 additions & 0 deletions RecoMTD/DetLayers/test/MTDRecoGeometryAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ void MTDRecoGeometryAnalyzer::analyze(const Event& ev, const EventSetup& es) {
LogVerbatim("MTDLayerDump") << " " << static_cast<int>(dl - geo->allETLLayers().begin()) << " " << dumpLayer(*dl);
}

LogVerbatim("MTDLayerDump") << "\n*** allForwardLayers(): " << std::fixed << std::setw(14)
<< geo->allForwardLayers().size();
for (auto dl = geo->allForwardLayers().begin(); dl != geo->allForwardLayers().end(); ++dl) {
LogVerbatim("MTDLayerDump") << " " << static_cast<int>(dl - geo->allForwardLayers().begin()) << " "
<< dumpLayer(*dl);
}

LogVerbatim("MTDLayerDump") << "\n*** allBackwardLayers(): " << std::fixed << std::setw(14)
<< geo->allBackwardLayers().size();
for (auto dl = geo->allBackwardLayers().begin(); dl != geo->allBackwardLayers().end(); ++dl) {
LogVerbatim("MTDLayerDump") << " " << static_cast<int>(dl - geo->allBackwardLayers().begin()) << " "
<< dumpLayer(*dl);
}

LogVerbatim("MTDLayerDump") << "\n*** allLayers(): " << std::fixed << std::setw(14) << geo->allLayers().size();
for (auto dl = geo->allLayers().begin(); dl != geo->allLayers().end(); ++dl) {
LogVerbatim("MTDLayerDump") << " " << static_cast<int>(dl - geo->allLayers().begin()) << " " << dumpLayer(*dl);
Expand All @@ -109,6 +123,21 @@ void MTDRecoGeometryAnalyzer::testBTLLayers(const MTDDetLayerGeometry* geo, cons
<< " rods = " << std::setw(14) << layer->rods().size() << " dets = " << std::setw(14)
<< layer->basicComponents().size();

unsigned int irodInd(0);
for (const auto& irod : layer->rods()) {
irodInd++;
LogVerbatim("MTDLayerDump") << std::fixed << "\nRod " << irodInd << " dets = " << irod->basicComponents().size()
<< "\n";
for (const auto& imod : irod->basicComponents()) {
BTLDetId modId(imod->geographicalId().rawId());
LogVerbatim("MTDLayerDump") << std::fixed << "BTLDetId " << modId.rawId() << " side = " << std::setw(4)
<< modId.mtdSide() << " rod = " << modId.mtdRR() << " mod = " << std::setw(4)
<< modId.module() << std::setw(14) << " R = " << imod->position().perp()
<< std::setw(14) << " phi = " << imod->position().phi() << std::setw(14)
<< " Z = " << imod->position().z();
}
}

const BoundCylinder& cyl = layer->specificSurface();

double halfZ = cyl.bounds().length() / 2.;
Expand Down
8 changes: 8 additions & 0 deletions RecoMTD/TrackExtender/plugins/TrackExtenderWithMTD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,14 @@ TransientTrackingRecHit::ConstRecHitContainer TrackExtenderWithMTDT<TrackCollect

fillMatchingHits(ilay, tsos, traj, pmag2, pathlength0, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
}

// the ETL hits order must be from the innermost to the outermost

if (output.size() == 2) {
if (std::abs(output[0]->globalPosition().z()) > std::abs(output[1]->globalPosition().z())) {
std::reverse(output.begin(), output.end());
}
}
return output;
}

Expand Down

0 comments on commit b27fcd0

Please sign in to comment.