-
Notifications
You must be signed in to change notification settings - Fork 511
[FV0] pile-up simulation #4500
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
Merged
Merged
[FV0] pile-up simulation #4500
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
[FV0] pile-up simulation
- Loading branch information
commit c82e90663fa1b0ced70f00996f9c21aae1904e9b
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ class Digitizer | |
|
|
||
| public: | ||
| Digitizer() | ||
| : mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mPmtChargeVsTime(), mNBins(), mPmtResponseGlobal(), mPmtResponseTemp() | ||
| : mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mCache(), mPmtChargeVsTime(), mNBins(), NTimeBinsPerBC(), mPmtResponseGlobal(), mPmtResponseTemp() | ||
| { | ||
| } | ||
|
|
||
|
|
@@ -53,25 +53,68 @@ class Digitizer | |
| void setSrcId(Int_t id) { mSrcId = id; } | ||
| void setInteractionRecord(const InteractionTimeRecord& ir) { mIntRecord = ir; } | ||
|
|
||
| void process(const std::vector<o2::fv0::Hit>& hits); | ||
| void analyseWaveformsAndStore(std::vector<fv0::BCData>& digitsBC, | ||
| std::vector<fv0::ChannelData>& digitsCh, | ||
| dataformats::MCTruthContainer<fv0::MCLabel>& labels); | ||
| void process(const std::vector<o2::fv0::Hit>& hits, std::vector<o2::fv0::BCData>& digitsBC, | ||
| std::vector<o2::fv0::ChannelData>& digitsCh, o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels); | ||
|
|
||
| void flush(std::vector<o2::fv0::BCData>& digitsBC, | ||
| std::vector<o2::fv0::ChannelData>& digitsCh, | ||
| o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels); | ||
|
|
||
| const InteractionRecord& getInteractionRecord() const { return mIntRecord; } | ||
| InteractionRecord& getInteractionRecord(InteractionRecord& src) { return mIntRecord; } | ||
| uint32_t getOrbit() const { return mIntRecord.orbit; } | ||
| uint16_t getBC() const { return mIntRecord.bc; } | ||
|
|
||
| using ChannelBCDataF = std::vector<float>; | ||
|
|
||
| struct BCCache : public o2::InteractionRecord { | ||
| std::vector<o2::fv0::MCLabel> labels; | ||
| //std::array<float, Constants::nFv0Channels> Cfd_times; | ||
| //std::array<float, Constants::nFv0Channels> Charges; | ||
| std::array<ChannelBCDataF, Constants::nFv0Channels> mPmtChargeVsTime = {}; | ||
|
|
||
| void clear() | ||
| { | ||
| for (auto& channel : mPmtChargeVsTime) { | ||
| std::fill(channel.begin(), channel.end(), 0.); | ||
| } | ||
| labels.clear(); | ||
| } | ||
|
|
||
| //bool IsCounted = false; | ||
| //bool isWritten = 0; | ||
| //int EvID; | ||
| // void setEvID (const int ev) {EvID = ev;} | ||
| //BCCache(); | ||
| BCCache& operator=(const o2::InteractionRecord& ir) | ||
| { | ||
| o2::InteractionRecord::operator=(ir); | ||
| return *this; | ||
| } | ||
| void print() const; | ||
| }; | ||
|
|
||
| private: | ||
| static constexpr int BCCacheMin = 0, BCCacheMax = 7, NBC2Cache = 1 + BCCacheMax - BCCacheMin; | ||
| void createPulse(float mipFraction, int parID, double hitTime, std::array<o2::InteractionRecord, NBC2Cache> const& cachedIR, | ||
| int nCachedIR, const int& detID); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. detId is 4B int, no need to pass 8B reference, then dereference it, pass by value.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
|
||
| long mTimeStamp; // TF (run) timestamp | ||
| InteractionRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord | ||
| InteractionTimeRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord | ||
| Int_t mEventId; // ID of the current event | ||
| Int_t mSrcId; // signal, background or QED | ||
| std::vector<fv0::MCLabel> mMCLabels; | ||
| std::deque<fv0::MCLabel> mMCLabels; | ||
| std::deque<BCCache> mCache; | ||
|
|
||
| BCCache& setBCCache(const o2::InteractionRecord& ir); | ||
| BCCache* getBCCache(const o2::InteractionRecord& ir); | ||
|
|
||
| void storeBC(const BCCache& bc, std::vector<o2::fv0::BCData>& digitsBC, std::vector<o2::fv0::ChannelData>& digitsCh, | ||
| o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels); | ||
|
|
||
| std::array<std::vector<Float_t>, Constants::nFv0Channels> mPmtChargeVsTime; // Charge time series aka analogue signal pulse from PM | ||
| UInt_t mNBins; // Number of bins in pulse series | ||
| UInt_t mNBins; // | ||
| UInt_t NTimeBinsPerBC; | ||
| Float_t mBinSize; // Time width of the pulse bin - HPTDC resolution | ||
|
|
||
| /// vectors to store the PMT signal from cosmic muons | ||
|
|
@@ -80,7 +123,9 @@ class Digitizer | |
|
|
||
| /// Internal helper methods related to conversion of energy-deposition into el. signal | ||
| Int_t SimulateLightYield(Int_t pmt, Int_t nPhot) const; | ||
| Float_t SimulateTimeCfd(Int_t channel) const; | ||
| Float_t SimulateTimeCfd(const ChannelBCDataF& pulse) const; | ||
| Float_t IntegrateCharge(const ChannelBCDataF& pulse) const; | ||
| // Float_t SimulateTimeCfd(Int_t channel, Int_t iCache) const; | ||
|
|
||
| /// Functions related to splitting ring-5 cell signal to two readout channels | ||
| static float getDistFromCellCenter(UInt_t cellId, double hitx, double hity); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
data members start with mXXX.