-
Notifications
You must be signed in to change notification settings - Fork 59
Add EBPMT for PMT pairing in EventBuilding #332
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
Conversation
|
Is it worth moving the check on line 76 to line 44; is this just doing needless work if those checks are both false? i think line 122 should be enclosed with line 121 in It seems like it may not be intended that the printout in line 125 may result in the insertion of an element into the AlmostCompletedWavefroms map via Would suggest using references on lines 152, 154, 284, 290, 295, 297, 446, 447, 450-453 to avoid copies. Not sure if the logic prohibits it but would suggest for good practice the use of |
1. I move the get and check of `RWMRawWaveforms` and `BRFRawWaveforms` to line 75 to 85. 2. I move the check and return to line 44-49. 3. The line 122 was still at 122, but only print after the `[]` 4. For line 125 and 137, I change the usage of `[]` to a int AlmostCompleteWaveforms_CountHere, initialized to be zero. 5. I would want to use that but may want to leave this to future optimization... since everything is working right now. (not perfectly because I do see zero PMT waveform from some timestamps, but they can be removed in later steps no matter where they are from) 6. Now at line 339 to 341, changed to emplace as you suggest.
|
Appreciate for all the very useful comments and suggestions! I definitely need to learn more about pointers...
|
Previously, if NumWavesInCompleteSet was set to 140 and there are only ~133 PMT waveforms exist in data, the AlmostCompleteWaveforms[PMTCounterTimeNs] won't be created. But the usage of AlmostCompleteWaveforms[PMTCounterTimeNs] in Log will create an entry there. This won't affect the later code because there are checks to require AlmostCompleteWaveforms[PMTCounterTimeNs] > 5. Now the Log was removed and the tolerance for PMT number is changed to 10 at: ChannelKey.size() >= (NumWavesInCompleteSet - 10)
|
It looks like Marcus' points were addressed in the new changes. As this is a standalone tool and is in the event building workflow currently in use, I say it's good to go. |
|
|
||
|
|
||
|
|
||
| if (exeNum % 80 == 0 && exeNum != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit confusing and seems a bit hand wavey. I don't really follow the comment, but am not a great fan of "do the VME offset correction once every X number of executes because that seems to be about right probably".
Is there not a more definitive way of determining when it needs to be done?
| vector<uint64_t> RWMEmplacedTimes; | ||
| vector<uint64_t> BRFEmplacedTimes; | ||
|
|
||
| for (std::pair<uint64_t, std::map<unsigned long, std::vector<Hit>> *> p : *InProgressHits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would prefer using a reference in range-based for loops, but since value is a pointer i suppose this isn't too critical.
| { | ||
| uint64_t PMTCounterTimeNs = p.first; | ||
| std::map<unsigned long, std::vector<Hit>> *hitMap = p.second; | ||
| vector<unsigned long> ChannelKey = InProgressChkey->at(PMTCounterTimeNs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again making copies of vectors isn't great efficiency, using a reference would be better.
| if (ChannelKey.size() >= (NumWavesInCompleteSet - 10)) | ||
| { | ||
| Log("EBPMT: ChannelKey.size() == (NumWavesInCompleteSet - 1), ChannelKey.size() = " + std::to_string(ChannelKey.size()) + " == NumWavesInCompleteSet - 1 = " + std::to_string(NumWavesInCompleteSet - 1), v_debug, verbosityEBPMT); | ||
| if (AlmostCompleteWaveforms.find(PMTCounterTimeNs) != AlmostCompleteWaveforms.end()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AlmostCompleteWaveforms is a std::map - no need to use .find() != .end(), just use .count()
| // cout<<ch<<", "; | ||
| // } | ||
| // cout<<endl; | ||
| auto it_acw = AlmostCompleteWaveforms.find(PMTCounterTimeNs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again shouldn't be using find with std::map
| // loop all the grouped triggers, if the value is target trigger, then calculate the time difference | ||
| for (int i = 0; i < groupedTriggers.size(); i++) | ||
| { | ||
| map<uint64_t, uint32_t> groupedTrigger = groupedTriggers.at(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use reference
| if (saveRWMWaveforms) | ||
| { | ||
| // check does RWMRawWaveforms have key PMTCounterTimeNs, if not, print a log waring and skip | ||
| if (RWMRawWaveforms->find(PMTCounterTimeNs) == RWMRawWaveforms->end()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::map.count() instead of .find()
| if (saveBRFWaveforms) | ||
| { | ||
| // check does BRFRawWaveforms have key PMTCounterTimeNs, if not, print a log waring and skip | ||
| if (BRFRawWaveforms->find(PMTCounterTimeNs) == BRFRawWaveforms->end()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count instead of find
|
|
||
| Log("EBPMT: Found " + std::to_string(timestamps.size()) + " timestamps", v_message, verbosityEBPMT); | ||
|
|
||
| // loop timestamps,对于每一个时间戳,检查它与它之前的时间戳的差值是否是8或者16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
english translation please
| #include "AssignBunchTimingMC.h" | ||
| #include "FitRWMWaveform.h" | ||
| #include "EBPMT.h" | ||
| #include "EBPMT.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate entry
|
I'm inclined to merge this to avoid holding things off any longer. The requested changes are very minimal - both with regards to time/effort to implement, but also in terms of severity. In light of this, I'm going to merge, but as per #333 I would appreciate if someone can make (and validate) the requested changes in a new PR. |
EBPMT Tool in EventBuildingV2 tool set.
This is splitted from PR #307, I agree that it's definitely easier to submit tools one by one and not necessary to submit by a whole tool chain. I will also list the changes based on your comments in #307.
Changes based on your comments:
· Can we translate EBPMT.cpp line 386 to english please?
Yes, now it's at 396 - 398