CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
sistrip::RawToDigiModule Class Referencefinal

#include <SiStripRawToDigiModule.h>

Inheritance diagram for sistrip::RawToDigiModule:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endStream () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 RawToDigiModule (const edm::ParameterSet &)
 
 ~RawToDigiModule () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

void updateCabling (const edm::EventSetup &)
 

Private Attributes

const SiStripFedCablingcabling_
 
uint32_t cacheId_
 
bool doAPVEmulatorCheck_
 
bool doFullCorruptBufferChecks_
 
bool extractCm_
 
RawToDigiUnpackerrawToDigi_
 
edm::EDGetTokenT< FEDRawDataCollectiontoken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 26 of file SiStripRawToDigiModule.h.

Constructor & Destructor Documentation

sistrip::RawToDigiModule::RawToDigiModule ( const edm::ParameterSet pset)

Definition at line 20 of file SiStripRawToDigiModule.cc.

References doAPVEmulatorCheck_, doFullCorruptBufferChecks_, extractCm_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), edm::isDebugEnabled(), LogTrace, rawToDigi_, and token_.

20  :
21  rawToDigi_(nullptr),
22  cabling_(nullptr),
23  cacheId_(0),
24  extractCm_(false),
27  {
28  if ( edm::isDebugEnabled() ) {
29  LogTrace("SiStripRawToDigi")
30  << "[sistrip::RawToDigiModule::" << __func__ << "]"
31  << " Constructing object...";
32  }
33 
34  token_ = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"));
35  int16_t appended_bytes = pset.getParameter<int>("AppendedBytes");
36  int16_t trigger_fed_id = pset.getParameter<int>("TriggerFedId");
37  bool legacy_unpacker = pset.getParameter<bool>("LegacyUnpacker");
38  bool use_daq_register = pset.getParameter<bool>("UseDaqRegister");
39  bool using_fed_key = pset.getParameter<bool>("UseFedKey");
40  bool unpack_bad_channels = pset.getParameter<bool>("UnpackBadChannels");
41  bool mark_missing_feds = pset.getParameter<bool>("MarkModulesOnMissingFeds");
42 
43  int16_t fed_buffer_dump_freq = pset.getUntrackedParameter<int>("FedBufferDumpFreq",0);
44  int16_t fed_event_dump_freq = pset.getUntrackedParameter<int>("FedEventDumpFreq",0);
45  bool quiet = pset.getUntrackedParameter<bool>("Quiet",true);
46  extractCm_ = pset.getParameter<bool>("UnpackCommonModeValues");
47  doFullCorruptBufferChecks_ = pset.getParameter<bool>("DoAllCorruptBufferChecks");
48  doAPVEmulatorCheck_ = pset.getParameter<bool>("DoAPVEmulatorCheck");
49 
50  uint32_t errorThreshold = pset.getParameter<unsigned int>("ErrorThreshold");
51 
52  rawToDigi_ = new sistrip::RawToDigiUnpacker( appended_bytes, fed_buffer_dump_freq, fed_event_dump_freq, trigger_fed_id, using_fed_key, unpack_bad_channels, mark_missing_feds, errorThreshold);
53  rawToDigi_->legacy(legacy_unpacker);
54  rawToDigi_->quiet(quiet);
55  rawToDigi_->useDaqRegister( use_daq_register );
56  rawToDigi_->extractCm(extractCm_);
57  rawToDigi_->doFullCorruptBufferChecks(doFullCorruptBufferChecks_);
58  rawToDigi_->doAPVEmulatorCheck(doAPVEmulatorCheck_);
59 
60  produces< SiStripEventSummary >();
61  produces< edm::DetSetVector<SiStripRawDigi> >("ScopeMode");
62  produces< edm::DetSetVector<SiStripRawDigi> >("VirginRaw");
63  produces< edm::DetSetVector<SiStripRawDigi> >("ProcessedRaw");
64  produces< edm::DetSetVector<SiStripDigi> >("ZeroSuppressed");
65  produces<DetIdCollection>();
66  if ( extractCm_ ) produces< edm::DetSetVector<SiStripRawDigi> >("CommonMode");
67 
68  }
T getParameter(std::string const &) const
bool isDebugEnabled()
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< FEDRawDataCollection > token_
#define LogTrace(id)
RawToDigiUnpacker * rawToDigi_
const SiStripFedCabling * cabling_
sistrip::RawToDigiModule::~RawToDigiModule ( )
override

