23 std::unique_ptr<SpyDigiConverter::DSVRawDigis>
25 std::vector<uint32_t> * pAPVAddresses,
26 const bool discardDigisWithAPVAddrErr,
28 const uint16_t expectedPos)
31 std::vector<DetSetRawDigis> outputData;
32 outputData.reserve(inputScopeDigis->
size());
36 std::vector<uint16_t> lAddrVec;
38 uint16_t lPreviousFedId = 0;
39 std::vector<uint16_t> lHeaderBitVec;
41 std::vector<uint16_t> lTrailBitVec;
46 std::vector<DSVRawDigis::const_iterator> lFedScopeDigis;
52 bool hasBeenProcessed =
false;
54 for (; inputChannel != endChannels; ++inputChannel) {
56 const uint32_t lFedIndex = inputChannel->detId();
57 const uint16_t
fedId =
static_cast<uint16_t
> ((lFedIndex>>16)&0xFFFF);
65 if (lPreviousFedId == 0) {
66 lPreviousFedId =
fedId;
81 if (fedId == lPreviousFedId) {
82 if (hasBeenProcessed) hasBeenProcessed =
false;
84 if (fedId != lPreviousFedId) {
86 discardDigisWithAPVAddrErr,
94 lPreviousFedId =
fedId;
95 hasBeenProcessed =
true;
98 lFedScopeDigis.push_back(inputChannel);
107 if (!hasBeenProcessed) {
109 discardDigisWithAPVAddrErr,
120 return std::unique_ptr<DSVRawDigis>(
new DSVRawDigis(outputData,
true) );
126 const bool discardDigisWithAPVAddrErr,
127 std::vector<uint32_t> * pAPVAddresses,
128 std::vector<DetSetRawDigis> & outputData,
129 std::vector<uint16_t> & aAddrVec,
130 std::vector<uint16_t> & aHeaderBitVec,
131 std::vector<uint16_t> & aTrailBitVec,
132 std::vector<DSVRawDigis::const_iterator> & aFedScopeDigis
138 if (pAPVAddresses) (*pAPVAddresses)[aPreviousFedId] = lMaj;
141 std::vector<DSVRawDigis::const_iterator>::iterator lIter;
142 unsigned int lCh = 0;
143 for (lIter = aFedScopeDigis.begin(); lIter != aFedScopeDigis.end(); ++lIter,++lCh) {
148 if ( discardDigisWithAPVAddrErr &&
149 aAddrVec[2*lCh] != lMaj &&
150 aAddrVec[2*lCh+1] != lMaj ) {
157 if (iDigi == endOfChannel) {
165 if(payloadEnd-iDigi >= endOfChannel-iDigi)
continue;
170 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
171 outputDetSetData.resize(STRIPS_PER_FEDCH);
172 std::vector<SiStripRawDigi>::iterator outputBegin = outputDetSetData.begin();
173 std::copy(payloadBegin, payloadEnd, outputBegin);
176 aFedScopeDigis.clear();
178 aHeaderBitVec.clear();
179 aTrailBitVec.clear();
195 std::vector<DetSetRawDigis> outputData;
196 outputData.reserve(inputPayloadDigis->
size());
200 const std::vector<SiStripRawDigi>& inputDetSetData = inputChannel->data;
202 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
205 for (uint16_t readoutOrderStripIndex = 0; readoutOrderStripIndex < inputDetSetData.size(); ++readoutOrderStripIndex) {
207 outputDetSetData.at(physicalOrderStripIndex) = inputDetSetData.at(readoutOrderStripIndex);
212 return std::unique_ptr<DSVRawDigis>(
new DSVRawDigis(outputData,
true) );
215 std::unique_ptr<SpyDigiConverter::DSVRawDigis>
224 auto iFed = cabling.
fedIds().begin();
225 auto endFeds = cabling.
fedIds().end();
226 for (; iFed != endFeds; ++iFed) {
229 auto iConn = conns.begin();
230 auto endConns = conns.end();
231 for (; iConn != endConns; ++iConn) {
233 if (!iConn->isConnected())
continue;
239 if (iDetSet == inputPhysicalOrderChannelDigis->
end()) {
252 for (; iDigi != endDetSetDigis; ++iDigi) {
static uint8_t physicalOrderForStripInChannel(const uint8_t readoutOrderStripIndexInChannel)
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
std::pair< uint8_t, uint8_t > apvAddress
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