Added flag for events with an ADC value higher than 14000. - #200
Added flag for events with an ADC value higher than 14000.#200nlopez-code wants to merge 9 commits into
Conversation
…n unit test as well
fhagemann
left a comment
There was a problem hiding this comment.
This is one of the most beautifully written PRs I've ever seen.
I have one tiny comment on your code, and will follow with instructions how to get the unit tests to pass :)
|
If you look at the test logs, you can see the following: which states that something in the end-to-end tests for detectors 406-1 and 542-1 failed. You can run those tests on your local machine by running Which in my case yields the following output: Essentially this means that, if we run Some background information: Let me know if you run into any issues tackling this, always happy to help! :) |
fhagemann
left a comment
There was a problem hiding this comment.
Also, looks like my comment didn't go through ^^
| if (g_Verbosity >= c_Warning) { | ||
| cout << m_XmlTag << ": Warning: High ADC value " << SH->GetADCUnits() << " for read-out element " << R << endl; | ||
| } | ||
| Event->SetHighADC_QualityFlag("High ADC value " + to_string(SH->GetADCUnits()) + " for " + R.ToString().Data()); |
There was a problem hiding this comment.
Tiny comment when composing the QualityFlag Text: you might want to convert the ADC value to an (unsigned) int to avoid a lot of unnecessary zeros in the message:
| Event->SetHighADC_QualityFlag("High ADC value " + to_string(SH->GetADCUnits()) + " for " + R.ToString().Data()); | |
| if (g_Verbosity >= c_Warning) { | |
| cout << m_XmlTag << ": Warning: High ADC value " << (int) SH->GetADCUnits() << " for read-out element " << R << endl; | |
| } | |
| Event->SetHighADC_QualityFlag("High ADC value " + to_string((int) SH->GetADCUnits()) + " for " + R.ToString().Data()); |
This will be resolved by itself once we tackle #176, but we can hack this here for now ;)
Before:
QA HighADC (High ADC value 15804.000000 for Detector: 0, side: LV, strip: 20) (High ADC value 16013.000000 for Detector: 0, side: LV, strip: 21) (High ADC value 16006.000000 for Detector: 0, side: LV, strip: 22) (High ADC value 15449.000000 for Detector: 0, side: LV, strip: 23) (High ADC value 15058.000000 for Detector: 0, side: HV, strip: 53) (High ADC value 16015.000000 for Detector: 0, side: HV, strip: 54) (High ADC value 16038.000000 for Detector: 0, side: HV, strip: 55)
After:
QA HighADC (High ADC value 15804 for Detector: 0, side: LV, strip: 20) (High ADC value 16013 for Detector: 0, side: LV, strip: 21) (High ADC value 16006 for Detector: 0, side: LV, strip: 22) (High ADC value 15449 for Detector: 0, side: LV, strip: 23) (High ADC value 15058 for Detector: 0, side: HV, strip: 53) (High ADC value 16015 for Detector: 0, side: HV, strip: 54) (High ADC value 16038 for Detector: 0, side: HV, strip: 55)
ckierans
left a comment
There was a problem hiding this comment.
Nice work on your first Nuclearizer PR, @nlopez-code !!!
That said, I think you overdid the flags a bit :). The QualityFlag in MReadOutAssembly is probably sufficient, where as the flag in the MStripHit class is probably too much, at least in my interpretation of the purpose of those flags.
We also need to decide if we should do anything with the ADC values if they are measured >14000. Should we treat 14000 ADC truly like a software overflow bin and reassign the high ADC values to be 14000, or do we just keep it as is and treat these events with caution to be potentially filtered out in revan/mimrec? This probably needs to be investigated further with some high energy data to determine the best approach, but that of course can be a TODO.
Perhaps for now just add a comment in the code when you raise the High ADC warning that we might want to revisit how we handle the high ADC values.
| //! Set whether the strip has a high ADC value (close to the ADC saturation limit) | ||
| void HasHighADC(bool HighADC) { m_HasHighADC = HighADC; } | ||
| //! Return whether the strip has a high ADC value (close to the ADC saturation limit) | ||
| bool HasHighADC() const { return m_HasHighADC; } |
There was a problem hiding this comment.
I'm wondering if it's appropriate to be defining a StripHit flag for HighADC?
StripHits with the > HighADC value should be treated with caution, but I think the HighADC quality flag for an event, as you have defined it in MReadoutAssembly, might be enough?
The flags here for StripHits, such as HasFastTiming, IsGuardRing, etc, are derived from the raw data and describe the type of strip hit but not necessarily the quality of the strip hit. I think the HighADC flag is most similar to the SlowThresholdCut (other then us not removing the strip hit), so we should more closely follow that example. And if that's the case, then I think you did a lot more work then you needed to.
| // 0b111u | ||
|
|
||
| unsigned int Flags = 0b000u; | ||
| // Currently, 4 bits: |
There was a problem hiding this comment.
This gives me pause. I don't think we want HighADC to be looped in with these higher-level flags.
…le to restore from the previous commit.
|
Is this missing the updated |
| if (SH->GetADCUnits() > m_HighADCThreshold) { | ||
| SH->HasHighADC(true); | ||
| if (g_Verbosity >= c_Warning) { | ||
| cout << m_XmlTag << ": Warning: High ADC value " << SH->GetADCUnits() << " for read-out element " << R << endl; |
There was a problem hiding this comment.
You might also want to add the (int) in this line:
| cout << m_XmlTag << ": Warning: High ADC value " << SH->GetADCUnits() << " for read-out element " << R << endl; | |
| cout << m_XmlTag << ": Warning: High ADC value " << (int) SH->GetADCUnits() << " for read-out element " << R << endl; |
| // Flag strip hits whose ADC value is close to the ADC saturation limit, since their | ||
| // calibrated energy is not trustworthy. The hit is kept, it is only marked. | ||
| if (SH->GetADCUnits() > m_HighADCThreshold) { | ||
| SH->HasHighADC(true); |
There was a problem hiding this comment.
This should be Event->HasHighADC(true);?
There was a problem hiding this comment.
Edit: Actually, this line can completely be removed (the StripHit has no m_HasHighADC anymore), as Event->SetHighADC_QualityFlag later in the code takes care of that
| SH->HasHighADC(true); |
…his was supposed to be a beautifully written PR
fhagemann
left a comment
There was a problem hiding this comment.
Unit tests pass, looks good to me! :)

Included in unit test as well
( #40 )