Definition at line 70 of file SiStripRawToDigiModule.cc.

References cabling_, edm::isDebugEnabled(), LogTrace, and rawToDigi_.

70  {
71  if ( rawToDigi_ ) { delete rawToDigi_; }
72  if ( cabling_ ) { cabling_ = nullptr; }
73  if ( edm::isDebugEnabled() ) {
74  LogTrace("SiStripRawToDigi")
75  << "[sistrip::RawToDigiModule::" << __func__ << "]"
76  << " Destructing object...";
77  }
78  }
bool isDebugEnabled()
#define LogTrace(id)
RawToDigiUnpacker * rawToDigi_
const SiStripFedCabling * cabling_

Member Function Documentation

void sistrip::RawToDigiModule::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
override

Definition at line 80 of file SiStripRawToDigiModule.cc.

References updateCabling().

80  {
81  updateCabling( setup );
82  }
void updateCabling(const edm::EventSetup &)
void sistrip::RawToDigiModule::endStream ( )
override
void sistrip::RawToDigiModule::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Retrieves cabling map from EventSetup and FEDRawDataCollection from Event, creates a DetSetVector of SiStrip(Raw)Digis, uses the SiStripRawToDigiUnpacker class to fill the DetSetVector, and attaches the container to the Event.

Definition at line 90 of file SiStripRawToDigiModule.cc.

References cabling_, sistrip::RawToDigiUnpacker::createDigis(), edm::EventID::event(), extractCm_, edm::EventBase::id(), eostools::move(), rawToDigi_, heppy_report::summary, token_, sistrip::RawToDigiUnpacker::triggerFed(), and updateCabling().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

90  {
91 
92  updateCabling( setup );
93 
94  // Retrieve FED raw data (by label, which is "source" by default)
96  event.getByToken( token_, buffers );
97 
98  // Populate SiStripEventSummary object with "trigger FED" info
99  auto summary = std::make_unique<SiStripEventSummary>();
100  rawToDigi_->triggerFed( *buffers, *summary, event.id().event() );
101 
102  // Create containers for digis
107  DetIdCollection* ids = new DetIdCollection();
109 
110  // Create digis
111  if ( rawToDigi_ ) { rawToDigi_->createDigis( *cabling_,*buffers,*summary,*sm,*vr,*pr,*zs,*ids,*cm ); }
112 
113  // Create unique_ptr's of digi products
114  std::unique_ptr< edm::DetSetVector<SiStripRawDigi> > sm_dsv(sm);
115  std::unique_ptr< edm::DetSetVector<SiStripRawDigi> > vr_dsv(vr);
116  std::unique_ptr< edm::DetSetVector<SiStripRawDigi> > pr_dsv(pr);
117  std::unique_ptr< edm::DetSetVector<SiStripDigi> > zs_dsv(zs);
118  std::unique_ptr< DetIdCollection > det_ids(ids);
119  std::unique_ptr< edm::DetSetVector<SiStripRawDigi> > cm_dsv(cm);
120 
121  // Add to event
122  event.put(std::move(summary));
123  event.put(std::move(sm_dsv), "ScopeMode");
124  event.put(std::move(vr_dsv), "VirginRaw");
125  event.put(std::move(pr_dsv), "ProcessedRaw");
126  event.put(std::move(zs_dsv), "ZeroSuppressed");
127  event.put(std::move(det_ids));
128  if ( extractCm_ ) event.put(std::move(cm_dsv), "CommonMode");
129 
130  }
void triggerFed(const FEDRawDataCollection &, SiStripEventSummary &, const uint32_t &event)
trigger info
EventNumber_t event() const
Definition: EventID.h:41
edm::EDGetTokenT< FEDRawDataCollection > token_
void updateCabling(const edm::EventSetup &)
edm::EventID id() const
Definition: EventBase.h:59
void createDigis(const SiStripFedCabling &, const FEDRawDataCollection &, SiStripEventSummary &, RawDigis &scope_mode, RawDigis &virgin_raw, RawDigis &proc_raw, Digis &zero_suppr, DetIdCollection &, RawDigis &common_mode)
creates digis
edm::EDCollection< DetId > DetIdCollection
RawToDigiUnpacker * rawToDigi_
const SiStripFedCabling * cabling_
def move(src, dest)
Definition: eostools.py:511
void sistrip::RawToDigiModule::updateCabling ( const edm::EventSetup setup)
private

