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 
16 #include <cstdlib>
17 
18 namespace sistrip {
19 
21  rawToDigi_(0),
22  productLabel_(pset.getParameter<edm::InputTag>("ProductLabel")),
23  cabling_(0),
24  cacheId_(0),
25  extractCm_(false),
26  doFullCorruptBufferChecks_(false)
27  {
28  if ( edm::isDebugEnabled() ) {
29  LogTrace("SiStripRawToDigi")
30  << "[sistrip::RawToDigiModule::" << __func__ << "]"
31  << " Constructing object...";
32  }
33 
34  int16_t appended_bytes = pset.getParameter<int>("AppendedBytes");
35  int16_t trigger_fed_id = pset.getParameter<int>("TriggerFedId");
36  bool use_daq_register = pset.getParameter<bool>("UseDaqRegister");
37  bool using_fed_key = pset.getParameter<bool>("UseFedKey");
38  bool unpack_bad_channels = pset.getParameter<bool>("UnpackBadChannels");
39  bool mark_missing_feds = pset.getParameter<bool>("MarkModulesOnMissingFeds");
40 
41  int16_t fed_buffer_dump_freq = pset.getUntrackedParameter<int>("FedBufferDumpFreq",0);
42  int16_t fed_event_dump_freq = pset.getUntrackedParameter<int>("FedEventDumpFreq",0);
43  bool quiet = pset.getUntrackedParameter<bool>("Quiet",true);
44  extractCm_ = pset.getParameter<bool>("UnpackCommonModeValues");
45  doFullCorruptBufferChecks_ = pset.getParameter<bool>("DoAllCorruptBufferChecks");
46  uint32_t errorThreshold = pset.getParameter<unsigned int>("ErrorThreshold");
47 
48  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);
49  rawToDigi_->quiet(quiet);
50  rawToDigi_->useDaqRegister( use_daq_register );
51  rawToDigi_->extractCm(extractCm_);
52  rawToDigi_->doFullCorruptBufferChecks(doFullCorruptBufferChecks_);
53 
54  produces< SiStripEventSummary >();
55  produces< edm::DetSetVector<SiStripRawDigi> >("ScopeMode");
56  produces< edm::DetSetVector<SiStripRawDigi> >("VirginRaw");
57  produces< edm::DetSetVector<SiStripRawDigi> >("ProcessedRaw");
58  produces< edm::DetSetVector<SiStripDigi> >("ZeroSuppressed");
59  produces<DetIdCollection>();
60  if ( extractCm_ ) produces< edm::DetSetVector<SiStripRawDigi> >("CommonMode");
61 
62  }
63 
65  if ( rawToDigi_ ) { delete rawToDigi_; }
66  if ( cabling_ ) { cabling_ = 0; }
67  if ( edm::isDebugEnabled() ) {
68  LogTrace("SiStripRawToDigi")
69  << "[sistrip::RawToDigiModule::" << __func__ << "]"
70  << " Destructing object...";
71  }
72  }
73 
75  updateCabling( setup );
76  }
77 
85 
86  updateCabling( setup );
87 
88  // Retrieve FED raw data (by label, which is "source" by default)
90  event.getByLabel( productLabel_, buffers );
91 
92  // Populate SiStripEventSummary object with "trigger FED" info
93  std::auto_ptr<SiStripEventSummary> summary( new SiStripEventSummary() );
94  rawToDigi_->triggerFed( *buffers, *summary, event.id().event() );
95 
96  // Create containers for digis
101  DetIdCollection* ids = new DetIdCollection();
103 
104  // Create digis
105  if ( rawToDigi_ ) { rawToDigi_->createDigis( *cabling_,*buffers,*summary,*sm,*vr,*pr,*zs,*ids,*cm ); }
106 
107  // Create auto_ptr's of digi products
108  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > sm_dsv(sm);
109  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > vr_dsv(vr);
110  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > pr_dsv(pr);
111  std::auto_ptr< edm::DetSetVector<SiStripDigi> > zs_dsv(zs);
112  std::auto_ptr< DetIdCollection > det_ids(ids);
113  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > cm_dsv(cm);
114 
115  // Add to event
116  event.put( summary );
117  event.put( sm_dsv, "ScopeMode" );
118  event.put( vr_dsv, "VirginRaw" );
119  event.put( pr_dsv, "ProcessedRaw" );
120  event.put( zs_dsv, "ZeroSuppressed" );
121  event.put( det_ids );
122  if ( extractCm_ ) event.put( cm_dsv, "CommonMode" );
123 
124  }
125 
127 
128  uint32_t cache_id = setup.get<SiStripFedCablingRcd>().cacheIdentifier();
129 
130  if ( cacheId_ != cache_id ) {
131 
133  setup.get<SiStripFedCablingRcd>().get( c );
134  cabling_ = c.product();
135 
136  if ( edm::isDebugEnabled() ) {
137  if ( !cacheId_ ) {
138  std::stringstream ss;
139  ss << "[sistrip::RawToDigiModule::" << __func__ << "]"
140  << " Updating cabling for first time..." << std::endl
141  << " Terse print out of FED cabling:" << std::endl;
142  cabling_->terse(ss);
143  LogTrace("SiStripRawToDigi") << ss.str();
144  }
145  }
146 
147  if ( edm::isDebugEnabled() ) {
148  std::stringstream sss;
149  sss << "[sistrip::RawToDigiModule::" << __func__ << "]"
150  << " Summary of FED cabling:" << std::endl;
151  cabling_->summary(sss);
152  LogTrace("SiStripRawToDigi") << sss.str();
153  }
154  cacheId_ = cache_id;
155  }
156  }
157 
158 }
159 
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
void updateCabling(const edm::EventSetup &)
void summary(std::stringstream &ss) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
virtual void beginRun(edm::Run &, const edm::EventSetup &)
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 produce(edm::Event &, const edm::EventSetup &)
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
edm::EDCollection< DetId > DetIdCollection
RawToDigiUnpacker * rawToDigi_
const SiStripFedCabling * cabling_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition: Run.h:32