Skip to content

Commit 78f65f5

Browse files
committed
Add treatment of channel saturation to all scenarios
1 parent d19919c commit 78f65f5

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

Detectors/TPC/simulation/include/TPCSimulation/SAMPAProcessing.h

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,19 @@ template <DigitzationMode MODE>
158158
inline float SAMPAProcessing::makeSignal(float ADCcounts, const int sector, const int globalPadInSector, const float commonMode,
159159
float& pedestal, float& noise, float tot)
160160
{
161-
float signal = ADCcounts;
162161
pedestal = getPedestal(sector, globalPadInSector);
163-
float pedestalCRU = getPedestalCRU(sector, globalPadInSector);
164162
noise = getNoise(sector, globalPadInSector);
163+
164+
const float signal = ADCcounts;
165+
const float pedestalCRU = getPedestalCRU(sector, globalPadInSector);
166+
const float fullSignal = signal - commonMode + noise + pedestal + (tot > 0 ? 80 : 0); // TODO: improve to also add tail
167+
165168
switch (MODE) {
166169
case DigitzationMode::FullMode: {
167-
signal -= commonMode;
168-
signal += noise;
169-
signal += pedestal;
170-
return getADCSaturation(signal);
170+
return getADCSaturation(fullSignal);
171171
break;
172172
}
173173
case DigitzationMode::ZeroSuppression: {
174-
signal -= commonMode;
175-
signal += noise;
176-
signal += pedestal;
177-
signal += (tot > 0) ? 80 : 0; // TODO: improve to also add tail
178174
const float signalSubtractPedestal = getADCSaturation(signal) - pedestalCRU;
179175
const float zeroSuppression = getZeroSuppression(sector, globalPadInSector);
180176
if (signalSubtractPedestal < zeroSuppression) {
@@ -184,10 +180,10 @@ inline float SAMPAProcessing::makeSignal(float ADCcounts, const int sector, cons
184180
break;
185181
}
186182
case DigitzationMode::ZeroSuppressionCMCorr: {
187-
signal += noise;
188-
signal += pedestal;
189-
signal += (tot > 0) ? 80 : 0; // TODO: improve to also add tail
190-
const float signalSubtractPedestal = getADCSaturation(signal) - pedestalCRU;
183+
// TODO: this is not really a common mode correction, since the common mode is simply not treated.
184+
// Instead, the full common mode algorithm should be implemented and used
185+
const float signalNoCM = signal + noise + pedestal + (tot > 0 ? 80 : 0); // TODO: improve to also add tail
186+
const float signalSubtractPedestal = getADCSaturation(signalNoCM) - pedestalCRU;
191187
const float zeroSuppression = getZeroSuppression(sector, globalPadInSector);
192188
if (signalSubtractPedestal < zeroSuppression) {
193189
return 0.f;
@@ -196,18 +192,12 @@ inline float SAMPAProcessing::makeSignal(float ADCcounts, const int sector, cons
196192
break;
197193
}
198194
case DigitzationMode::SubtractPedestal: {
199-
signal -= commonMode;
200-
signal += noise;
201-
signal += pedestal;
202-
const float signalSubtractPedestal = getADCSaturation(signal) - pedestalCRU;
195+
const float signalSubtractPedestal = getADCSaturation(fullSignal) - pedestalCRU;
203196
return signalSubtractPedestal;
204197
break;
205198
}
206199
case DigitzationMode::NoSaturation: {
207-
signal -= commonMode;
208-
signal += noise;
209-
signal += pedestal;
210-
return signal;
200+
return fullSignal;
211201
break;
212202
}
213203
case DigitzationMode::PropagateADC: {

0 commit comments

Comments
 (0)