CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
SiPixelRawToDigi Class Reference
Inheritance diagram for SiPixelRawToDigi:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 get data, convert to digis attach againe to Event More...
 
 SiPixelRawToDigi (const edm::ParameterSet &)
 ctor More...
 
 ~SiPixelRawToDigi () override
 dtor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const SiPixelQualitybadPixelInfo_
 
std::unique_ptr< SiPixelFedCablingTreecabling_
 
const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcdcablingMapToken_
 
edm::ParameterSet config_
 
edm::EDPutTokenT< edmNew::DetSetVector< PixelFEDChannel > > disabledChannelPutToken_
 
edm::EDPutTokenT< edm::DetSetVector< SiPixelRawDataError > > errorPutToken_
 
std::vector< unsigned int > fedIds_
 
const edm::EDGetTokenT< FEDRawDataCollectionfedRawDataCollectionToken_
 
const bool includeErrors_
 
edm::ESWatcher< SiPixelQualityRcdqualityWatcher_
 
edm::ESWatcher< SiPixelFedCablingMapRcdrecordWatcher_
 
PixelUnpackingRegionsregions_
 
const edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > siPixelDigiCollectionToken_
 
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcdsiPixelQualityToken_
 
const std::vector< int > tkerrorlist_
 
edm::EDPutTokenT< DetIdCollectiontkErrorPutToken_
 
const bool usePhase1_
 
const bool usePilotBlade_
 
const bool useQuality_
 
const std::vector< int > usererrorlist_
 
edm::EDPutTokenT< DetIdCollectionuserErrorPutToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Plug-in module that performs Raw data to digi conversion for pixel subdetector

Definition at line 51 of file SiPixelRawToDigi.cc.

Constructor & Destructor Documentation

◆ SiPixelRawToDigi()

SiPixelRawToDigi::SiPixelRawToDigi ( const edm::ParameterSet conf)
explicit

ctor

Definition at line 93 of file SiPixelRawToDigi.cc.

References config_, and edm::ParameterSet::getParameter().

