CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
SiPixelDigiToRaw Class Referencefinal
Inheritance diagram for SiPixelDigiToRaw:
edm::global::EDProducer< edm::LuminosityBlockCache< pr::Cache > > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

std::shared_ptr< pr::CacheglobalBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &iES) const final
 
void globalEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &iES) const final
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const final
 get data, convert to raw event, attach again to Event More...
 
 SiPixelDigiToRaw (const edm::ParameterSet &)
 ctor More...
 
- Public Member Functions inherited from edm::global::EDProducer< edm::LuminosityBlockCache< pr::Cache > >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcdcabelingMapToken_
 
std::atomic_flag lock_ = ATOMIC_FLAG_INIT
 
std::shared_ptr< pr::CachepreviousCache_
 
const edm::EDPutTokenT< FEDRawDataCollectionputToken_
 
edm::ESWatcher< SiPixelFedCablingMapRcdrecordWatcher
 
const edm::EDGetTokenT< PixelFEDChannelCollectiontheBadPixelFEDChannelsToken
 
const edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
 
const bool usePhase1
 
const bool usePilotBlade = false
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 48 of file SiPixelDigiToRaw.cc.

Constructor & Destructor Documentation

◆ SiPixelDigiToRaw()

SiPixelDigiToRaw::SiPixelDigiToRaw ( const edm::ParameterSet pset)
explicit

ctor

Definition at line 78 of file SiPixelDigiToRaw.cc.

79  : tPixelDigi{consumes<edm::DetSetVector<PixelDigi>>(pset.getParameter<edm::InputTag>("InputLabel"))},
80  theBadPixelFEDChannelsToken{consumes<PixelFEDChannelCollection>(pset.getParameter<edm::InputTag>("InputLabel"))},
82  esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd, edm::Transition::BeginLuminosityBlock>()),
83  putToken_{produces<FEDRawDataCollection>()},
84  usePhase1{pset.getParameter<bool>("UsePhase1")} {
85  // Define EDProduct type
86 
87  if (usePhase1)
88  edm::LogInfo("SiPixelRawToDigi") << " Use pilot blade data (FED 40)";
89 }

References muonDTDigis_cfi::pset.

Member Function Documentation

◆ fillDescriptions()

void SiPixelDigiToRaw::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 176 of file SiPixelDigiToRaw.cc.

176  {
178  desc.add<edm::InputTag>("InputLabel");
179  desc.add<bool>("UsePhase1", false);
180  desc.addUntracked<bool>("Timing", false)->setComment("deprecated");
181  descriptions.add("siPixelRawData", desc);
182 }

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

◆ globalBeginLuminosityBlock()

std::shared_ptr< pr::Cache > SiPixelDigiToRaw::globalBeginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &  iES 
) const
final

Definition at line 92 of file SiPixelDigiToRaw.cc.

93  {
94  while (lock_.test_and_set(std::memory_order_acquire))
95  ; //spin
96  auto rel = [](std::atomic_flag* f) { f->clear(std::memory_order_release); };
97  std::unique_ptr<std::atomic_flag, decltype(rel)> guard(&lock_, rel);
98 
99  if (recordWatcher.check(es)) {
100  edm::ESHandle<SiPixelFedCablingMap> cablingMap = es.getHandle(cabelingMapToken_);
101  previousCache_ = std::make_shared<pr::Cache>();
102  previousCache_->cablingTree_ = cablingMap->cablingTree();
103  previousCache_->frameReverter_ = std::make_unique<SiPixelFrameReverter>(cablingMap.product());
104  }
105  return previousCache_;
106 }

References cabelingMapToken_, SiPixelFedCablingMap::cablingTree(), edm::ESWatcher< T >::check(), f, edm::EventSetup::getHandle(), lock_, previousCache_, edm::ESHandle< T >::product(), recordWatcher, and RefreshWebPage::rel.

◆ globalEndLuminosityBlock()

void SiPixelDigiToRaw::globalEndLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &  iES 
) const
inlinefinal

Definition at line 59 of file SiPixelDigiToRaw.cc.

59 {}

◆ produce()

void SiPixelDigiToRaw::produce ( edm::StreamID  ,
edm::Event ev,
const edm::EventSetup es 
) const
finalvirtual

get data, convert to raw event, attach again to Event

Implements edm::global::EDProducerBase.

Definition at line 109 of file SiPixelDigiToRaw.cc.

109  {
110  using namespace sipixelobjects;
111 
113  ev.getByToken(tPixelDigi, digiCollection);
114 
117 
118  int digiCounter = 0;
119  for (auto const& di : *digiCollection) {
120  digiCounter += (di.data).size();
121  digis[di.id] = di.data;
122  }
123 
124  auto cache = luminosityBlockCache(ev.getLuminosityBlock().index());
125 
126  LogDebug("SiPixelDigiToRaw") << cache->cablingTree_->version();
127 
129  edm::Handle<PixelFEDChannelCollection> pixelFEDChannelCollectionHandle;
130  if (usePhase1 && ev.getByToken(theBadPixelFEDChannelsToken, pixelFEDChannelCollectionHandle)) {
131  for (auto const& fedChannels : *pixelFEDChannelCollectionHandle) {
132  PixelDataFormatter::DetBadChannels detBadChannels;
133  for (const auto& fedChannel : fedChannels) {
134  sipixelobjects::CablingPathToDetUnit path = {fedChannel.fed, fedChannel.link, 1};
135  if (cache->cablingTree_->findItem(path) != nullptr) {
136  detBadChannels.push_back(fedChannel);
137  } else {
138  edm::LogError("SiPixelDigiToRaw")
139  << " FED " << fedChannel.fed << " Link " << fedChannel.link << " for module " << fedChannels.detId()
140  << " marked bad, but this channel does not exist in the cabling map" << endl;
141  }
142  } // channels reading a module
143  if (!detBadChannels.empty())
144  badChannels.insert({fedChannels.detId(), std::move(detBadChannels)});
145  } // loop on detId-s
146  }
147 
148  //PixelDataFormatter formatter(cablingTree_.get());
149  PixelDataFormatter formatter(cache->cablingTree_.get(), usePhase1);
150 
151  formatter.passFrameReverter(cache->frameReverter_.get());
152 
153  // create product (raw data)
154  FEDRawDataCollection buffers;
155 
156  // convert data to raw
157  formatter.formatRawData(ev.id().event(), rawdata, digis, badChannels);
158 
159  // pack raw data into collection
160  for (auto const* fed : cache->cablingTree_->fedList()) {
161  LogDebug("SiPixelDigiToRaw") << " PRODUCE DATA FOR FED_id: " << fed->id();
162  FEDRawData& fedRawData = buffers.FEDData(fed->id());
163  PixelDataFormatter::RawData::iterator fedbuffer = rawdata.find(fed->id());
164  if (fedbuffer != rawdata.end())
165  fedRawData = fedbuffer->second;
166  LogDebug("SiPixelDigiToRaw") << "size of data in fedRawData: " << fedRawData.size();
167  }
168 
169  LogDebug("SiPixelDigiToRaw").log([&](auto& l) {
170  l << "Words/Digis this ev: " << digiCounter << "(fm:" << formatter.nDigis() << ")/" << formatter.nWords();
171  });
172  ev.emplace(putToken_, std::move(buffers));
173 }

References utilities::cache(), apvshotsanalyzer_cfi::digiCollection, ev, FEDRawDataCollection::FEDData(), l1t_dqm_sourceclient-live_cfg::fedRawData, cmsLHEtoEOSManager::l, LogDebug, eostools::move(), PixelDataFormatter::passFrameReverter(), castor_dqm_sourceclient_file_cfg::path, putToken_, findQualityFiles::size, theBadPixelFEDChannelsToken, tPixelDigi, and usePhase1.

Member Data Documentation

◆ cabelingMapToken_

const edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> SiPixelDigiToRaw::cabelingMapToken_
private

Definition at line 70 of file SiPixelDigiToRaw.cc.

Referenced by globalBeginLuminosityBlock().

◆ lock_

std::atomic_flag SiPixelDigiToRaw::lock_ = ATOMIC_FLAG_INIT
mutableprivate

Definition at line 65 of file SiPixelDigiToRaw.cc.

Referenced by globalBeginLuminosityBlock().

◆ previousCache_

std::shared_ptr<pr::Cache> SiPixelDigiToRaw::previousCache_
mutableprivate

Definition at line 67 of file SiPixelDigiToRaw.cc.

Referenced by globalBeginLuminosityBlock().

◆ putToken_

const edm::EDPutTokenT<FEDRawDataCollection> SiPixelDigiToRaw::putToken_
private

Definition at line 71 of file SiPixelDigiToRaw.cc.

Referenced by produce().

◆ recordWatcher

edm::ESWatcher<SiPixelFedCablingMapRcd> SiPixelDigiToRaw::recordWatcher
mutableprivate

Definition at line 66 of file SiPixelDigiToRaw.cc.

Referenced by globalBeginLuminosityBlock().

◆ theBadPixelFEDChannelsToken

const edm::EDGetTokenT<PixelFEDChannelCollection> SiPixelDigiToRaw::theBadPixelFEDChannelsToken
private

Definition at line 69 of file SiPixelDigiToRaw.cc.

Referenced by produce().

◆ tPixelDigi

const edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > SiPixelDigiToRaw::tPixelDigi
private

Definition at line 68 of file SiPixelDigiToRaw.cc.

Referenced by produce().

◆ usePhase1

const bool SiPixelDigiToRaw::usePhase1
private

Definition at line 73 of file SiPixelDigiToRaw.cc.

Referenced by produce().

◆ usePilotBlade

const bool SiPixelDigiToRaw::usePilotBlade = false
private

Definition at line 72 of file SiPixelDigiToRaw.cc.

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SiPixelDigiToRaw::recordWatcher
edm::ESWatcher< SiPixelFedCablingMapRcd > recordWatcher
Definition: SiPixelDigiToRaw.cc:66
PixelDataFormatter::Digis
std::map< cms_uint32_t, DetDigis > Digis
Definition: PixelDataFormatter.h:63
PixelDataFormatter::RawData
std::map< int, FEDRawData > RawData
Definition: PixelDataFormatter.h:61
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
PixelDataFormatter::DetBadChannels
std::vector< PixelFEDChannel > DetBadChannels
Definition: PixelDataFormatter.h:67
FEDRawData
Definition: FEDRawData.h:19
PixelDataFormatter
Definition: PixelDataFormatter.h:57
l1t_dqm_sourceclient-live_cfg.fedRawData
fedRawData
Definition: l1t_dqm_sourceclient-live_cfg.py:188
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
sipixelobjects
Definition: CablingPathToDetUnit.h:4
sipixelobjects::CablingPathToDetUnit
Definition: CablingPathToDetUnit.h:5
edm::ESHandle< SiPixelFedCablingMap >
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
utilities.cache
def cache(function)
Definition: utilities.py:3
SiPixelFedCablingMap::cablingTree
std::unique_ptr< SiPixelFedCablingTree > cablingTree() const
Definition: SiPixelFedCablingMap.cc:103
SiPixelDigiToRaw::previousCache_
std::shared_ptr< pr::Cache > previousCache_
Definition: SiPixelDigiToRaw.cc:67
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
SiPixelDigiToRaw::putToken_
const edm::EDPutTokenT< FEDRawDataCollection > putToken_
Definition: SiPixelDigiToRaw.cc:71
apvshotsanalyzer_cfi.digiCollection
digiCollection
Definition: apvshotsanalyzer_cfi.py:4
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiPixelDigiToRaw::lock_
std::atomic_flag lock_
Definition: SiPixelDigiToRaw.cc:65
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
SiPixelDigiToRaw::tPixelDigi
const edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
Definition: SiPixelDigiToRaw.cc:68
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
PixelDataFormatter::passFrameReverter
void passFrameReverter(const SiPixelFrameReverter *reverter)
Definition: PixelDataFormatter.cc:123
eostools.move
def move(src, dest)
Definition: eostools.py:511
RefreshWebPage.rel
rel
Definition: RefreshWebPage.py:66
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
PixelDataFormatter::BadChannels
std::map< cms_uint32_t, DetBadChannels > BadChannels
Definition: PixelDataFormatter.h:68
SiPixelDigiToRaw::usePhase1
const bool usePhase1
Definition: SiPixelDigiToRaw.cc:73
SiPixelDigiToRaw::cabelingMapToken_
const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cabelingMapToken_
Definition: SiPixelDigiToRaw.cc:70
edm::InputTag
Definition: InputTag.h:15
SiPixelDigiToRaw::theBadPixelFEDChannelsToken
const edm::EDGetTokenT< PixelFEDChannelCollection > theBadPixelFEDChannelsToken
Definition: SiPixelDigiToRaw.cc:69
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443