CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripRawToDigiModule.cc
Go to the documentation of this file.
1 
4 
17 #include <cstdlib>
18 
19 namespace sistrip {
20 
22  rawToDigi_(0),
23  productLabel_(pset.getParameter<edm::InputTag>("ProductLabel")),
24  cabling_(0),
25  cacheId_(0),
26  extractCm_(false),
27  doFullCorruptBufferChecks_(false),
28  doAPVEmulatorCheck_(true)
29  {
30  if ( edm::isDebugEnabled() ) {
31  LogTrace("SiStripRawToDigi")
32  << "[sistrip::RawToDigiModule::" << __func__ << "]"
33  << " Constructing object...";
34  }
35 
36  int16_t appended_bytes = pset.getParameter<int>("AppendedBytes");
37  int16_t trigger_fed_id = pset.getParameter<int>("TriggerFedId");
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_->quiet(quiet);
54  rawToDigi_->useDaqRegister( use_daq_register );
55  rawToDigi_->extractCm(extractCm_);
56  rawToDigi_->doFullCorruptBufferChecks(doFullCorruptBufferChecks_);
57  rawToDigi_->doAPVEmulatorCheck(doAPVEmulatorCheck_);
58 
59  produces< SiStripEventSummary >();
60  produces< edm::DetSetVector<SiStripRawDigi> >("ScopeMode");
61  produces< edm::DetSetVector<SiStripRawDigi> >("VirginRaw");
62  produces< edm::DetSetVector<SiStripRawDigi> >("ProcessedRaw");
63  produces< edm::DetSetVector<SiStripDigi> >("ZeroSuppressed");
64  produces<DetIdCollection>();
65  if ( extractCm_ ) produces< edm::DetSetVector<SiStripRawDigi> >("CommonMode");
66 
67  }
68 
70  if ( rawToDigi_ ) { delete rawToDigi_; }
71  if ( cabling_ ) { cabling_ = 0; }
72  if ( edm::isDebugEnabled() ) {
73  LogTrace("SiStripRawToDigi")
74  << "[sistrip::RawToDigiModule::" << __func__ << "]"
75  << " Destructing object...";
76  }
77  }
78 
80  updateCabling( setup );
81  }
82 
90 
91  updateCabling( setup );
92 
93  // Retrieve FED raw data (by label, which is "source" by default)
95  event.getByLabel( productLabel_, buffers );
96 
97  // Populate SiStripEventSummary object with "trigger FED" info
98  std::auto_ptr<SiStripEventSummary> summary( new SiStripEventSummary() );
99  rawToDigi_->triggerFed( *buffers, *summary, event.id().event() );
100 
101  // Create containers for digis
106  DetIdCollection* ids = new DetIdCollection();
108 
109  // Create digis
110  if ( rawToDigi_ ) { rawToDigi_->createDigis( *cabling_,*buffers,*summary,*sm,*vr,*pr,*zs,*ids,*cm ); }
111 
112  // Create auto_ptr's of digi products
113  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > sm_dsv(sm);
114  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > vr_dsv(vr);
115  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > pr_dsv(pr);
116  std::auto_ptr< edm::DetSetVector<SiStripDigi> > zs_dsv(zs);
117  std::auto_ptr< DetIdCollection > det_ids(ids);
118  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > cm_dsv(cm);
119 
120  // Add to event
121  event.put( summary );
122  event.put( sm_dsv, "ScopeMode" );
123  event.put( vr_dsv, "VirginRaw" );
124  event.put( pr_dsv, "ProcessedRaw" );
125  event.put( zs_dsv, "ZeroSuppressed" );
126  event.put( det_ids );
127  if ( extractCm_ ) event.put( cm_dsv, "CommonMode" );
128 
129  }
130 
132 
133  uint32_t cache_id = setup.get<SiStripFedCablingRcd>().cacheIdentifier();
134 
135  if ( cacheId_ != cache_id ) {
136 
138  setup.get<SiStripFedCablingRcd>().get( c );
139  cabling_ = c.product();
140 
141  if ( edm::isDebugEnabled() ) {
142  if ( !cacheId_ ) {
143  std::stringstream ss;
144  ss << "[sistrip::RawToDigiModule::" << __func__ << "]"
145  << " Updating cabling for first time..." << std::endl
146  << " Terse print out of FED cabling:" << std::endl;
147  cabling_->terse(ss);
148  LogTrace("SiStripRawToDigi") << ss.str();
149  }
150  }
151 
152  if ( edm::isDebugEnabled() ) {
153  std::stringstream sss;
154  sss << "[sistrip::RawToDigiModule::" << __func__ << "]"
155  << " Summary of FED cabling:" << std::endl;
156  cabling_->summary(sss);
157  LogTrace("SiStripRawToDigi") << sss.str();
158  }
159  cacheId_ = cache_id;
160  }
161  }
162 
163 }
164 
void triggerFed(const FEDRawDataCollection &, SiStripEventSummary &, const uint32_t &event)
trigger info
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
bool isDebugEnabled()
T getUntrackedParameter(std::string const &, T const &) const
RawToDigiModule(const edm::ParameterSet &)
void terse(std::stringstream &) const
virtual void produce(edm::Event &, const edm::EventSetup &) override
void updateCabling(const edm::EventSetup &)
void summary(std::stringstream &ss) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
#define LogTrace(id)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
edm::EventID id() const
Definition: EventBase.h:56
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
volatile std::atomic< bool > shutdown_flag false
edm::EDCollection< DetId > DetIdCollection
RawToDigiUnpacker * rawToDigi_
const SiStripFedCabling * cabling_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition: Run.h:41