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;
44 std::vector<DSVRawDigis::const_iterator> lFedScopeDigis;
50 bool hasBeenProcessed =
false;
52 for (; inputChannel != endChannels; ++inputChannel) {
57 const uint32_t lFedIndex = inputChannel->detId();
61 if (lPreviousFedId == 0) {
62 lPreviousFedId =
fedId;
69 edm::LogWarning(
"SiStripSpyDigiConverter") <<
" FED ID: " << fedId <<
", channel: " << fedCh << std::endl
79 if (fedId == lPreviousFedId) {
80 if (hasBeenProcessed) hasBeenProcessed =
false;
82 if (fedId != lPreviousFedId) {
84 discardDigisWithAPVAddrErr,
91 lPreviousFedId =
fedId;
92 hasBeenProcessed =
true;
94 lFedScopeDigis.push_back(inputChannel);
103 if (!hasBeenProcessed) {
105 discardDigisWithAPVAddrErr,
115 return std::unique_ptr<DSVRawDigis>(
new DSVRawDigis(outputData,
true) );
121 const bool discardDigisWithAPVAddrErr,
122 std::vector<uint32_t> * pAPVAddresses,
123 std::vector<DetSetRawDigis> & outputData,
124 std::vector<uint16_t> & aAddrVec,
125 std::vector<uint16_t> & aHeaderBitVec,
126 std::vector<DSVRawDigis::const_iterator> & aFedScopeDigis
132 if (pAPVAddresses) (*pAPVAddresses)[aPreviousFedId] = lMaj;
135 std::vector<DSVRawDigis::const_iterator>::iterator lIter;
136 unsigned int lCh = 0;
137 for (lIter = aFedScopeDigis.begin(); lIter != aFedScopeDigis.end(); ++lIter,++lCh) {
142 if ( discardDigisWithAPVAddrErr &&
143 aAddrVec[2*lCh] != lMaj &&
144 aAddrVec[2*lCh+1] != lMaj ) {
151 if (iDigi == endOfChannel) {
159 if(payloadEnd-iDigi >= endOfChannel-iDigi)
continue;
164 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
165 outputDetSetData.resize(STRIPS_PER_FEDCH);
166 std::vector<SiStripRawDigi>::iterator outputBegin = outputDetSetData.begin();
167 std::copy(payloadBegin, payloadEnd, outputBegin);
171 aFedScopeDigis.clear();
173 aHeaderBitVec.clear();
188 std::vector<DetSetRawDigis> outputData;
189 outputData.reserve(inputPayloadDigis->
size());
193 const std::vector<SiStripRawDigi>& inputDetSetData = inputChannel->data;
196 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
199 for (uint16_t readoutOrderStripIndex = 0; readoutOrderStripIndex < inputDetSetData.size(); ++readoutOrderStripIndex) {
201 outputDetSetData.at(physicalOrderStripIndex) = inputDetSetData.at(readoutOrderStripIndex);
206 return std::unique_ptr<DSVRawDigis>(
new DSVRawDigis(outputData,
true) );
209 std::unique_ptr<SpyDigiConverter::DSVRawDigis>
218 auto iFed = cabling.
fedIds().begin();
219 auto endFeds = cabling.
fedIds().end();
220 for (; iFed != endFeds; ++iFed) {
223 auto iConn = conns.begin();
224 auto endConns = conns.end();
225 for (; iConn != endConns; ++iConn) {
227 if (!iConn->isConnected())
continue;
233 if (iDetSet == inputPhysicalOrderChannelDigis->
end()) {
246 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.
std::auto_ptr< edm::DetSetVector< T > > createDetSetVector()
static const Frame extractFrameInfo(const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
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< DSVRawDigis::const_iterator > &aFedScopeDigis)
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
iterator begin()
Return an iterator to the first DetSet.
static const uint16_t FED_ID_MAX
collection_type::const_iterator const_iterator
static std::string print(const Frame &aFrame, std::string aErr)
collection_type::const_iterator const_iterator