94  : config_(conf),
95  badPixelInfo_(nullptr),
96  regions_(nullptr),
97  tkerrorlist_(config_.getParameter<std::vector<int>>("ErrorList")),
98  usererrorlist_(config_.getParameter<std::vector<int>>("UserErrorList")),
99  fedRawDataCollectionToken_{consumes<FEDRawDataCollection>(config_.getParameter<edm::InputTag>("InputLabel"))},
100  cablingMapToken_{esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd>(
101  edm::ESInputTag("", config_.getParameter<std::string>("CablingMapLabel")))},
102  siPixelDigiCollectionToken_{produces<edm::DetSetVector<PixelDigi>>()},
103  includeErrors_(config_.getParameter<bool>("IncludeErrors")),
104  useQuality_(config_.getParameter<bool>("UseQualityInfo")),
105  usePilotBlade_(config_.getParameter<bool>("UsePilotBlade")),
106  usePhase1_(config_.getParameter<bool>("UsePhase1"))
107 
108 {
109  if (useQuality_) {
110  siPixelQualityToken_ = esConsumes<SiPixelQuality, SiPixelQualityRcd>(
111  edm::ESInputTag("", config_.getParameter<std::string>("SiPixelQualityLabel")));
112  }
113 
114  // Products
115  if (includeErrors_) {
116  errorPutToken_ = produces<edm::DetSetVector<SiPixelRawDataError>>();
117  tkErrorPutToken_ = produces<DetIdCollection>();
118  userErrorPutToken_ = produces<DetIdCollection>("UserErrorModules");
119  disabledChannelPutToken_ = produces<edmNew::DetSetVector<PixelFEDChannel>>();
120  }
121 
122  // regions
123  if (!config_.getParameter<edm::ParameterSet>("Regions").getParameterNames().empty()) {
124  regions_ = new PixelUnpackingRegions(config_, consumesCollector());
125  }
126 
127  // Control the usage of pilot-blade data, FED=40
128  if (usePilotBlade_)
129  edm::LogInfo("SiPixelRawToDigi") << " Use pilot blade data (FED 40)";
130 
131  // Control the usage of phase1
132  if (usePhase1_)
133  edm::LogInfo("SiPixelRawToDigi") << " Using phase1";
134 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDPutTokenT< edmNew::DetSetVector< PixelFEDChannel > > disabledChannelPutToken_
edm::EDPutTokenT< DetIdCollection > userErrorPutToken_
PixelUnpackingRegions * regions_
edm::EDPutTokenT< edm::DetSetVector< SiPixelRawDataError > > errorPutToken_
const bool usePilotBlade_
const std::vector< int > tkerrorlist_
const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
const bool useQuality_
const std::vector< int > usererrorlist_
Log< level::Info, false > LogInfo
edm::ParameterSet config_
const edm::EDGetTokenT< FEDRawDataCollection > fedRawDataCollectionToken_
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > siPixelQualityToken_
edm::EDPutTokenT< DetIdCollection > tkErrorPutToken_
std::vector< std::string > getParameterNames() const
const SiPixelQuality * badPixelInfo_
const edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > siPixelDigiCollectionToken_
const bool includeErrors_

◆ ~SiPixelRawToDigi()

SiPixelRawToDigi::~SiPixelRawToDigi ( )
override

dtor

Definition at line 137 of file SiPixelRawToDigi.cc.

References regions_.

137  {
138  edm::LogInfo("SiPixelRawToDigi") << " HERE ** SiPixelRawToDigi destructor!";
139  if (regions_)
140  delete regions_;
141 }
PixelUnpackingRegions * regions_
Log< level::Info, false > LogInfo

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 143 of file SiPixelRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addOptional(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

143  {
145  desc.add<bool>("IncludeErrors", true);
146  desc.add<bool>("UseQualityInfo", false);
147  {
148  desc.add<std::vector<int>>("ErrorList", std::vector<int>{29})
149  ->setComment("## ErrorList: list of error codes used by tracking to invalidate modules");
150  }
151  {
152  desc.add<std::vector<int>>("UserErrorList", std::vector<int>{40})
153  ->setComment("## UserErrorList: list of error codes used by Pixel experts for investigation");
154  }
155  desc.add<edm::InputTag>("InputLabel", edm::InputTag("siPixelRawData"));
156  {
158  psd0.addOptional<std::vector<edm::InputTag>>("inputs");
159  psd0.addOptional<std::vector<double>>("deltaPhi");
160  psd0.addOptional<std::vector<double>>("maxZ");
161  psd0.addOptional<edm::InputTag>("beamSpot");
162  desc.add<edm::ParameterSetDescription>("Regions", psd0)
163  ->setComment("## Empty Regions PSet means complete unpacking");
164  }
165  desc.add<bool>("UsePilotBlade", false)->setComment("## Use pilot blades");
166  desc.add<bool>("UsePhase1", false)->setComment("## Use phase1");
167  desc.add<std::string>("CablingMapLabel", "")->setComment("CablingMap label"); //Tav
168  desc.add<std::string>("SiPixelQualityLabel", "")->setComment("SiPixelQuality label");
169  descriptions.add("siPixelRawToDigi", desc);
170 }
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void SiPixelRawToDigi::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

get data, convert to digis attach againe to Event

Definition at line 175 of file SiPixelRawToDigi.cc.

References badPixelInfo_, cabling_, cablingMapToken_, SiPixelFedCablingMap::cablingTree(), edm::ESWatcher< T >::check(), universalConfigTemplate::collection, edm::DetSet< T >::data, disabledChannelPutToken_, errorPutToken_, nano_mu_digi_cff::errors, makeMEIFBenchmarkPlots::ev, FEDRawDataCollection::FEDData(), l1tstage2_dqm_sourceclient-live_cfg::fedId, SiPixelFedCablingMap::fedIds(), fedIds_, l1t_dqm_sourceclient-live_cfg::fedRawData, fedRawDataCollectionToken_, edm::DetSetVector< T >::find_or_insert(), edm::EventSetup::getHandle(), includeErrors_, LogDebug, PixelUnpackingRegions::mayUnpackFED(), PixelUnpackingRegions::modulesToUnpack(), eostools::move(), PixelUnpackingRegions::nBarrelModules(), PixelUnpackingRegions::nFEDs(), PixelUnpackingRegions::nForwardModules(), PixelUnpackingRegions::nModules(), edm::ESHandle< T >::product(), qualityWatcher_, recordWatcher_, regions_, PixelUnpackingRegions::run(), PixelDataFormatter::setErrorStatus(), siPixelDigiCollectionToken_, siPixelQualityToken_, tkerrorlist_, tkErrorPutToken_, usePhase1_, usePilotBlade_, useQuality_, usererrorlist_, and userErrorPutToken_.

175  {
176  const uint32_t dummydetid = 0xffffffff;
177 
178  // initialize cabling map or update if necessary
179  if (recordWatcher_.check(es)) {
180  // cabling map, which maps online address (fed->link->ROC->local pixel) to offline (DetId->global pixel)
182  fedIds_ = cablingMap->fedIds();
183  cabling_ = cablingMap->cablingTree();
184  LogDebug("map version:") << cabling_->version();
185  }
186  // initialize quality record or update if necessary
187  if (qualityWatcher_.check(es) && useQuality_) {
188  // quality info for dead pixel modules or ROCs
190  badPixelInfo_ = qualityInfo.product();
191  if (!badPixelInfo_) {
192  edm::LogError("SiPixelQualityNotPresent") << "Configured to use SiPixelQuality, but SiPixelQuality not present";
193  }
194  }
195 
197  ev.getByToken(fedRawDataCollectionToken_, buffers);
198 
199  // create product (digis & errors)
201  // collection->reserve(8*1024);
202  auto errorcollection = edm::DetSetVector<SiPixelRawDataError>{};
203  auto tkerror_detidcollection = DetIdCollection{};
204  auto usererror_detidcollection = DetIdCollection{};
205  auto disabled_channelcollection = edmNew::DetSetVector<PixelFEDChannel>{};
206 
207  PixelDataFormatter formatter(cabling_.get(), usePhase1_); // for phase 1 & 0
208 
209  formatter.setErrorStatus(includeErrors_);
210 
211  if (useQuality_)
212  formatter.setQualityStatus(useQuality_, badPixelInfo_);
213 
214  bool errorsInEvent = false;
215  PixelDataFormatter::DetErrors nodeterrors;
216 
217  if (regions_) {
218  regions_->run(ev, es);
219  formatter.setModulesToUnpack(regions_->modulesToUnpack());
220  LogDebug("SiPixelRawToDigi") << "region2unpack #feds: " << regions_->nFEDs();
221  LogDebug("SiPixelRawToDigi") << "region2unpack #modules (BPIX,EPIX,total): " << regions_->nBarrelModules() << " "
222  << regions_->nForwardModules() << " " << regions_->nModules();
223  }
224 
225  for (auto aFed = fedIds_.begin(); aFed != fedIds_.end(); ++aFed) {
226  int fedId = *aFed;
227 
228  if (!usePilotBlade_ && (fedId == 40))
229  continue; // skip pilot blade data
230 
232  continue;
233 
234  LogDebug("SiPixelRawToDigi") << "PRODUCE DIGI FOR FED:" << fedId;
235 
237 
238  //get event data for this fed
239  const FEDRawData& fedRawData = buffers->FEDData(fedId);
240 
241  //convert data to digi and strip off errors
242  formatter.interpretRawData(errorsInEvent, fedId, fedRawData, collection, errors);
243 
244  //pack errors into collection
245  if (includeErrors_) {
246  formatter.unpackFEDErrors(errors,
247  tkerrorlist_,
249  errorcollection,
250  tkerror_detidcollection,
251  usererror_detidcollection,
252  disabled_channelcollection,
253  nodeterrors);
254  } // if errors to be included in the event
255  } // loop on FED data to be unpacked
256 
257  if (includeErrors_) {
258  edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(dummydetid);
259  errorDetSet.data = nodeterrors;
260  }
261  if (errorsInEvent)
262  LogDebug("SiPixelRawToDigi") << "Error words were stored in this event";
263 
265  if (includeErrors_) {
266  ev.emplace(errorPutToken_, std::move(errorcollection));
267  ev.emplace(tkErrorPutToken_, std::move(tkerror_detidcollection));
268  ev.emplace(userErrorPutToken_, std::move(usererror_detidcollection));
269  ev.emplace(disabledChannelPutToken_, std::move(disabled_channelcollection));
270  }
271 }
std::unique_ptr< SiPixelFedCablingTree > cablingTree() const
edm::EDPutTokenT< edmNew::DetSetVector< PixelFEDChannel > > disabledChannelPutToken_
edm::ESWatcher< SiPixelQualityRcd > qualityWatcher_
std::vector< unsigned int > fedIds_
edm::EDPutTokenT< DetIdCollection > userErrorPutToken_
void setErrorStatus(bool ErrorStatus)
Log< level::Error, false > LogError
PixelUnpackingRegions * regions_
unsigned int nForwardModules() const
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:225
edm::EDPutTokenT< edm::DetSetVector< SiPixelRawDataError > > errorPutToken_
T const * product() const
Definition: ESHandle.h:86
const bool usePilotBlade_
const std::vector< int > tkerrorlist_
std::unique_ptr< SiPixelFedCablingTree > cabling_
const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
edm::ESWatcher< SiPixelFedCablingMapRcd > recordWatcher_
const std::set< unsigned int > * modulesToUnpack() const
full set of module ids to unpack
std::vector< unsigned int > fedIds() const
unsigned int nModules() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
const bool useQuality_
const std::vector< int > usererrorlist_
void run(const edm::Event &e, const edm::EventSetup &es)
has to be run during each event
unsigned int nBarrelModules() const
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
collection_type data
Definition: DetSet.h:80
const edm::EDGetTokenT< FEDRawDataCollection > fedRawDataCollectionToken_
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > siPixelQualityToken_
Definition: errors.py:1
bool mayUnpackFED(unsigned int fed_n) const
check whether a FED has to be unpacked
unsigned int nFEDs() const
various informational accessors:
edm::EDPutTokenT< DetIdCollection > tkErrorPutToken_
std::vector< SiPixelRawDataError > DetErrors
def move(src, dest)
Definition: eostools.py:511
const SiPixelQuality * badPixelInfo_
std::map< cms_uint32_t, DetErrors > Errors
const edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > siPixelDigiCollectionToken_
#define LogDebug(id)
const bool includeErrors_

Member Data Documentation

◆ badPixelInfo_

const SiPixelQuality* SiPixelRawToDigi::badPixelInfo_
private

Definition at line 67 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ cabling_

std::unique_ptr<SiPixelFedCablingTree> SiPixelRawToDigi::cabling_
private

Definition at line 66 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ cablingMapToken_

const edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> SiPixelRawToDigi::cablingMapToken_
private

Definition at line 76 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ config_

edm::ParameterSet SiPixelRawToDigi::config_
private

Definition at line 65 of file SiPixelRawToDigi.cc.

Referenced by SiPixelRawToDigi().

◆ disabledChannelPutToken_

edm::EDPutTokenT<edmNew::DetSetVector<PixelFEDChannel> > SiPixelRawToDigi::disabledChannelPutToken_
private

Definition at line 85 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ errorPutToken_

edm::EDPutTokenT<edm::DetSetVector<SiPixelRawDataError> > SiPixelRawToDigi::errorPutToken_
private

Definition at line 82 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ fedIds_

std::vector<unsigned int> SiPixelRawToDigi::fedIds_
private

Definition at line 71 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ fedRawDataCollectionToken_

const edm::EDGetTokenT<FEDRawDataCollection> SiPixelRawToDigi::fedRawDataCollectionToken_
private

Definition at line 75 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ includeErrors_

const bool SiPixelRawToDigi::includeErrors_
private

Definition at line 86 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ qualityWatcher_

edm::ESWatcher<SiPixelQualityRcd> SiPixelRawToDigi::qualityWatcher_
private

Definition at line 73 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ recordWatcher_

edm::ESWatcher<SiPixelFedCablingMapRcd> SiPixelRawToDigi::recordWatcher_
private

Definition at line 72 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ regions_

PixelUnpackingRegions* SiPixelRawToDigi::regions_
private

Definition at line 68 of file SiPixelRawToDigi.cc.

Referenced by produce(), and ~SiPixelRawToDigi().

◆ siPixelDigiCollectionToken_

const edm::EDPutTokenT<edm::DetSetVector<PixelDigi> > SiPixelRawToDigi::siPixelDigiCollectionToken_
private

Definition at line 80 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ siPixelQualityToken_

edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> SiPixelRawToDigi::siPixelQualityToken_
private

Definition at line 78 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ tkerrorlist_

const std::vector<int> SiPixelRawToDigi::tkerrorlist_
private

Definition at line 69 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ tkErrorPutToken_

edm::EDPutTokenT<DetIdCollection> SiPixelRawToDigi::tkErrorPutToken_
private

Definition at line 83 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ usePhase1_

const bool SiPixelRawToDigi::usePhase1_
private

Definition at line 89 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ usePilotBlade_

const bool SiPixelRawToDigi::usePilotBlade_
private

Definition at line 88 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ useQuality_

const bool SiPixelRawToDigi::useQuality_
private

Definition at line 87 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ usererrorlist_

const std::vector<int> SiPixelRawToDigi::usererrorlist_
private

Definition at line 70 of file SiPixelRawToDigi.cc.

Referenced by produce().

◆ userErrorPutToken_

edm::EDPutTokenT<DetIdCollection> SiPixelRawToDigi::userErrorPutToken_
private

Definition at line 84 of file SiPixelRawToDigi.cc.

Referenced by produce().