5#ifndef MUONCSC_CNVTOOL_CSCRODREADOUT_H
6#define MUONCSC_CNVTOOL_CSCRODREADOUT_H
25 CscRODReadOut(
double startTime,
double signalWidth, uint16_t numIntegration);
46 uint32_t
getSourceID(uint16_t side, uint16_t rodId)
const;
47 void encodeFragments(
const std::vector<uint16_t>& amplitude, std::vector<uint32_t>& v)
const;
53 void setParams(
double timeOffset,
double signalWidth);
56 bool isDPU(
const uint32_t fragment)
const;
57 bool discard(
const uint32_t fragment)
const;
59 bool isAddress(
const uint32_t fragment)
const;
62 void decodeSourceID(uint32_t sourceIdIDIn, uint16_t& sourceID, uint16_t& moduleType, uint16_t& subDetectorId, uint16_t& rodId)
const;
63 void decodeAmplitude(
const uint32_t fragment, uint16_t& amp1, uint16_t& amp2)
const;
71 static int findCharge(
double samplingTime,
const std::vector<uint16_t>& amplitude,
double& time) ;
98 static const uint32_t
RATE = 40;
106 void set32bits(
const uint16_t* v16, uint32_t& v32)
const;
116 uint32_t sourceIdentifier = 0;
118 return sourceIdentifier;
122 uint16_t& rodId)
const {
123 sourceID = (sourceIDIn & 0xff000000) >> 24;
124 moduleType = (sourceIDIn & 0x00ff0000) >> 16;
125 subDetectorId = (sourceIDIn & 0x0000ff00) >> 8;
126 rodId = (sourceIDIn & 0x000000ff);
130 uint32_t p = 0, v = 0;
132 uint16_t pos[] = {16, 0};
133 for (uint16_t i = 0; i < n; i++) {
134 v = (uint32_t)(*(v16 + i));
135 p = (uint32_t)(*(pos + i));
136 v32 = v32 | (v << p);
145 uint16_t amplitudeTest = (fragment >> 12);
150 uint32_t addressTest = (fragment >> 17);
155 amp2 = 0x0000FFFF & fragment;
156 amp1 = (0xFFFF0000 & fragment) >> 16;
162 int stationName = ((
address & 0x00010000) >> 16) + 50;
163 int stationEta = (((
address & 0x00001000) >> 12) == 0x0) ? -1 : 1;
164 int stationPhi = ((
address & 0x0000E000) >> 13) + 1;
166 return m_cscIdHelper->elementID(stationName, stationEta, stationPhi);
174 int wireLayer = ((
address & 0x00000600) >> 9) + 1;
175 int measuresPhi = ((
address & 0x00000100) >> 8);
179 int stationEta = (((
address & 0x00001000) >> 12) == 0x0) ? -1 : 1;
186 return m_cscIdHelper->channelID(moduleId, chamberLayer, wireLayer, measuresPhi,
strip);
194 int wireLayer = ((
address & 0x00000600) >> 9) + 1;
195 int measuresPhi = ((
address & 0x00000100) >> 8);
200 int stationEta = (((
address & 0x00001000) >> 12) == 0x0) ? -1 : 1;
204 return m_cscIdHelper->channelID(moduleId, chamberLayer, wireLayer, measuresPhi,
strip);
212 int wireLayer = ((
address & 0x00000600) >> 9) + 1;
213 int measuresPhi = ((
address & 0x00000100) >> 8);
218 int stationEta = (((
address & 0x00001000) >> 12) == 0x0) ? -1 : 1;
226 throw (std::runtime_error(
"CscRODReadOut::hashIdentifier: Unable to get identifier!"));
228 return (uint32_t)hash;
267 uint32_t nameIndex = uint32_t(name - 50);
268 uint32_t etaIndex = (
eta == -1) ? 0 : 1;
269 uint32_t phiIndex = uint32_t(
phi - 1);
270 uint32_t chamberIndex = uint32_t(chamberLayer - 0);
271 uint32_t layerIndex = uint32_t(wireLayer - 1);
272 uint32_t stripType = uint32_t(orientation);
273 uint32_t stripNumber = uint32_t(
strip - 1);
279 nameIndex << 16 | phiIndex << 13 | etaIndex << 12 | chamberIndex << 11 | layerIndex << 9 | stripType << 8 | stripNumber;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void decodeSourceID(uint32_t sourceIdIDIn, uint16_t &sourceID, uint16_t &moduleType, uint16_t &subDetectorId, uint16_t &rodId) const
static const uint32_t BODY_ADDRESS
static const uint16_t MODULE_TYPE
Identifier decodeAddress(const uint32_t address) const
bool isAddress(const uint32_t fragment) const
uint32_t numSamples() const
uint32_t m_chamberBitValue
uint32_t dpuHeader() const
void setParams(double timeOffset, double signalWidth)
static const uint32_t ROD_FOOTER_SIZE
uint32_t hashIdentifier(const uint32_t address, const Identifier &moduleId) const
bool discard(const uint32_t fragment) const
static const uint16_t SOURCE_ID
double signal_amplitude(double samplingTime) const
void set32bits(const uint16_t *v16, uint32_t &v32) const
bool isAmplitude(const uint16_t fragment) const
static const uint32_t RATE
uint32_t numberOfStrips(const uint32_t fragment) const
void encodeFragments(const std::vector< uint16_t > &litude, std::vector< uint32_t > &v) const
void set(const CscIdHelper *cscIdHelper)
static const uint32_t ROD_HEADER_SIZE
void decodeAmplitude(const uint32_t fragment, uint16_t &1, uint16_t &2) const
static const uint32_t DPU_DISCARD
static const uint32_t NUM_DPU
MHz.
static const uint32_t LATENCY
static const uint16_t BODY_AMPLITUDE
double getMaxTimeBin() const
static int findCharge(double samplingTime, const std::vector< uint16_t > &litude, double &time)
int m_NUMBER_OF_INTEGRATION
void setChamberBitVaue(uint32_t value)
uint32_t getHeaderSize() const
bool isDPU(const uint32_t fragment) const
uint32_t fragmentToAddress(const uint32_t fragment) const
static const uint32_t NUM_SAMPLES
uint32_t getSourceID(uint16_t side, uint16_t rodId) const
uint32_t dpuHeaderSize() const
double getConversion() const
uint32_t address(const Identifier &channelId, int &eta, int &phi) const
uint32_t samplingRate() const
double m_CHARGE_TO_ADC_COUNT
const CscIdHelper * m_cscIdHelper
uint32_t getFooterSize() const
double getStartTime() const
static const uint32_t DPU_HEADER_MARKER
static const uint32_t DPU_HEADER_SIZE
double signal(double z) const
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
This is a "hash" representation of an Identifier.