Skip to content

Commit 5e753c6

Browse files
authored
[MCH] Change digit ADC format from ulong to uint (#5809)
1 parent 8ea4ea2 commit 5e753c6

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

DataFormats/Detectors/MUON/MCH/include/DataFormatsMCH/Digit.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Digit
3030
public:
3131
Digit() = default;
3232

33-
Digit(int detid, int pad, unsigned long adc, int32_t time, uint16_t nSamples = 1);
33+
Digit(int detid, int pad, uint32_t adc, int32_t time, uint16_t nSamples = 1);
3434
~Digit() = default;
3535

3636
bool operator==(const Digit&) const;
@@ -50,17 +50,17 @@ class Digit
5050
int getPadID() const { return mPadID; }
5151
void setPadID(int padID) { mPadID = padID; }
5252

53-
unsigned long getADC() const { return mADC; }
54-
void setADC(unsigned long adc) { mADC = adc; }
53+
uint32_t getADC() const { return mADC; }
54+
void setADC(uint32_t adc) { mADC = adc; }
5555

5656
private:
5757
int32_t mTFtime; /// time since the beginning of the time frame, in bunch crossing units
5858
uint16_t mNofSamples; /// number of samples in the signal
5959
int mDetID; /// ID of the Detection Element to which the digit corresponds to
6060
int mPadID; /// PadIndex to which the digit corresponds to
61-
unsigned long mADC; /// Amplitude of signal
61+
uint32_t mADC; /// Amplitude of signal
6262

63-
ClassDefNV(Digit, 2);
63+
ClassDefNV(Digit, 3);
6464
}; //class Digit
6565

6666
} //namespace mch

DataFormats/Detectors/MUON/MCH/src/Digit.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bool closeEnough(double x, double y, double eps = 1E-6)
1919
return std::fabs(x - y) <= eps * std::max(1.0, std::max(std::fabs(x), std::fabs(y)));
2020
}
2121

22-
Digit::Digit(int detid, int pad, unsigned long adc, int32_t time, uint16_t nSamples)
22+
Digit::Digit(int detid, int pad, uint32_t adc, int32_t time, uint16_t nSamples)
2323
: mTFtime(time), mNofSamples(nSamples), mDetID(detid), mPadID(pad), mADC(adc)
2424
{
2525
setSaturated(false);

Detectors/MUON/MCH/Clustering/src/ClusterFinderOriginal.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "MCHClustering/ClusterFinderOriginal.h"
2020

2121
#include <algorithm>
22+
#include <cstring>
2223
#include <iterator>
2324
#include <limits>
2425
#include <numeric>
@@ -174,7 +175,9 @@ void ClusterFinderOriginal::resetPreCluster(gsl::span<const Digit>& digits)
174175
double y = mSegmentation->padPositionY(padID);
175176
double dx = mSegmentation->padSizeX(padID) / 2.;
176177
double dy = mSegmentation->padSizeY(padID) / 2.;
177-
double charge = static_cast<double>(digit.getADC()) / static_cast<double>(std::numeric_limits<unsigned long>::max()) * 1024;
178+
uint32_t adc = digit.getADC();
179+
float charge(0.);
180+
std::memcpy(&charge, &adc, sizeof(adc));
178181
bool isSaturated = digit.isSaturated();
179182
int plane = mSegmentation->isBendingPad(padID) ? 0 : 1;
180183

Detectors/MUON/MCH/Simulation/include/MCHSimulation/Response.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Response
3838
float etocharge(float edepos);
3939
double chargePadfraction(float xmin, float xmax, float ymin, float ymax);
4040
double chargefrac1d(float min, float max, double k2, double sqrtk3, double k4);
41-
unsigned long response(unsigned long adc);
41+
uint32_t response(uint32_t adc);
4242
float getAnod(float x);
4343
float chargeCorr();
4444
bool aboveThreshold(float charge) { return charge > mChargeThreshold; };

Detectors/MUON/MCH/Simulation/src/Digitizer.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ int Digitizer::processHit(const Hit& hit, int detID, int event_time)
173173
} else {
174174
q *= chargenon;
175175
}
176-
auto signal = (unsigned long)q * resp.getInverseChargeThreshold();
176+
auto signal = (uint32_t)q * resp.getInverseChargeThreshold();
177177
if (signal > 0) {
178178
/// FIXME: which time definition is used when calling this function?
179179
digits.emplace_back(detID, padid, signal, static_cast<int32_t>(time));
@@ -238,7 +238,7 @@ void Digitizer::mergeDigits()
238238
while (j < indices.size() && (getGlobalDigit(sortedDigits(i).getDetID(), sortedDigits(i).getPadID())) == (getGlobalDigit(sortedDigits(j).getDetID(), sortedDigits(j).getPadID())) && (std::fabs(sortedDigits(i).getTime() - sortedDigits(j).getTime()) < mDeltat)) {
239239
j++;
240240
}
241-
unsigned long adc{0};
241+
uint32_t adc{0};
242242
float padc{0};
243243
Response& resp = response(isStation1(sortedDigits(i).getDetID()));
244244

Detectors/MUON/MCH/Simulation/src/Response.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ double Response::chargefrac1d(float min, float max, double k2, double sqrtk3, do
105105
return 2. * k4 * (TMath::ATan(u2) - TMath::ATan(u1));
106106
}
107107
//______________________________________________________________________
108-
unsigned long Response::response(unsigned long adc)
108+
uint32_t Response::response(uint32_t adc)
109109
{
110110
//DecalibrateTrackerDigit functionality from
111111
//AliMuonDigitizerV3 in aliroot

0 commit comments

Comments
 (0)