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

Use improved JSON configuration #50

Merged
merged 4 commits into from
Sep 29, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
565 changes: 561 additions & 4 deletions RecoTracker/MkFit/data/mkfit-phase1-detachedQuadStep.json

Large diffs are not rendered by default.

581 changes: 569 additions & 12 deletions RecoTracker/MkFit/data/mkfit-phase1-detachedTripletStep.json

Large diffs are not rendered by default.

565 changes: 561 additions & 4 deletions RecoTracker/MkFit/data/mkfit-phase1-highPtTripletStep.json

Large diffs are not rendered by default.

565 changes: 561 additions & 4 deletions RecoTracker/MkFit/data/mkfit-phase1-initialStep.json

Large diffs are not rendered by default.

565 changes: 561 additions & 4 deletions RecoTracker/MkFit/data/mkfit-phase1-lowPtQuadStep.json

Large diffs are not rendered by default.

565 changes: 561 additions & 4 deletions RecoTracker/MkFit/data/mkfit-phase1-lowPtTripletStep.json

Large diffs are not rendered by default.

565 changes: 561 additions & 4 deletions RecoTracker/MkFit/data/mkfit-phase1-mixedTripletStep.json

Large diffs are not rendered by default.

577 changes: 567 additions & 10 deletions RecoTracker/MkFit/data/mkfit-phase1-pixelLessStep.json

Large diffs are not rendered by default.

565 changes: 561 additions & 4 deletions RecoTracker/MkFit/data/mkfit-phase1-pixelPairStep.json

Large diffs are not rendered by default.

577 changes: 567 additions & 10 deletions RecoTracker/MkFit/data/mkfit-phase1-tobTecStep.json

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions RecoTracker/MkFit/interface/MkFitGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace mkfit {
class LayerNumberConverter;
class TrackerInfo;
class IterationsInfo;
} // namespace mkfit

class DetLayer;
Expand All @@ -26,14 +25,12 @@ class MkFitGeometry {
explicit MkFitGeometry(const TrackerGeometry& geom,
const GeometricSearchTracker& tracker,
const TrackerTopology& ttopo,
std::unique_ptr<mkfit::TrackerInfo> trackerInfo,
std::unique_ptr<mkfit::IterationsInfo> iterationsInfo);
std::unique_ptr<mkfit::TrackerInfo> trackerInfo);
~MkFitGeometry();

int mkFitLayerNumber(DetId detId) const;
mkfit::LayerNumberConverter const& layerNumberConverter() const { return *lnc_; }
mkfit::TrackerInfo const& trackerInfo() const { return *trackerInfo_; }
mkfit::IterationsInfo const& iterationsInfo() const { return *iterationsInfo_; }
const std::vector<const DetLayer*>& detLayers() const { return dets_; }
unsigned int uniqueIdInLayer(int layer, unsigned int detId) const { return detIdToShortId_.at(layer).at(detId); }
const TrackerTopology* topology() const { return ttopo_; }
Expand All @@ -42,7 +39,6 @@ class MkFitGeometry {
const TrackerTopology* ttopo_;
std::unique_ptr<mkfit::LayerNumberConverter> lnc_; // for pimpl pattern
std::unique_ptr<mkfit::TrackerInfo> trackerInfo_;
std::unique_ptr<mkfit::IterationsInfo> iterationsInfo_; // only temporarily here, to be moved into proper place later
std::vector<const DetLayer*> dets_;
std::vector<std::unordered_map<unsigned int, unsigned int>> detIdToShortId_;
};
Expand Down
6 changes: 2 additions & 4 deletions RecoTracker/MkFit/plugins/MkFitGeometryESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ void MkFitGeometryESProducer::fillDescriptions(edm::ConfigurationDescriptions& d

std::unique_ptr<MkFitGeometry> MkFitGeometryESProducer::produce(const TrackerRecoGeometryRecord& iRecord) {
auto trackerInfo = std::make_unique<mkfit::TrackerInfo>();
auto iterationsInfo = std::make_unique<mkfit::IterationsInfo>();
mkfit::createPhase1TrackerGeometry(*trackerInfo, *iterationsInfo, false);
mkfit::createPhase1TrackerGeometry(*trackerInfo, false);
return std::make_unique<MkFitGeometry>(iRecord.get(geomToken_),
iRecord.get(trackerToken_),
iRecord.get(ttopoToken_),
std::move(trackerInfo),
std::move(iterationsInfo));
std::move(trackerInfo));
}

DEFINE_FWK_EVENTSETUP_MODULE(MkFitGeometryESProducer);
99 changes: 98 additions & 1 deletion RecoTracker/MkFit/plugins/MkFitIterationConfigESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,103 @@
#include "RecoTracker/MkFit/interface/MkFitGeometry.h"

// mkFit includes
#include "Track.h"
#include "TrackerInfo.h"
#include "mkFit/HitStructures.h"
#include "mkFit/IterationConfig.h"


