Skip to content

Commit

Permalink
Switched to unsigned indexes for iteration, and applied naming conven…
Browse files Browse the repository at this point in the history
…tions for L1TMuonEndcapPhase2
  • Loading branch information
omiguelc committed Mar 5, 2024
1 parent c955ecd commit 6853903
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions L1Trigger/L1TMuonEndCapPhase2/interface/SectorProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace emtf::phase2 {

~SectorProcessor();

void configure_event(const edm::Event&);
void configureEvent(const edm::Event&);

void configure_bx(const int&);
void configureBx(const int&);

void select(const TriggerPrimitive&, const TPInfo&);

Expand All @@ -36,13 +36,13 @@ namespace emtf::phase2 {
std::map<SubsystemType, ILinkTPCMap> bx_ilink_tpc_maps_;

// Helper functions
void copy_tp(const ILinkTPCMap& source, ILinkTPCMap& target) const;
void copyTP(const ILinkTPCMap& source, ILinkTPCMap& target) const;

void convert_tp(const int&, const ILinkTPCMap&, EMTFHitCollection&);
void convertTP(const int&, const ILinkTPCMap&, EMTFHitCollection&);

void populate_segments(const std::vector<EMTFHitCollection>&, std::map<int, int>&, segment_collection_t&);
void populateSegments(const std::vector<EMTFHitCollection>&, std::map<int, int>&, segment_collection_t&);

void build_tracks(const std::map<int, int>&, const segment_collection_t&, const bool&, EMTFTrackCollection&);
void buildTracks(const std::map<int, int>&, const segment_collection_t&, const bool&, EMTFTrackCollection&);
};

} // namespace emtf::phase2
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1TMuonEndCapPhase2/interface/TrackFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ namespace emtf::phase2 {
EMTFTrackCollection&,
EMTFInputCollection&);

void on_job_begin();
void onJobBegin();

void on_job_end();
void onJobEnd();

private:
EMTFContext context_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ void L1TMuonEndCapPhase2TrackProducer::produce(edm::Event& event, const edm::Eve
event.emplace(in_token_, std::move(out_inputs));
}

void L1TMuonEndCapPhase2TrackProducer::beginStream(edm::StreamID stream_id) { track_finder_->on_job_begin(); }
void L1TMuonEndCapPhase2TrackProducer::beginStream(edm::StreamID stream_id) { track_finder_->onJobBegin(); }

void L1TMuonEndCapPhase2TrackProducer::endStream() { track_finder_->on_job_end(); }
void L1TMuonEndCapPhase2TrackProducer::endStream() { track_finder_->onJobEnd(); }

//define this as a plug-in
DEFINE_FWK_MODULE(L1TMuonEndCapPhase2TrackProducer);
32 changes: 16 additions & 16 deletions L1Trigger/L1TMuonEndCapPhase2/src/SectorProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ SectorProcessor::~SectorProcessor() {
// Do Nothing
}

