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) {
163 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
164 outputDetSetData.resize(STRIPS_PER_FEDCH);
165 std::vector<SiStripRawDigi>::iterator outputBegin = outputDetSetData.begin();
166 std::copy(payloadBegin, payloadEnd, outputBegin);
170 aFedScopeDigis.clear();
172 aHeaderBitVec.clear();
187 std::vector<DetSetRawDigis> outputData;
188 outputData.reserve(inputPayloadDigis->
size());
192 const std::vector<SiStripRawDigi>& inputDetSetData = inputChannel->data;
195 std::vector<SiStripRawDigi>& outputDetSetData = outputData.back().data;
198 for (uint16_t readoutOrderStripIndex = 0; readoutOrderStripIndex < inputDetSetData.size(); ++readoutOrderStripIndex) {
200 outputDetSetData.at(physicalOrderStripIndex) = inputDetSetData.at(readoutOrderStripIndex);
205 return std::unique_ptr<DSVRawDigis>(
new DSVRawDigis(outputData,
true) );
208 std::unique_ptr<SpyDigiConverter::DSVRawDigis>
217 auto iFed = cabling.
fedIds().begin();
218 auto endFeds = cabling.
fedIds().end();
219 for (; iFed != endFeds; ++iFed) {
222 auto iConn = conns.begin();
223 auto endConns = conns.end();
224 for (; iConn != endConns; ++iConn) {
226 if (!iConn->isConnected())
continue;
232 if (iDetSet == inputPhysicalOrderChannelDigis->
end()) {
245 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 uint32_t fedIndex(const uint16_t &fed_id, const uint16_t &fed_ch)
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.
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