namespace {
using namespace mkfit;

void partitionSeeds0(const TrackerInfo &trk_info,
const TrackVec &in_seeds,
const EventOfHits &eoh,
IterationSeedPartition &part) {
// Seeds are placed into eta regions and sorted on region + eta.

const int size = in_seeds.size();

for (int i = 0; i < size; ++i) {
const Track &S = in_seeds[i];

const bool z_dir_pos = S.pz() > 0;

HitOnTrack hot = S.getLastHitOnTrack();
// MIMI ACHTUNG -- here we assume seed hits have already been remapped.
// This was true at that time :)
float eta = eoh[hot.layer].GetHit(hot.index).eta();
// float eta = S.momEta();

// Region to be defined by propagation / intersection tests
TrackerInfo::EtaRegion reg;

// Hardcoded for cms ... needs some lists of layers (hit/miss) for brl / ecp tests.
// MM: Check lambda functions/std::function
const LayerInfo &outer_brl = trk_info.outer_barrel_layer();

const LayerInfo &tib1 = trk_info.m_layers[4];
const LayerInfo &tob1 = trk_info.m_layers[10];

const LayerInfo &tecp1 = trk_info.m_layers[27];
const LayerInfo &tecn1 = trk_info.m_layers[54];

const LayerInfo &tec_first = z_dir_pos ? tecp1 : tecn1;

// If a track hits outer barrel ... it is in the barrel (for central, "outgoing" tracks).
// This is also true for cyl-cow.
// Better check is: hits outer TIB, misses inner TEC (but is +-z dependant).
// XXXX Calculate z ... then check is inside or less that first EC z.
// There are a lot of tracks that go through that crack.

// XXXX trying a fix for low pT tracks that are in barrel after half circle
float maxR = S.maxReachRadius();
float z_at_maxr;

bool can_reach_outer_brl = S.canReachRadius(outer_brl.m_rout);
float z_at_outer_brl;
bool misses_first_tec;
if (can_reach_outer_brl) {
z_at_outer_brl = S.zAtR(outer_brl.m_rout);
if (z_dir_pos)
misses_first_tec = z_at_outer_brl < tec_first.m_zmin;
else
misses_first_tec = z_at_outer_brl > tec_first.m_zmax;
} else {
z_at_maxr = S.zAtR(maxR);
if (z_dir_pos)
misses_first_tec = z_at_maxr < tec_first.m_zmin;
else
misses_first_tec = z_at_maxr > tec_first.m_zmax;
}

if (/*can_reach_outer_brl &&*/ misses_first_tec)
// outer_brl.is_within_z_limits(S.zAtR(outer_brl.r_mean())))
{
reg = TrackerInfo::Reg_Barrel;
} else {
// This should be a list of layers
// CMS, first tib, tob: 4, 10

if ((S.canReachRadius(tib1.m_rin) && tib1.is_within_z_limits(S.zAtR(tib1.m_rin))) ||
(S.canReachRadius(tob1.m_rin) && tob1.is_within_z_limits(S.zAtR(tob1.m_rin)))) {
// transition region ... we are still hitting barrel layers

reg = z_dir_pos ? TrackerInfo::Reg_Transition_Pos : TrackerInfo::Reg_Transition_Neg;
} else {
// endcap ... no barrel layers will be hit anymore.

reg = z_dir_pos ? TrackerInfo::Reg_Endcap_Pos : TrackerInfo::Reg_Endcap_Neg;
}
}

part.m_region[i] = reg;
part.m_sort_score[i] = 5.0f * (reg - 2) + eta;
}
}
} // namespace


class MkFitIterationConfigESProducer : public edm::ESProducer {
public:
MkFitIterationConfigESProducer(const edm::ParameterSet& iConfig);
Expand All @@ -34,7 +129,9 @@ void MkFitIterationConfigESProducer::fillDescriptions(edm::ConfigurationDescript

std::unique_ptr<mkfit::IterationConfig> MkFitIterationConfigESProducer::produce(
const TrackerRecoGeometryRecord& iRecord) {
return mkfit::ConfigJson_Load_File(iRecord.get(geomToken_).iterationsInfo(), configFile_);
auto it_conf = mkfit::ConfigJson_Load_File(configFile_);
it_conf->m_partition_seeds = partitionSeeds0;
return it_conf;
}

DEFINE_FWK_EVENTSETUP_MODULE(MkFitIterationConfigESProducer);
4 changes: 1 addition & 3 deletions RecoTracker/MkFit/plugins/MkFitOutputConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ TrackCandidateCollection MkFitOutputConverter::convertCandidates(const MkFitOutp

// hits
edm::OwnVector<TrackingRecHit> recHits;
// nTotalHits() gives sum of valid hits (nFoundHits()) and
// invalid/missing hits (up to a maximum of 32 inside mkFit,
// restriction to be lifted in the future)
// nTotalHits() gives sum of valid hits (nFoundHits()) and invalid/missing hits.
const int nhits = cand.nTotalHits();
bool lastHitInvalid = false;
for (int i = 0; i < nhits; ++i) {
Expand Down
Loading