-
Notifications
You must be signed in to change notification settings - Fork 29
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
Realistic BTOF digitization #1635
base: main
Are you sure you want to change the base?
Conversation
Update BTOFHitDigi.cc
Update BTOFHitDigi.h
Update BTOFHitDigi.cc
… distance relative to the center of the center cell. Now it's changed so spread is calculated relative to the true hit location.
…ighbors when cell ID from BitFieldDecoder for cellID is negative.
…ith dead spaces implemented.
…ion-clusterization
Capybara summary for PR 1635
|
It would appear that
|
I see. Interesting. I will profile my code and get back to you when I have a faster implementation. |
Quite a lot to look over here, it might be reasonable to divide the PR up into a separate digitization and reconstruction PR. There might be scope to divide the algorithms up further too. A couple of comments on the location of the code: |
I can divide the PR, but while digi part is being reviewed and before reco part is uploaded, we have to test digi on its own. "There might be scope to divide the algorithms up further too." One way that come up to my mind is to separate the creation of electric pulses and the "digitizer" (sorry forgot the accurate word) which convert the pulse to digitized ADC/TDC values. It opens up to the possibility of adding noise in the pulse in the future as an intermediate class between pulse generator and digitizer. That means I have to make a electric pulse container. Please let me know if that's align with your ideas. "The changes made to reco.cc should be moved to BTOF.cc I can do that. Thanks for the suggestions. I also find out why my code is slow. There are two major reasons. The first is that it simulates 10000 time bins for some reasons when there are only 1024 TDC values. The second is that it tries to simulate pulses in all 2*64 cells (a.k.a. pixel/strips) in a sensor, but charge sharing is usually limited to only the neighboring 2 to 3 cells at most. I can ask my code to not simulate pulses if the charge deposition is below a certain limit. I am able to speed it up by 50 times when these two issues are solved. I am finishing my code, but if you want me to break the pull request into two, I will do that. Please let me know of your opinion. |
Hi Tommy, Apologies for being slow with a more thorough review, but I second Simon's suggestion of splitting it up into a couple of different PRs. That will help us enormously! I have a few general points for consideration:
|
This is certainly something that will be useful in the longer term yes, although I think it's probably not essential at this point. I was thinking more about breaking it up after you've calculated the charge for each neighbour (https://github.com/eic/EICrecon/pull/1635/files#diff-acbf526d2d8f845cc80b1d9971d6165206659cd1ae2b059920290d6b6efbc972R131), from this you can save a charge shared time, charge and cellID before doing the digitization. This should allow potential contributions in the same cell from different hits to be combined and attempt to be separated by summing the landau contributions. I don't believe this is happening at the moment. I might change my mind as I look through the code.
Great, that's a good start, hopefully we can speed it up a bit further. I'll try and make a few comments in the code itself. |
That can be done too. We can have three classes, the charge sharing class, the pulse generation class, and the digitization class. I am working on it. |
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.
A few comments to start with. Hopefully some of them useful.
bool _useCache = true; | ||
const dd4hep::DDSegmentation::BitFieldCoder* _decoder = nullptr; | ||
const dd4hep::Detector* _detector = nullptr; | ||
|
||
std::unique_ptr<dd4hep::rec::CellIDPositionConverter> _converter; | ||
std::shared_ptr<spdlog::logger> _log; | ||
std::unordered_map<dd4hep::rec::CellID, std::shared_ptr<std::vector<dd4hep::rec::CellID>>> _cache; |
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.
In the rest of the code we use m_
rather than just _
to indicate a member
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.
All object members are now renamed to use "m_" prefix. For protected functions, do you also want me to use "m_"?
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.
I'll leave this for someone more qualified to answer, I don't think we have a standard for distinguishing protected functions at the moment.
src/detectors/BTOF/BTOFHitDigi.h
Outdated
|
||
namespace eicrecon { | ||
|
||
class BTOFHitDigi : public WithPodConfig<BTOFHitDigiConfig> { |
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.
Please can you convert this to use the algorithms interface we're now using for our other algorithms. e.g. https://github.com/eic/EICrecon/blob/main/src/algorithms/digi/SiliconTrackerDigi.h
This will require matching changes to BTOFHitDigi.cc process
function and BTOFHitDigi_factory.h to match.
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.
Must process be const? Is that required for multi-threading? It's mostly a concern when I want to use TF1::SetParameter in process for pulse generation. I can get around by declaring new TF1 on stack in process, but I don't know if that's a efficient way to do it.
return position; | ||
} | ||
|
||
dd4hep::Position BarrelTOFNeighborFinder::global2Local(const dd4hep::Position& pos) { |
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 always a frustrating function to do from the dd4hep geometry but I think it can be simplified a bit, will have to check.
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.
Turns out "global2Local" is not required for digitization, but I do need "cell2LocalPosition" so I can integrate the charge deposition inside a cell in sensor frame. Please see detector/BTOFChargeSharing
I tried to use edm4hep::RawTimeSeries, but I can't find documents on this container. I don't know what is the interface for appending voltage at different time bins. I can't find any example code on EICrecon or EDM4hep. How do I append to adcCounts (which I assumed is the member of type vector?) Thanks for your help. |
Ah! So the interface is the same as when adding to any other vector member of an
You can see it "in situ" on our HGCROC development branch (we're not very far along). And you can see some parallel examples of adding to the hits and weights vector of an |
…hree parts: 1. Charge sharing, 2. Pulse generation, 3. Pulse digitization.
for more information, see https://pre-commit.ci
I have broken down my BTOFHigDigi into three classes: BTOFChargeSharing, TOFPulseGeneration and TOFPulseDigitization. I removed BTOFHitReconstruction and save it for a later pull request as advised.
It's done. All functionalities of BarrelTOFNeighborFinder has been integrated into BTOFChargeSharing.
I removed the "B" from TOFPulseGeneration and TOFPulseDigitization because, like you've said, the same algorithm should work on ETOF even though I haven't tried it. I keep the "B" in BTOFChargeSharing because the meaning of cellID differs slightly between BTOF and ETOF so I am sure the charge sharing part can't work with anything other than BTOF.
Thanks for your recommendation. I took your advise and implemented it in TOFPulseGeneration and TOFPulseDigitization . Please take a look |
Briefly, what does this PR introduce?
It's an attempt to make LGAD sensor response for Barrel TOF more realistic by doing the following,
Noise, edge correction and time talk correction will be developed in the future.
What kind of change does this PR introduce?
Please check if this PR fulfills the following:
Does this PR introduce breaking changes? What changes might users need to make to their code?
Does this PR change default behavior?
It replaces the content of "TOFBarrelRecHit" with results of this new clusterization. It was originally just geant point + random smearing. I have communicated to the reconstruction group and they advise that I submit this pull request so they can study the effect of having this new digitization/clusterization algorithm. They will decide if I should save the data in a new branch or replace the origin content.