47 : tPixelDigi_(consumes(conf.getParameter<edm::
InputTag>(
"src"))),
48 tPutPixelDigi_(produces<edm::DetSetVector<
PixelDigi>>()),
49 nrows_(conf.getParameter<int32_t>(
"nrows")),
50 ncols_(conf.getParameter<int32_t>(
"ncols")),
51 nrocs_(conf.getParameter<int32_t>(
"nrocs")),
52 iters_(conf.getParameter<int32_t>(
"iters")),
53 fakeAdc_(conf.getParameter<uint32_t>(
"fakeAdc")) {
58 <<
" number of columns not divisible with"
59 <<
" number of ROCs\n";
66 <<
" too many columns per ROC"
67 <<
" or too many iterations set\n"
68 <<
" Ncol/Nrocs+2*iters should not be"
69 <<
" more than " <<
sizeof(
uint64_t) * 8 <<
"\n";
72 std::vector<int32_t> k1(conf.
getParameter<std::vector<int32_t>>(
"kernel1"));
73 std::vector<int32_t>
k2(conf.
getParameter<std::vector<int32_t>>(
"kernel2"));
79 for (
int j = 0;
j <
w;
j++) {
96 desc.
add<int32_t>(
"nrows", 160);
97 desc.
add<int32_t>(
"ncols", 416);
98 desc.
add<int32_t>(
"nrocs", 8);
99 desc.
add<int32_t>(
"iters", 1);
100 desc.
add<std::vector<int32_t>>(
"kernel1", {7, 7, 7});
101 desc.
add<std::vector<int32_t>>(
"kernel2", {2, 7, 2});
102 desc.
add<uint32_t>(
"fakeAdc", 100);
110 auto outputDigis = std::make_unique<edm::DetSetVector<PixelDigi>>();
113 const int arrSize =
nrocs_ * rocSize;
119 for (
auto const& ds : inputDigi) {
120 auto rawId = ds.detId();
122 detDigis = &(outputDigis->find_or_insert(rawId));
124 memset(imap, 0, arrSize *
sizeof(
uint64_t));
125 for (
auto const& di : ds) {
129 if (r > 0 && c < iters_) {
131 }
else if (++r < nrocs_ && c >=
ncols_r_ - iters_) {
134 (*detDigis).data.emplace_back(di.row(), di.column(), di.adc(), 0);
137 std::memcpy(map1, imap, arrSize *
sizeof(
uint64_t));
138 memset(map2, 0, arrSize *
sizeof(
uint64_t));
146 for (
int row = 0; row <
nrows_; row++, i++, o++) {
151 for (
int col = 0; col < ncols_r_; col++, (*i) >>= 1, (*o) >>= 1) {
169 unsigned char valid = 0;
170 unsigned char const validMask = (1 <<
ksize_) - 1;
175 valid = (valid << 1) | (*i[ii] != 0);
180 for (
int row = 0; row <
nrows_; row++, o++) {
181 if ((valid & validMask) != 0) {
186 v ^= (kernel[
ii] <<
jj);
198 valid = (valid << 1) | (*i[ksize_ - 1] != 0);
202 valid = (valid << 1) | (*i[
ii] != 0);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
std::vector< uint64_t > kernel2_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::EventSetup & c
SiPixelDigiMorphing(const edm::ParameterSet &conf)
void produce(edm::Event &e, const edm::EventSetup &c) override
~SiPixelDigiMorphing() override=default
#define DEFINE_FWK_MODULE(type)
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > tPutPixelDigi_
bool get(ProductID const &oid, Handle< PROD > &result) const
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned long long uint64_t
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< uint64_t > kernel1_
void morph(uint64_t *const imap, uint64_t *omap, uint64_t *const kernel, MorphOption op) const