5#ifndef MUONCSC_CNVTOOL_CSCRODREADOUTV1_H
6#define MUONCSC_CNVTOOL_CSCRODREADOUTV1_H
22 CscRODReadOutV1(
double startTime, uint16_t samplingTime,
double signalWidth, uint16_t numIntegration);
49 void encodeFragments(
const std::vector<uint16_t>& amplitude, std::vector<uint32_t>& v)
const;
54 void setParams(
double timeOffset,
double samplingTime,
double signalWidth);
59 bool isDPU(
const uint32_t fragment)
const;
60 bool discard(
const uint32_t fragment)
const;
62 bool isAddress(
const uint32_t fragment)
const;
75 int findCharge(
const std::vector<uint16_t>& amplitude,
double& time);
120 static const uint32_t
RATE = 40;
128 void set32bits(
const uint16_t* v16, uint32_t& v32)
const;
141 uint32_t sourceIdentifier = 0;
143 return sourceIdentifier;
154 uint32_t p = 0, v = 0;
156 uint16_t pos[] = {0, 16};
157 for (uint16_t i = 0; i < n; i++) {
158 v = (uint32_t)(*(v16 + i));
159 p = (uint32_t)(*(pos + i));
160 v32 = v32 | (v << p);
169 uint16_t amplitudeTest = (fragment >> 12);
174 uint32_t addressTest = (fragment >> 17);
179 m_amp1 = 0x0000FFFF & fragment;
180 m_amp2 = (0xFFFF0000 & fragment) >> 16;
184 uint32_t
address = 0x0001FFFF & fragment;
186 int stationName = ((
address & 0x00010000) >> 16) + 50;
187 int stationEta = (((
address & 0x00001000) >> 12) == 0x0) ? -1 : 1;
188 int stationPhi = ((
address & 0x0000E000) >> 13) + 1;
189 int chamberLayer = ((
address & 0x00000800) >> 11) + 1;
190 int wireLayer = ((
address & 0x00000600) >> 9) + 1;
191 int measuresPhi = ((
address & 0x00000100) >> 8);
195 uint32_t nameIndex = uint32_t(stationName - 50);
196 uint32_t etaIndex = (stationEta == -1) ? 0 : 1;
197 uint32_t phiIndex = uint32_t(stationPhi - 1);
198 uint32_t chamberIndex = uint32_t(chamberLayer - 0);
199 uint32_t layerIndex = uint32_t(wireLayer - 1);
200 uint32_t stripType = uint32_t(measuresPhi);
201 uint32_t stripNumber = uint32_t(
strip - 1);
204 m_address = nameIndex << 16 | phiIndex << 13 | etaIndex << 12 | chamberIndex << 11 | layerIndex << 9 | stripType << 8 | stripNumber;
208 int stationName = ((
m_address & 0x00010000) >> 16) + 50;
209 int stationEta = (((
m_address & 0x00001000) >> 12) == 0x0) ? -1 : 1;
210 int stationPhi = ((
m_address & 0x0000E000) >> 13) + 1;
212 return m_cscHelper->elementID(stationName, stationEta, stationPhi);
218 int chamberLayer = ((
m_address & 0x00000800) >> 11) + 0;
219 int wireLayer = ((
m_address & 0x00000600) >> 9) + 0;
220 int measuresPhi = ((
m_address & 0x00000100) >> 8);
222 return m_cscHelper->channelID(moduleId, chamberLayer, wireLayer, measuresPhi,
strip);
226 int chamberLayer = ((
m_address & 0x00000800) >> 11) + 0;
227 int wireLayer = ((
m_address & 0x00000600) >> 9) + 1;
228 int measuresPhi = ((
m_address & 0x00000100) >> 8);
230 return m_cscHelper->channelID(moduleId, chamberLayer, wireLayer, measuresPhi,
strip);
234 int chamberLayer = ((
m_address & 0x00000800) >> 11) + 0;
235 int wireLayer = ((
m_address & 0x00000600) >> 9) + 1;
236 int measuresPhi = ((
m_address & 0x00000100) >> 8);
242 return (uint32_t)hash;
271 int chamberLayer =
m_cscHelper->chamberLayer(channelId);
273 int orientation =
m_cscHelper->measuresPhi(channelId);
277 uint32_t nameIndex = uint32_t(name - 50);
278 uint32_t etaIndex = (
eta == -1) ? 0 : 1;
279 uint32_t phiIndex = uint32_t(
phi - 1);
280 uint32_t chamberIndex = uint32_t(chamberLayer - 0);
281 uint32_t layerIndex = uint32_t(wireLayer - 1);
282 uint32_t stripType = uint32_t(orientation);
283 uint32_t stripNumber = uint32_t(
strip - 1);
287 nameIndex << 16 | phiIndex << 13 | etaIndex << 12 | chamberIndex << 11 | layerIndex << 9 | stripType << 8 | stripNumber;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
uint32_t m_TRIGGER_INFO[3]
int m_NUMBER_OF_INTEGRATION
double signal_amplitude(double samplingTime) const
void setAddress(const uint32_t address)
double m_CHARGE_TO_ADC_COUNT
int findCharge(const std::vector< uint16_t > &litude, double &time)
bool isAmplitude(const uint16_t fragment) const
static const uint32_t DPU_HEADER_MARKER
void triggerInfo(uint32_t *trigger)
static const uint32_t RATE
uint32_t getSourceID(uint16_t side, uint16_t rodId)
uint16_t subDetectorId() const
void encodeFragments(const std::vector< uint16_t > &litude, std::vector< uint32_t > &v) const
bool discard(const uint32_t fragment) const
uint32_t numberOfStrips(const uint32_t fragment)
void decodeAmplitude(const uint32_t fragment)
static const uint32_t NUM_DPU
MHz.
uint16_t sourceID() const
uint32_t hashIdentifier(const Identifier &moduleId)
void set(const CscIdHelper *cscHelper)
static const uint32_t ROD_FOOTER_SIZE
uint32_t address(const Identifier &channelId, int &eta, int &phi) const
double signal(double z) const
static const uint32_t LATENCY
static const uint16_t SOURCE_ID
bool isAddress(const uint32_t fragment) const
bool isDPU(const uint32_t fragment) const
static const uint16_t BODY_AMPLITUDE
static const uint32_t ROD_HEADER_SIZE
static const uint32_t DPU_HEADER_SIZE
static const uint32_t DPU_DISCARD
Identifier decodeAddress()
static const uint32_t NUM_SAMPLES
void decodeSourceID(uint32_t sourceId)
void set32bits(const uint16_t *v16, uint32_t &v32) const
static const uint32_t BODY_ADDRESS
uint16_t moduleType() const
~CscRODReadOutV1()=default
static const uint16_t MODULE_TYPE
void setParams(double timeOffset, double samplingTime, double signalWidth)
void setSamplingTime(double time)
const CscIdHelper * m_cscHelper
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
This is a "hash" representation of an Identifier.