Definition at line 132 of file SiStripRawToDigiModule.cc.

References EnergyCorrector::c, cabling_, cacheId_, edm::EventSetup::get(), edm::isDebugEnabled(), LogTrace, edm::ESHandle< T >::product(), SiStripFedCabling::summary(), and SiStripFedCabling::terse().

Referenced by beginRun(), and produce().

132  {
133 
134  uint32_t cache_id = setup.get<SiStripFedCablingRcd>().cacheIdentifier();
135 
136  if ( cacheId_ != cache_id ) {
137 
139  setup.get<SiStripFedCablingRcd>().get( c );
140  cabling_ = c.product();
141 
142  if ( edm::isDebugEnabled() ) {
143  if ( !cacheId_ ) {
144  std::stringstream ss;
145  ss << "[sistrip::RawToDigiModule::" << __func__ << "]"
146  << " Updating cabling for first time..." << std::endl
147  << " Terse print out of FED cabling:" << std::endl;
148  cabling_->terse(ss);
149  LogTrace("SiStripRawToDigi") << ss.str();
150  }
151  }
152 
153  if ( edm::isDebugEnabled() ) {
154  std::stringstream sss;
155  sss << "[sistrip::RawToDigiModule::" << __func__ << "]"
156  << " Summary of FED cabling:" << std::endl;
158  setup.get<TrackerTopologyRcd>().get(tTopo);
159  cabling_->summary(sss, tTopo.product());
160  LogTrace("SiStripRawToDigi") << sss.str();
161  }
162  cacheId_ = cache_id;
163  }
164  }
bool isDebugEnabled()
void terse(std::stringstream &) const
#define LogTrace(id)
void summary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
T get() const
Definition: EventSetup.h:71
const SiStripFedCabling * cabling_
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

const SiStripFedCabling* sistrip::RawToDigiModule::cabling_
private

Definition at line 43 of file SiStripRawToDigiModule.h.

Referenced by produce(), updateCabling(), and ~RawToDigiModule().

uint32_t sistrip::RawToDigiModule::cacheId_
private

Definition at line 44 of file SiStripRawToDigiModule.h.

Referenced by updateCabling().

bool sistrip::RawToDigiModule::doAPVEmulatorCheck_
private

Definition at line 49 of file SiStripRawToDigiModule.h.

Referenced by RawToDigiModule().

bool sistrip::RawToDigiModule::doFullCorruptBufferChecks_
private

Definition at line 46 of file SiStripRawToDigiModule.h.

Referenced by RawToDigiModule().

bool sistrip::RawToDigiModule::extractCm_
private

Definition at line 45 of file SiStripRawToDigiModule.h.

Referenced by produce(), and RawToDigiModule().

RawToDigiUnpacker* sistrip::RawToDigiModule::rawToDigi_
private

Definition at line 41 of file SiStripRawToDigiModule.h.

Referenced by endStream(), produce(), RawToDigiModule(), and ~RawToDigiModule().

edm::EDGetTokenT<FEDRawDataCollection> sistrip::RawToDigiModule::token_
private

Definition at line 42 of file SiStripRawToDigiModule.h.

Referenced by produce(), and RawToDigiModule().