41 Registry(uint32_t aDetid, uint16_t firstStrip,
size_t indexInVector, uint16_t numberOfDigis)
75 event.getByToken(
token_, buffers);
78 std::vector<Registry> proc_work_registry;
79 std::vector<Phase2TrackerDigi> proc_work_digis;
81 size_t reserve_count = 0;
82 size_t reserve_digis = 0;
85 if (fed.
size() != 0) {
91 if (
buffer.channel(ichan).length() > 0) {
101 proc_work_registry.reserve(2 * reserve_count);
102 proc_work_digis.reserve(reserve_digis);
107 if (fed.
size() != 0) {
112 std::ostringstream
ss;
113 ss <<
" -------------------------------------------- " << endl;
114 ss <<
" buffer debug ------------------------------- " << endl;
115 ss <<
" -------------------------------------------- " << endl;
116 ss <<
" buffer size : " <<
buffer.bufferSize() << endl;
118 ss <<
" -------------------------------------------- " << endl;
119 ss <<
" tracker header debug ------------------------" << endl;
120 ss <<
" -------------------------------------------- " << endl;
121 LogTrace(
"Phase2TrackerDigiProducer") <<
ss.str();
127 ss <<
" Mode : " << hex << setw(2) << tr_header.
getDebugMode() << endl;
129 ss <<
" Readout : " << hex << setw(2) << tr_header.
getReadoutMode() << endl;
130 ss <<
" Condition Data : " << (tr_header.
getConditionData() ?
"Present" :
"Absent") <<
"\n";
131 ss <<
" Data Type : " << (tr_header.
getDataType() ?
"Real" :
"Fake") <<
"\n";
134 for (
int i = 15;
i >= 0;
i--) {
143 ss <<
" CBC stat : ";
148 LogTrace(
"Phase2TrackerDigiProducer") <<
ss.str();
151 ss <<
" -------------------------------------------- " << endl;
152 ss <<
" Payload ----------------------------------- " << endl;
153 ss <<
" -------------------------------------------- " << endl;
161 if (channel.
length() > 0) {
164 uint32_t detid =
mod.getDetid();
166 ss <<
dec <<
" id from cabling : " << detid << endl;
167 ss <<
dec <<
" reading channel : " << icbc <<
" on FE " << ife;
172 std::vector<Phase2TrackerDigi> stripsTop;
173 std::vector<Phase2TrackerDigi> stripsBottom;
185 stripsBottom.push_back(
200 LogTrace(
"Phase2TrackerDigiProducer") <<
ss.str();
207 proc_work_registry.emplace_back(
208 detid + 1,
STRIPS_PER_CBC * icbc / 2, proc_work_digis.size(), stripsTop.size());
209 proc_work_digis.insert(proc_work_digis.end(), stripsTop.begin(), stripsTop.end());
210 proc_work_registry.emplace_back(
211 detid + 2,
STRIPS_PER_CBC * icbc / 2, proc_work_digis.size(), stripsBottom.size());
212 proc_work_digis.insert(proc_work_digis.end(), stripsBottom.begin(), stripsBottom.end());
221 std::sort(proc_work_registry.begin(), proc_work_registry.end());
222 std::vector<edm::DetSet<Phase2TrackerDigi>> sorted_and_merged;
224 std::vector<Registry>::iterator
it = proc_work_registry.begin(), it2 =
it + 1, end = proc_work_registry.end();
227 std::vector<Phase2TrackerDigi>& digis = sorted_and_merged.back().data;
229 size_t len =
it->length;
230 for (it2 =
it + 1; (it2 != end) && (it2->detid ==
it->detid); ++it2) {
236 for (it2 =
it + 0; (it2 != end) && (it2->detid ==
it->detid); ++it2) {
237 digis.insert(digis.end(), &proc_work_digis[it2->index], &proc_work_digis[it2->index + it2->length]);
241 event.emplace(
putToken_, sorted_and_merged,
true);
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
uint8_t stripIndex() const
uint32_t detid
public data members
size_t size() const
Lenght of the data buffer in bytes.
static const uint16_t CMS_FED_ID_MAX
Phase2Tracker::Phase2TrackerDigiProducer Phase2TrackerDigiProducer
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static const int MAX_CBC_PER_FE
const edm::EDGetTokenT< FEDRawDataCollection > token_
#define DEFINE_FWK_MODULE(type)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Phase2TrackerDigiProducer(const edm::ParameterSet &pset)
constructor
~Phase2TrackerDigiProducer() override=default
default constructor
const edm::EDPutTokenT< edm::DetSetVector< Phase2TrackerDigi > > putToken_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static const int STRIPS_PER_CBC
const edm::ESGetToken< Phase2TrackerCabling, Phase2TrackerCablingRcd > ph2CablingESToken_
static const uint16_t FED_ID_MIN
T mod(const T &a, const T &b)
static const int MAX_FE_PER_FED
__host__ __device__ fedId_t fedIndex(fedId_t fed)
bool operator<(const Registry &other) const
< operator to sort registries
static const int STRIPS_PADDING
Registry(uint32_t aDetid, uint16_t firstStrip, size_t indexInVector, uint16_t numberOfDigis)
constructor