25 std::vector<uint32_t>* pAPVAddresses,
26 const bool discardDigisWithAPVAddrErr,
28 const uint16_t expectedPos) {
30 std::vector<DetSetRawDigis> outputData;
31 outputData.reserve(inputScopeDigis->
size());
35 std::vector<uint16_t> lAddrVec;
37 uint16_t lPreviousFedId = 0;
38 std::vector<uint16_t> lHeaderBitVec;
40 std::vector<uint16_t> lTrailBitVec;
44 std::vector<DSVRawDigis::const_iterator> lFedScopeDigis;
50 bool hasBeenProcessed =
false;
52 for (; inputChannel != endChannels; ++inputChannel) {
53 const uint32_t lFedIndex = inputChannel->detId();
54 const uint16_t
fedId =
static_cast<uint16_t
>((lFedIndex >> 16) & 0xFFFF);
59 if (lPreviousFedId == 0) {
60 lPreviousFedId =
fedId;
75 if (fedId == lPreviousFedId) {
77 hasBeenProcessed =
false;
79 if (fedId != lPreviousFedId) {
81 discardDigisWithAPVAddrErr,
88 lPreviousFedId =
fedId;
89 hasBeenProcessed =
true;
92 lFedScopeDigis.push_back(inputChannel);
101 if (!hasBeenProcessed) {
103 discardDigisWithAPVAddrErr,
113 return std::unique_ptr<DSVRawDigis>(
new DSVRawDigis(outputData,
true));
118 const bool discardDigisWithAPVAddrErr,
119 std::vector<uint32_t>* pAPVAddresses,
120 std::vector<DetSetRawDigis>& outputData,
121 std::vector<uint16_t>& aAddrVec,
122 std::vector<uint16_t>& aHeaderBitVec,
123 std::vector<uint16_t>& aTrailBitVec,
124 std::vector<DSVRawDigis::const_iterator>& aFedScopeDigis) {
128 (*pAPVAddresses)[aPreviousFedId] = lMaj;
131 std::vector<DSVRawDigis::const_iterator>::iterator lIter;
132 unsigned int lCh = 0;
133 for (lIter = aFedScopeDigis.begin(); lIter != aFedScopeDigis.end(); ++lIter, ++lCh) {
137 if (discardDigisWithAPVAddrErr && aAddrVec[2 * lCh] != lMaj && aAddrVec[2 * lCh + 1] != lMaj) {
144 if (iDigi == endOfChannel) {
152 if (payloadEnd - iDigi >= endOfChannel - iDigi)
158 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
159 outputDetSetData.resize(STRIPS_PER_FEDCH);
160 std::vector<SiStripRawDigi>::iterator outputBegin = outputDetSetData.begin();
161 std::copy(payloadBegin, payloadEnd, outputBegin);
164 aFedScopeDigis.clear();
166 aHeaderBitVec.clear();
167 aTrailBitVec.clear();
177 std::vector<DetSetRawDigis> outputData;
178 outputData.reserve(inputPayloadDigis->
size());
182 inputChannel != inputPayloadDigis->
end();
184 const std::vector<SiStripRawDigi>& inputDetSetData = inputChannel->data;
186 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
189 for (uint16_t readoutOrderStripIndex = 0; readoutOrderStripIndex < inputDetSetData.size();
190 ++readoutOrderStripIndex) {
191 const uint16_t physicalOrderStripIndex =
193 outputDetSetData.at(physicalOrderStripIndex) = inputDetSetData.at(readoutOrderStripIndex);
198 return std::unique_ptr<DSVRawDigis>(
new DSVRawDigis(outputData,
true));
208 auto iFed = cabling.
fedIds().begin();
209 auto endFeds = cabling.
fedIds().end();
210 for (; iFed != endFeds; ++iFed) {
213 auto iConn = conns.begin();
214 auto endConns = conns.end();
215 for (; iConn != endConns; ++iConn) {
217 if (!iConn->isConnected())
225 if (iDetSet == inputPhysicalOrderChannelDigis->
end()) {
238 for (; iDigi != endDetSetDigis; ++iDigi) {
static uint8_t physicalOrderForStripInChannel(const uint8_t readoutOrderStripIndexInChannel)
std::pair< uint8_t, uint8_t > apvAddress
static const uint16_t FED_ID_MIN
iterator find(det_id_type id)
static std::unique_ptr< DSVRawDigis > reorderDigis(const DSVRawDigis *inputPayloadDigis)
static const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
static const uint32_t invalid32_
void newChannel(const uint32_t key, const uint16_t firstItem=0)
DSVRawDigis::detset DetSetRawDigis
static const uint16_t SPY_SAMPLES_PER_CHANNEL
static std::unique_ptr< DSVRawDigis > extractPayloadDigis(const DSVRawDigis *inputScopeDigis, std::vector< uint32_t > *pAPVAddresses, const bool discardDigisWithAPVAddrErr, const sistrip::SpyUtilities::FrameQuality &aQuality, const uint16_t expectedPos)
Extract frames from the scope digis.
static const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
std::unique_ptr< edm::DetSetVector< T > > createDetSetVector()
FedsConstIterRange fedIds() const
void addItem(const T &item)
static std::unique_ptr< DSVRawDigis > mergeModuleChannels(const DSVRawDigis *inputPhysicalOrderChannelDigis, const SiStripFedCabling &cabling)
iterator end()
Return the off-the-end iterator.
size_type size() const
Return the number of contained DetSets.
static std::pair< uint16_t, uint32_t > findMajorityValue(std::vector< uint16_t > &values, const uint16_t aFedId=0)
static const uint16_t STRIPS_PER_FEDCH
edm::DetSetVector< SiStripRawDigi > DSVRawDigis
Constants and enumerated types for FED/FEC systems.
static const uint16_t invalid_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
static const uint16_t FEDCH_PER_FED
static void processFED(const uint16_t aPreviousFedId, const bool discardDigisWithAPVAddrErr, std::vector< uint32_t > *pAPVAddresses, std::vector< DetSetRawDigis > &outputData, std::vector< uint16_t > &aAddrVec, std::vector< uint16_t > &aHeaderBitVec, std::vector< uint16_t > &aTrailBitVec, std::vector< DSVRawDigis::const_iterator > &aFedScopeDigis)
iterator begin()
Return an iterator to the first DetSet.
static const uint16_t FED_ID_MAX
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator