-
Notifications
You must be signed in to change notification settings - Fork 484
CPV fix simulation workflow #5887
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
Changes from all commits
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
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
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
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
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
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
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
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
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
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 |
|---|---|---|
|
|
@@ -60,6 +60,28 @@ void RawWriter::digitsToRaw(gsl::span<o2::cpv::Digit> digitsbranch, gsl::span<o2 | |
| } | ||
| } | ||
|
|
||
| if (!mPedestals) { | ||
| if (o2::cpv::CPVSimParams::Instance().mCCDBPath.compare("localtest") == 0) { | ||
| mPedestals = std::make_unique<o2::cpv::Pedestals>(1); // test default calibration | ||
| LOG(INFO) << "[RawWriter] No reading calibration from ccdb requested, set default"; | ||
| } else { | ||
| LOG(INFO) << "[RawWriter] getting calibration object from ccdb"; | ||
| o2::ccdb::CcdbApi ccdb; | ||
| std::map<std::string, std::string> metadata; | ||
| ccdb.init("http://ccdb-test.cern.ch:8080"); // or http://localhost:8080 for a local installation | ||
|
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. could you please make the ccdb patch a settable parameter? |
||
| auto tr = triggerbranch.begin(); | ||
| double eventTime = -1; | ||
| // if(tr!=triggerbranch.end()){ | ||
| // eventTime = (*tr).getBCData().getTimeNS() ; | ||
| // } | ||
| //add copy constructor if necessary | ||
| // mPedestals = std::make_unique<o2::cpv::Pedestals>(ccdb.retrieveFromTFileAny<o2::cpv::Pedestals>("CPV/Calib", metadata, eventTime)); | ||
| if (!mPedestals) { | ||
| LOG(FATAL) << "[RawWriter] can not get calibration object from ccdb"; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| for (auto trg : triggerbranch) { | ||
| processTrigger(digitsbranch, trg); | ||
| } | ||
|
|
@@ -84,7 +106,7 @@ bool RawWriter::processTrigger(const gsl::span<o2::cpv::Digit> digitsbranch, con | |
| o2::cpv::Geometry::absIdToHWaddress(absId, ccId, dil, gas, pad); | ||
|
|
||
| //Convert Amp to ADC counts | ||
| short charge = dig.getAmplitude() / mCalibParams->getGain(absId); | ||
| short charge = dig.getAmplitude() / mCalibParams->getGain(absId) + mPedestals->getPedestal(absId); | ||
| if (charge > 4095) { | ||
| charge = 4095; | ||
| } | ||
|
|
||
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.
If this is a calibration data format which should be stored in the ccdb, please consider moving it to DataFormats/Detectorts/CPV (can be other PR, I guess there are other such classes).
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.
@shahor02 actually there is plenty of work: I need to adjust calibration procedure as well. I think configuring ccdb path should naturally be included in that PR (which is not ready yet). I hope it's OK for you.
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.
@sevdokim Sure, but in the DPL workflows keep it simple: eventually the DPL framework will take care of CCDB related stuff.
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.
@shahor02 to be honest, I didn't get you last sentence. Can you please detalize it?
Particularly, what is the reason to move calibration objects headers to DataFormats/Detectorts/CPV? Will it help CCDB framework somehow to take care of them? What is CCDB related stuff? In our code we connect to CCDB and exctract
calibration objects from there. Maybe there is a global instance of CCDB which can be used and we don't have to create a new one?
PS: sorry for this ignorance. I want to improve my understanding in order to produce effective code and safe your time for reviews in the future.
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.
@sevdokim We try to have all data (including the calibration) format classes (i.e. those classes which ends up in the DPL messages and/or stored in the files) in DataFormats directories, with no dependence on Detectors sim/rec/calib processing classes. Mostly in order to minimize the risk of circular dependencies.
Concerning the "CCDB stuff": eventually, the detector code should not deal with CCDB server directly, instead it will declare in the DPL device specifications what objects it will need (in the same way as it currently subscribes to data) and the framework will take care of shipping the objects matching to the timestamp of the TF being processed.
This is not available at the moment so we have to configure/query the ccdb server. Note that this will work for DPL workflows only. For simple executables, like digi2raw, we will always deal with CCDB directly.