void SectorProcessor::configure_event(const edm::Event& event) {
void SectorProcessor::configureEvent(const edm::Event& event) {
// Event
event_ = &event;
bx_ = nullptr;
Expand All @@ -72,7 +72,7 @@ void SectorProcessor::configure_event(const edm::Event& event) {
bx_ilink_tpc_maps_.clear();
}

void SectorProcessor::configure_bx(const int& bx) {
void SectorProcessor::configureBx(const int& bx) {
// BX
bx_ = &bx;

Expand Down Expand Up @@ -118,7 +118,7 @@ void SectorProcessor::process(EMTFHitCollection& out_hits,
ILinkTPCMap bx_ilink_tpc_map;

for (auto& [subsystem, ilink_tpc_map] : bx_ilink_tpc_maps_) {
copy_tp(ilink_tpc_map, bx_ilink_tpc_map);
copyTP(ilink_tpc_map, bx_ilink_tpc_map);
}

// Free memory
Expand All @@ -131,7 +131,7 @@ void SectorProcessor::process(EMTFHitCollection& out_hits,
// Convert tp into hits
EMTFHitCollection bx_hits;

convert_tp(out_hits.size(), bx_ilink_tpc_map, bx_hits);
convertTP(out_hits.size(), bx_ilink_tpc_map, bx_hits);

// Append to bx window hits
bx_window_hits_.push_back(bx_hits);
Expand Down Expand Up @@ -160,11 +160,11 @@ void SectorProcessor::process(EMTFHitCollection& out_hits,
// Convert bx window hits into segments
segment_collection_t segments;

populate_segments(bx_window_hits_, seg_to_hit, segments);
populateSegments(bx_window_hits_, seg_to_hit, segments);

// Build Tracks
build_tracks(seg_to_hit, segments, false, out_tracks); // With prompt setup
build_tracks(seg_to_hit, segments, true, out_tracks); // With displaced setup
buildTracks(seg_to_hit, segments, false, out_tracks); // With prompt setup
buildTracks(seg_to_hit, segments, true, out_tracks); // With displaced setup

// ===========================================================================
// Record segments/hits used in track building
Expand Down Expand Up @@ -192,7 +192,7 @@ void SectorProcessor::process(EMTFHitCollection& out_hits,
}
}

void SectorProcessor::copy_tp(const ILinkTPCMap& source, ILinkTPCMap& target) const {
void SectorProcessor::copyTP(const ILinkTPCMap& source, ILinkTPCMap& target) const {
typedef typename ILinkTPCMap::iterator Iterator_t;
typedef typename ILinkTPCMap::mapped_type Collection_t;

Expand All @@ -212,7 +212,7 @@ void SectorProcessor::copy_tp(const ILinkTPCMap& source, ILinkTPCMap& target) co
}
}

void SectorProcessor::convert_tp(const int& initial_hit_id, const ILinkTPCMap& ilink_tpc_map, EMTFHitCollection& hits) {
void SectorProcessor::convertTP(const int& initial_hit_id, const ILinkTPCMap& ilink_tpc_map, EMTFHitCollection& hits) {
EMTFHitCollection substitutes;

for (const auto& [ilink, ilink_tpc] : ilink_tpc_map) { // loop input link trigger primitive collections
Expand Down Expand Up @@ -266,9 +266,9 @@ void SectorProcessor::convert_tp(const int& initial_hit_id, const ILinkTPCMap& i
}
}

void SectorProcessor::populate_segments(const std::vector<EMTFHitCollection>& bx_window_hits,
std::map<int, int>& seg_to_hit,
segment_collection_t& segments) {
void SectorProcessor::populateSegments(const std::vector<EMTFHitCollection>& bx_window_hits,
std::map<int, int>& seg_to_hit,
segment_collection_t& segments) {
// Initialize
for (unsigned int seg_id = 0; seg_id < v3::kNumSegments; ++seg_id) {
segments[seg_id].phi = 0;
Expand Down Expand Up @@ -381,10 +381,10 @@ void SectorProcessor::populate_segments(const std::vector<EMTFHitCollection>& bx
} // End loop from latest BX Collection to oldest BX Hit Collection
}

void SectorProcessor::build_tracks(const std::map<int, int>& seg_to_hit,
const segment_collection_t& segments,
const bool& displaced_en,
EMTFTrackCollection& out_tracks) {
void SectorProcessor::buildTracks(const std::map<int, int>& seg_to_hit,
const segment_collection_t& segments,
const bool& displaced_en,
EMTFTrackCollection& out_tracks) {
// Apply Hitmap Building Layer: Convert segments into hitmaps
std::vector<hitmap_t> zone_hitmaps;

Expand Down
8 changes: 4 additions & 4 deletions L1Trigger/L1TMuonEndCapPhase2/src/TrackFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void TrackFinder::process(

// Before event
for (auto& sector_processor : sector_processors_) {
sector_processor->configure_event(i_event);
sector_processor->configureEvent(i_event);
}

// Orderly loop BX
Expand All @@ -186,7 +186,7 @@ void TrackFinder::process(
// Loop over all sector processors
for (auto& sector_processor : sector_processors_) {
// Before BX
sector_processor->configure_bx(bx);
sector_processor->configureBx(bx);

// Select trigger primitives in BX
if (bx_tpc_ptr != nullptr) {
Expand All @@ -212,10 +212,10 @@ void TrackFinder::process(
bx_tpc_map.clear();
}

void TrackFinder::on_job_begin() {
void TrackFinder::onJobBegin() {
// Do Nothing
}

void TrackFinder::on_job_end() {
void TrackFinder::onJobEnd() {
// Do Nothing
}

0 comments on commit 6853903

Please sign in to comment.