Skip to content

Conversation

@fengyvoid
Copy link
Contributor

EBMRD Tool in EventBuildingV2 tool set.

This is splitted from PR #307

Seems you don't have comment for this one! :)

Copy link
Collaborator

@jminock jminock left a comment

Choose a reason for hiding this comment

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

Looks good! This is already in use. So it has been tested and works.

Log("EBMRD: Current buffer size is " + std::to_string(MRDEventsBuffer.size()), v_message, verbosityEBMRD);
// loop the MRDEvents, save every event to MRDEventsBuffer if it's not already in the buffer
int newLoadedEvents = 0;
for (std::pair<uint64_t, std::vector<std::pair<unsigned long, int>>> p : MRDEvents)
Copy link
Collaborator

Choose a reason for hiding this comment

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

use reference to avoid copying

for (std::pair<uint64_t, std::vector<std::pair<unsigned long, int>>> p : MRDEvents)
{
uint64_t MTCtime = p.first;
std::vector<std::pair<unsigned long, int>> WaveMap = p.second;
Copy link
Collaborator

Choose a reason for hiding this comment

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

use reference to avoid copying

if (PairedMRDTimeStamps.size() > 0)
{
bool skip = false;
for (std::pair<int, std::vector<uint64_t>> pair : PairedMRDTimeStamps)
Copy link
Collaborator

Choose a reason for hiding this comment

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

use reference to avoid copying

if (skip)
continue;
}
if (MRDEventsBuffer.find(MTCtime) == MRDEventsBuffer.end())
Copy link
Collaborator

Choose a reason for hiding this comment

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

use std::map.count instead of find

Matching(matchTargetTrigger, 14);
if (CosmicTriggerGroupped)
{
Matching(36, 36);
Copy link
Collaborator

Choose a reason for hiding this comment

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

i presume these are trigger types - ideally use enums instead of magic numbers

if (verbosityEBMRD > 11)
cout << "******************EBMRD: new MRD event: " << loopNum << endl;
uint64_t MTCtime = mrdpair.first;
std::vector<std::pair<unsigned long, int>> WaveMap = mrdpair.second;
Copy link
Collaborator

Choose a reason for hiding this comment

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

make reference to avoid copy

uint32_t matchedTrigWord = 0;
int matchedTrack = 0;
int matchedIndex = 0;
for (std::pair<int, std::vector<std::map<uint64_t, uint32_t>>> pair : GroupedTriggersInTotal)
Copy link
Collaborator

Choose a reason for hiding this comment

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

reference to avoid ocpy

Log("EBMRD: Skipping TrackTriggerWord " + std::to_string(TrackTriggerWord), v_debug, verbosityEBMRD);
continue;
}
if (matchedNumberInTrack.find(TrackTriggerWord) == matchedNumberInTrack.end())
Copy link
Collaborator

Choose a reason for hiding this comment

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

map.count instead of find

if (matchedNumberInTrack.find(TrackTriggerWord) == matchedNumberInTrack.end())
matchedNumberInTrack.emplace(TrackTriggerWord, 0);

vector<std::map<uint64_t, uint32_t>> groupedTriggers = pair.second;
Copy link
Collaborator

Choose a reason for hiding this comment

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

use reference to avoid copy


for (int i = 0; i < groupedTriggers.size(); i++)
{
map<uint64_t, uint32_t> groupedTrigger = groupedTriggers.at(i);
Copy link
Collaborator

Choose a reason for hiding this comment

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

use reference to avoid copy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants