58 mutable std::atomic_flag
lock_ = ATOMIC_FLAG_INIT;
72 : tPixelDigi{consumes<edm::DetSetVector<PixelDigi>>(
pset.getParameter<
edm::InputTag>(
"InputLabel"))},
73 theBadPixelFEDChannelsToken{consumes<PixelFEDChannelCollection>(
pset.getParameter<
edm::InputTag>(
"InputLabel"))},
75 esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd, edm::Transition::BeginLuminosityBlock>()),
76 putToken_{produces<FEDRawDataCollection>()},
77 usePhase1{
pset.getParameter<
bool>(
"UsePhase1")} {
81 edm::LogInfo(
"SiPixelRawToDigi") <<
" Use pilot blade data (FED 40)";
87 while (
lock_.test_and_set(std::memory_order_acquire))
89 auto rel = [](std::atomic_flag*
f) {
f->clear(std::memory_order_release); };
90 std::unique_ptr<std::atomic_flag, decltype(rel)> guard(&
lock_,
rel);
113 digiCounter += (di.data).
size();
114 digis[di.id] = di.data;
117 auto cache = luminosityBlockCache(
ev.getLuminosityBlock().index());
119 LogDebug(
"SiPixelDigiToRaw") <<
cache->cablingTree_->version();
124 for (
auto const& fedChannels : *pixelFEDChannelCollectionHandle) {
126 for (
const auto& fedChannel : fedChannels) {
128 if (
cache->cablingTree_->findItem(
path) !=
nullptr) {
129 detBadChannels.push_back(fedChannel);
132 <<
" FED " << fedChannel.fed <<
" Link " << fedChannel.link <<
" for module " << fedChannels.detId()
133 <<
" marked bad, but this channel does not exist in the cabling map" << endl;
136 if (!detBadChannels.empty())
137 badChannels.insert({fedChannels.detId(), std::move(detBadChannels)});
150 formatter.formatRawData(
ev.id().event(), rawdata, digis, badChannels);
153 for (
auto const* fed :
cache->cablingTree_->fedList()) {
154 LogDebug(
"SiPixelDigiToRaw") <<
" PRODUCE DATA FOR FED_id: " << fed->id();
156 PixelDataFormatter::RawData::iterator fedbuffer = rawdata.find(fed->id());
157 if (fedbuffer != rawdata.end())
162 LogDebug(
"SiPixelDigiToRaw").log([&](
auto&
l) {
163 l <<
"Words/Digis this ev: " << digiCounter <<
"(fm:" <<
formatter.nDigis() <<
")/" <<
formatter.nWords();
172 desc.add<
bool>(
"UsePhase1",
false);
173 descriptions.
add(
"siPixelRawData",
desc);
SiPixelDigiToRaw(const edm::ParameterSet &)
ctor
std::unique_ptr< SiPixelFedCablingTree > cablingTree() const
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< SiPixelFedCablingTree > cablingTree_
const edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
Log< level::Error, false > LogError
const edm::EDPutTokenT< FEDRawDataCollection > putToken_
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &iES) const final
T const * product() const
#define CMS_THREAD_GUARD(_var_)
std::shared_ptr< pr::Cache > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &iES) const final
const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cabelingMapToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const edm::EDGetTokenT< PixelFEDChannelCollection > theBadPixelFEDChannelsToken
std::unique_ptr< SiPixelFrameReverter > frameReverter_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final
get data, convert to raw event, attach again to Event
Log< level::Info, false > LogInfo
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESWatcher< SiPixelFedCablingMapRcd > recordWatcher
bool check(const edm::EventSetup &iSetup)
std::shared_ptr< pr::Cache > previousCache_