Skip to content
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

Fix APV shot cleaner for 10bit #24961

Merged
merged 1 commit into from Oct 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -133,9 +133,10 @@ void SiStripApvShotCleaner::subtractCM(){
return;

//Subtract the median
const bool is10bit = apvDigis[0].adc() > 255; // approximation; definitely 10bit in this case
Copy link
Contributor

Choose a reason for hiding this comment

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

Following your intentions explained in the PR description, I would expect here

const bool is10bit = apvDigis[0].adc() > 255;
for(size_t i=1; i<stripsForMedian;++i) is10bit |= apvDigis[i].adc() > 255;

Did I understand it correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but they are sorted by decreasing adc here (from https://github.com/cms-sw/cmssw/pull/24961/files#diff-af819317b5a71697a837cc86996841edL115 , to calculate the median) so the first is the largest (the implementation of this method could clearly be improved, but I wanted to keep the patch minimal).

size_t i=0;
for(;i<stripsForMedian&&apvDigis[i].adc()>CM;++i){
uint16_t adc=apvDigis[i].adc()>253?apvDigis[i].adc():(uint16_t)(apvDigis[i].adc()-CM);
const uint16_t adc = ( ( apvDigis[i].adc() > 253 ) && !is10bit ) ? apvDigis[i].adc() : (uint16_t)(apvDigis[i].adc()-CM);
apvDigis[i]=SiStripDigi(apvDigis[i].strip(),adc);
}
apvDigis.resize(i);
Expand Down