Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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
10 changes: 3 additions & 7 deletions RecoTracker/MkFit/plugins/MkFitGeometryESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@ 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);
return std::make_unique<MkFitGeometry>(iRecord.get(geomToken_),
iRecord.get(trackerToken_),
iRecord.get(ttopoToken_),
std::move(trackerInfo),
std::move(iterationsInfo));
mkfit::createPhase1TrackerGeometry(*trackerInfo, false);
return std::make_unique<MkFitGeometry>(
iRecord.get(geomToken_), iRecord.get(trackerToken_), iRecord.get(ttopoToken_), std::move(trackerInfo));
}

DEFINE_FWK_EVENTSETUP_MODULE(MkFitGeometryESProducer);
86 changes: 79 additions & 7 deletions RecoTracker/MkFit/plugins/MkFitIterationConfigESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,107 @@
#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) {
const int size = in_seeds.size();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const int size = in_seeds.size();
const size_t size = in_seeds.size();

perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks.


for (int i = 0; i < size; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (int i = 0; i < size; ++i) {
for (size_t i = 0; i < size; ++i) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks.

const Track &S = in_seeds[i];

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

HitOnTrack hot = S.getLastHitOnTrack();
float eta = eoh[hot.layer].GetHit(hot.index).eta();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
float eta = eoh[hot.layer].GetHit(hot.index).eta();
const float eta = eoh[hot.layer].GetHit(hot.index).eta();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks.


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

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;

float maxR = S.maxReachRadius();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
float maxR = S.maxReachRadius();
const float maxR = S.maxReachRadius();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks.

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 (misses_first_tec) {
reg = TrackerInfo::Reg_Barrel;
} else {
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)))) {
reg = z_dir_pos ? TrackerInfo::Reg_Transition_Pos : TrackerInfo::Reg_Transition_Neg;
} else {
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;
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps these magic numbers need to be put into a constexpr or clarified via a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: a constexpr is now used and a comment has been added to explain the point of this line. Thanks!

}
}
} // namespace

class MkFitIterationConfigESProducer : public edm::ESProducer {
public:
MkFitIterationConfigESProducer(const edm::ParameterSet& iConfig);
MkFitIterationConfigESProducer(const edm::ParameterSet &iConfig);

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);

std::unique_ptr<mkfit::IterationConfig> produce(const TrackerRecoGeometryRecord& iRecord);
std::unique_ptr<mkfit::IterationConfig> produce(const TrackerRecoGeometryRecord &iRecord);

private:
const edm::ESGetToken<MkFitGeometry, TrackerRecoGeometryRecord> geomToken_;
const std::string configFile_;
};

MkFitIterationConfigESProducer::MkFitIterationConfigESProducer(const edm::ParameterSet& iConfig)
MkFitIterationConfigESProducer::MkFitIterationConfigESProducer(const edm::ParameterSet &iConfig)
: geomToken_{setWhatProduced(this, iConfig.getParameter<std::string>("ComponentName")).consumes()},
configFile_{iConfig.getParameter<edm::FileInPath>("config").fullPath()} {}

void MkFitIterationConfigESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
void MkFitIterationConfigESProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("ComponentName")->setComment("Product label");
desc.add<edm::FileInPath>("config")->setComment("Path to the JSON file for the mkFit configuration parameters");
descriptions.addWithDefaultLabel(desc);
}

std::unique_ptr<mkfit::IterationConfig> MkFitIterationConfigESProducer::produce(
const TrackerRecoGeometryRecord& iRecord) {
return mkfit::ConfigJson_Load_File(iRecord.get(geomToken_).iterationsInfo(), configFile_);
const TrackerRecoGeometryRecord &iRecord) {
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