66 mutable std::atomic_flag lock_{ ATOMIC_FLAG_INIT };
71 const
bool usePilotBlade =
false;
78 tPixelDigi{ consumes<edm::DetSetVector<PixelDigi> >(
pset.getParameter<
edm::InputTag>(
"InputLabel")) },
79 putToken_{produces<FEDRawDataCollection>()},
80 usePhase1{
pset.getParameter<
bool> (
"UsePhase1") }
86 if(usePhase1)
edm::LogInfo(
"SiPixelRawToDigi") <<
" Use pilot blade data (FED 40)";
91 std::shared_ptr<pr::Cache>
94 while(lock_.test_and_set(std::memory_order_acquire));
95 auto rel = [](std::atomic_flag*
f) {
f->clear(std::memory_order_release); };
96 std::unique_ptr<std::atomic_flag, decltype(rel)> guard(&lock_,
rel);
98 if (recordWatcher.check( es )) {
101 previousCache_ = std::make_shared<pr::Cache>();
102 previousCache_->cablingTree_= cablingMap->
cablingTree();
103 previousCache_->frameReverter_ = std::make_unique<SiPixelFrameReverter>( es, cablingMap.
product() );
105 return previousCache_;
123 for (
auto const& di : *digiCollection) {
124 digiCounter += (di.data).
size();
125 digis[ di.id] = di.data;
131 LogDebug(
"SiPixelDigiToRaw") <<
cache->cablingTree_->version();
145 for (
auto const* fed:
cache->cablingTree_->fedList()) {
146 LogDebug(
"SiPixelDigiToRaw")<<
" PRODUCE DATA FOR FED_id: " << fed->id();
148 PixelDataFormatter::RawData::iterator fedbuffer = rawdata.find( fed->id() );
149 if( fedbuffer != rawdata.end() ) fedRawData = fedbuffer->second;
150 LogDebug(
"SiPixelDigiToRaw")<<
"size of data in fedRawData: "<<fedRawData.
size();
153 LogDebug(
"SiPixelDigiToRaw").log([&](
auto &
l) {
155 l <<
"Words/Digis this ev: "<<digiCounter<<
"(fm:"<<formatter.nDigis()<<
")/" 156 <<formatter.nWords();
166 desc.
add<
bool>(
"UsePhase1",
false);
167 desc.
addUntracked<
bool>(
"Timing",
false)->setComment(
"deprecated");
168 descriptions.
add(
"siPixelRawData", desc);
EventNumber_t event() const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final
get data, convert to raw event, attach again to Event
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
LuminosityBlockIndex index() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< SiPixelFedCablingTree > cablingTree_
size_t size() const
Lenght of the data buffer in bytes.
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &iES) const final
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
#define CMS_THREAD_GUARD(_var_)
LuminosityBlock const & getLuminosityBlock() const
std::shared_ptr< pr::Cache > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &iES) const final
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::unique_ptr< SiPixelFrameReverter > frameReverter_
std::unique_ptr< SiPixelFedCablingTree > cablingTree() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
void add(std::string const &label, ParameterSetDescription const &psetDescription)
T const * product() const