CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTuROSRawToDigi Class Reference

#include <DTuROSRawToDigi.h>

Inheritance diagram for DTuROSRawToDigi:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DTuROSRawToDigi (const edm::ParameterSet &pset)
 Constructor. More...
 
bool fillRawData (edm::Event &e, const edm::EventSetup &c, DTDigiCollection &digis, std::vector< DTuROSFEDData > &words)
 Generate and fill FED raw data for a full event. More...
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 Produce digis out of raw data. More...
 
 ~DTuROSRawToDigi () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

edm::InputTag getDTuROSInputTag ()
 
void process (int DTuROSFED, edm::Handle< FEDRawDataCollection > data, edm::ESHandle< DTReadOutMapping > mapping, DTDigiCollection &digis, DTuROSFEDData &fwords)
 
void readline (int &lines, long &dataWord)
 
int theDDU (int crate, int slot, int link, bool tenDDU)
 
int theROB (int slot, int link)
 
int theROS (int slot, int link)
 

Private Attributes

bool debug_
 
edm::InputTag DTuROSInputTag_
 
std::vector< int > feds_
 
unsigned char * lineFED
 
int nfeds_
 
edm::EDGetTokenT< FEDRawDataCollectionRaw_token
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

L1 DT uROS Raw-to-Digi

C. Heidemann - RWTH Aachen J. Troconiz - UAM Madrid

Definition at line 37 of file DTuROSRawToDigi.h.

Constructor & Destructor Documentation

DTuROSRawToDigi::DTuROSRawToDigi ( const edm::ParameterSet pset)

Constructor.

Definition at line 30 of file DTuROSRawToDigi.cc.

References debug_, DTuROSInputTag_, feds_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, FEDNumbering::MAXDTUROSFEDID, FEDNumbering::MINDTUROSFEDID, nfeds_, and Raw_token.

30  {
31 
32  produces<DTDigiCollection>();
33  produces<std::vector<DTuROSFEDData>>();
34 
35  DTuROSInputTag_ = pset.getParameter<edm::InputTag>("inputLabel");
36 
37  debug_ = pset.getUntrackedParameter<bool>("debug", false);
38 
40  feds_.push_back(i);
41 
42  nfeds_ = feds_.size();
43 
44  Raw_token = consumes<FEDRawDataCollection>(DTuROSInputTag_);
45 
46 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > feds_
edm::InputTag DTuROSInputTag_
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
DTuROSRawToDigi::~DTuROSRawToDigi ( )
override

Destructor.

Definition at line 49 of file DTuROSRawToDigi.cc.

49 {}

Member Function Documentation

bool DTuROSRawToDigi::fillRawData ( edm::Event e,
const edm::EventSetup c,
DTDigiCollection digis,
std::vector< DTuROSFEDData > &  words 
)

Generate and fill FED raw data for a full event.

Definition at line 68 of file DTuROSRawToDigi.cc.

References data, feds_, edm::EventSetup::get(), edm::Event::getByToken(), HPSPFTaus_cff::mapping, nfeds_, process(), and Raw_token.

Referenced by produce().

69  {
70 
72  e.getByToken(Raw_token, data);
73 
75  c.get<DTReadOutMappingRcd>().get( mapping );
76 
77  for (int w_i = 0; w_i < nfeds_; ++w_i) {
78  DTuROSFEDData fwords;
79  process(feds_[w_i], data, mapping, digis, fwords);
80  words.push_back(fwords);
81  }
82 
83  return true;
84 }
void process(int DTuROSFED, edm::Handle< FEDRawDataCollection > data, edm::ESHandle< DTReadOutMapping > mapping, DTDigiCollection &digis, DTuROSFEDData &fwords)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
std::vector< int > feds_
const T & get() const
Definition: EventSetup.h:58
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
edm::InputTag DTuROSRawToDigi::getDTuROSInputTag ( )
inlineprivate

Definition at line 89 of file DTuROSRawToDigi.h.

References DTuROSInputTag_.

89 { return DTuROSInputTag_; }
edm::InputTag DTuROSInputTag_
void DTuROSRawToDigi::process ( int  DTuROSFED,
edm::Handle< FEDRawDataCollection data,
edm::ESHandle< DTReadOutMapping mapping,
DTDigiCollection digis,
DTuROSFEDData fwords 
)
private

Definition at line 87 of file DTuROSRawToDigi.cc.

References dt_crc::calcCRC(), FEDRawData::data(), debug_, TauDecayModes::dec, relativeConstraints::error, FEDRawDataCollection::FEDData(), DTROChainCoding::getCode(), DTuROSROSData::getokword1(), gen::k, DTWireId::layerId(), lineFED, groupFilesInBlocks::lines, readline(), DTReadOutMapping::readOutToGeometry(), DTuROSROSData::seterror(), DTuROSFEDData::setevtlgth(), DTuROSROSData::setexword(), DTuROSFEDData::setfed(), DTuROSROSData::setheader1(), DTuROSFEDData::setheader1(), DTuROSROSData::setheader2(), DTuROSFEDData::setheader2(), DTuROSFEDData::setnslots(), DTuROSROSData::setokword1(), DTuROSROSData::setokword2(), DTuROSROSData::setokxword(), DTuROSROSData::setslot(), DTuROSFEDData::setslotsize(), DTuROSROSData::settrailer(), DTuROSFEDData::settrailer(), DTuROSFEDData::setuROS(), FEDRawData::size(), theDDU(), theROB(), theROS(), DTWireId::wire(), and globals_cff::x1.

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::dumpPython(), fillRawData(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::open(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::outputEventContent(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), ConfigBuilder.ConfigBuilder::scheduleSequence(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::setProcess(), and Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::setProperty().

91  {
92 
93 
94  // Container
95  std::vector<long> DTuROSWordContainer;
96 
97 
98  // Header constituents
99  int BOEevTy, DTuROSId;
100 
101 
102  // Trailer constituents
103  int chkEOE, evtLgth, CRC;
104 
105 
106  // Hit counter
107  std::map<uint32_t, int> hitOrder;
108 
109 
110  //--> Header - line 1
111 
112 
113  FEDRawData dturosdata = data->FEDData(DTuROSFED);
114  if ( dturosdata.size() == 0 ) return;
115 
116 
117  lineFED=dturosdata.data();
118  long dataWord = 0;
119  int lines = 0; // counting including header
120  readline(lines, dataWord);
121  const int posBOEevTy = 60 ; // positions 60 -> 63
122  const int posDTuROSId = 8 ; // positions 8 -> 19
123  const int posNslost = 52 ; // positions 52 -> 55
124  const int posSlotFED = 16 ; // positions 16 -> 19
125 
126  BOEevTy = ( dataWord >> posBOEevTy ) & 0xF;
127  DTuROSId = ( dataWord >> posDTuROSId ) & 0xFFF;
128 
129 
130  if ( (BOEevTy != 0x5) || (DTuROSId != DTuROSFED) ) {
131  if ( debug_ ) edm::LogWarning("dturos_unpacker") << "Not a DTuROS FED " << DTuROSFED << " or header " << std::hex << dataWord;
132  return;
133  }
134 
135 
136  fwords.setfed(DTuROSId);
137  fwords.setheader1(dataWord);
138 
139 
140  int newCRC = 0xFFFF;
141  dt_crc::calcCRC(dataWord, newCRC);
142 
143  int crate = DTuROSId;
144 
145 
146  //--> Header - line 2
147 
148 
149  readline(lines, dataWord);
150  dt_crc::calcCRC(dataWord, newCRC);
151 
152  int nslots = ( dataWord >> posNslost ) & 0xF;
153 
154 
155  fwords.setheader2(dataWord);
156  fwords.setnslots(nslots);
157 
158 
159  //--> AMC - line 3 to 2+nslots
160  std::map<int, int> slot_size;
161  for (int j = 0; j < nslots; ++j) {
162 
163  readline(lines, dataWord);
164  dt_crc::calcCRC(dataWord, newCRC);
165 
166  int slot = ( dataWord >> posSlotFED ) & 0xF;
167 
168  if ( (slot < 1) || (slot > 12) ) {
169  if ( debug_ ) edm::LogWarning("dturos_unpacker") << "AMCnumber " << std::dec << slot << " out of range (1-12)";
170  return;
171  }
172 
173 
174  slot_size[slot] = ( dataWord >> 32 ) & 0xFFFFFF; // positions 32 -> 55
175 
176 
177  fwords.setslotsize(slot, slot_size[slot]);
178 
179  }
180 
181  //--> DTuROS data
182 
183 
184  std::map<int,int>::iterator sziterator = slot_size.begin();
185  std::map<int,int>::iterator szitend = slot_size.end();
186  for (; sziterator != szitend; ++sziterator) {
187  for (int k=0; k<sziterator->second; ++k) {
188 
189  readline(lines, dataWord);
190  dt_crc::calcCRC(dataWord, newCRC);
191 
192  DTuROSWordContainer.push_back(dataWord);
193 
194  }
195  }
196 
197 
198  //--> Trailer - line 1
199 
200 
201  readline(lines, dataWord);
202  dt_crc::calcCRC(dataWord, newCRC);
203 
204  //--> Trailer - line 2
205 
206 
207  readline(lines, dataWord);
208 
209  const int posEOE = 60; // positions 60 -> 63
210  const int posEvtLenght = 32; // positions 33 ->55
211  const int posCRC = 16; // positions 16 ->31
212  chkEOE = ( dataWord >> posEOE ) & 0xF;
213 
214 
215  if ( chkEOE != 0xA ) {
216  if ( debug_ ) edm::LogWarning("dturos_unpacker") << "Trailer " << std::hex << dataWord << " does not start with 0xA";
217  return;
218  }
219 
220 
221  evtLgth = ( dataWord >> posEvtLenght ) & 0xFFFFFF;
222  CRC = ( dataWord >> posCRC ) & 0xFFFF;
223 
224 
225  dt_crc::calcCRC(dataWord & 0xFFFFFFFF0000FFFF, newCRC);
226 
227  if ( newCRC != CRC ) {
228  if ( debug_ ) edm::LogWarning("dturos_unpacker")
229  << "Calculated CRC " << std::hex << newCRC << " differs from CRC in trailer " << std::hex << CRC;
230  return;
231  }
232 
233 
234  if ( lines != evtLgth ) {
235  if ( debug_ ) edm::LogWarning("dturos_unpacker")
236  << "Number of words read != event length " << std::dec << lines << " " << evtLgth;
237  return;
238  }
239 
240 
241  fwords.settrailer(dataWord);
242  fwords.setevtlgth(evtLgth);
243 
244 
245  //--> analyze event
246 
247 
248  std::vector<long>::iterator DTuROSiterator = DTuROSWordContainer.begin();
249  std::vector<long>::iterator DTuROSitend = DTuROSWordContainer.end();
250 
251  const int posSlot = 56; // positions 56 -> 59
252 
253  for (; DTuROSiterator != DTuROSitend; ++DTuROSiterator) {
254 
255  DTuROSROSData rwords;
256 
257 
258  dataWord = (*DTuROSiterator); // Header AMC 1
259 
260 
261  int slot = ( dataWord >> posSlot ) & 0xF;
262 
263 
264  if ( (slot < 1) || (slot > 12) ) {
265  if ( debug_ ) edm::LogWarning("dturos_unpacker") << "Slot " << std::dec << slot << " out of range (1-12) in crate " << crate;
266  break;
267  }
268 
269 
270  rwords.setslot(slot);
271  rwords.setheader1(dataWord);
272 
273 
274  ++DTuROSiterator;
275  dataWord = (*DTuROSiterator); // Header AMC 2
276 
277 
278  rwords.setheader2(dataWord);
279  int slotMap = dataWord & 0xF;
280  if (slotMap == 0) slotMap=slot;
281  const int posSel1 = 60 ; // positions 60 -> 6
282  const int posSel2 = 28 ; // position 28
283  const int posTDCTime = 32 ; // positions 32 -> 45
284  const int posTDCChannel = 46 ; // positions 46 -> 50
285  const int posTDCId = 51 ; // positions 51 -> 52
286  const int posLink = 53 ; // positions 53 -> 59
287  const int posTDCChannelSel2Null = 14 ; // positions 14 -> 18
288  const int posTDCIdSel2Null = 19 ; // positions 19 -> 20
289  const int posLinkSel2Null = 21 ; // positions 21 -> 27
290  const int posErrorSel3 = 32 ; // positions 32 -> 60
291 
292  for (int k=2; k<slot_size[slot]-1; ++k) {
293 
294 
295  ++DTuROSiterator;
296  dataWord = (*DTuROSiterator);
297  int selector = ( dataWord >> posSel1 ) & 0xF;
298  int selector2 = ( dataWord >> posSel2 ) & 0x1;
299 
300  if ( selector == 4 ) { // OK word
301 
302  if ( rwords.getokword1() ){ rwords.setokword2(dataWord); }
303  else { rwords.setokword1(dataWord); }
304 
305  }
306  else if ( selector >= 8 && selector <= 13 ) { // OK xword
307 
308  rwords.setokxword(selector-8, dataWord);
309 
310  }
311  else if ( selector == 15 ) { // extra word
312 
313  rwords.setexword(dataWord);
314 
315  }
316  else {
317 
318  if ( selector == 2 ) { // TDC word
319 
320  int tdcTime = ( dataWord >> posTDCTime ) & 0x3FFF;
321  int tdcChannel = ( dataWord >> posTDCChannel ) & 0x1F;
322  int tdcId = ( dataWord >> posTDCId ) & 0x3;
323  int link = ( dataWord >> posLink ) & 0x7F;
324 
325  int dummy = 0;
326 
327  bool tenDDU = ! mapping->readOutToGeometry(779, 7, 1, 1, 1,
328  dummy, dummy, dummy,
329  dummy, dummy, dummy);
330 
331  int dduId = theDDU(crate, slotMap, link, tenDDU);
332  int rosId = theROS(slotMap, link);
333  int robId = theROB(slotMap, link);
334 
335 
336  DTROChainCoding channelIndex(dduId, rosId, robId, tdcId, tdcChannel);
337  if (hitOrder.find(channelIndex.getCode()) == hitOrder.end()) hitOrder[channelIndex.getCode()] = 0;
338  else hitOrder[channelIndex.getCode()]++;
339 
340 
341  int wheelId, stationId, sectorId, slId,layerId, cellId;
342  if ( ! mapping->readOutToGeometry(dduId, rosId, robId, tdcId, tdcChannel,
343  wheelId, stationId, sectorId, slId, layerId, cellId)) {
344 
345  DTWireId detId = DTWireId(wheelId, stationId, sectorId, slId, layerId, cellId);
346  int wire = detId.wire();
347 
348  DTDigi digi(wire, tdcTime, hitOrder[channelIndex.getCode()]);
349  digis.insertDigi(detId.layerId(),digi);
350 
351  }
352 
353  }
354  else if ( selector == 3 ) { // error word
355 
356  if ( debug_ ) edm::LogWarning("dturos_unpacker") << "Error word [" << std::dec << k << "] : " << std::hex << dataWord
357  << std::dec << " in slot " << slot << " in crate " << crate;
358 
359  int error = ( dataWord >> posErrorSel3 ) & 0x1FFFFFFF;
360  rwords.seterror(error);
361 
362  }
363 
364 
365  if ((dataWord & 0x1FFFFFFF) == 0x1FFFFFFF) continue;
366 
367  if ( selector2 == 0 ) { // TDC word
368 
369  int tdcTime = ( dataWord ) & 0x3FFF; // positions 0 -> 13
370  int tdcChannel = ( dataWord >> posTDCChannelSel2Null ) & 0x1F;
371  int tdcId = ( dataWord >> posTDCIdSel2Null ) & 0x3;
372  int link = ( dataWord >> posLinkSel2Null ) & 0x7F; // positions 21 -> 27
373 
374 
375  if (tdcTime == 16383) continue;
376 
377  int dummy = 0;
378 
379  bool tenDDU = ! mapping->readOutToGeometry(779, 7, 1, 1, 1,
380  dummy, dummy, dummy,
381  dummy, dummy, dummy);
382 
383  int dduId = theDDU(crate, slotMap, link, tenDDU);
384  int rosId = theROS(slotMap, link);
385  int robId = theROB(slotMap, link);
386 
387 
388  DTROChainCoding channelIndex(dduId, rosId, robId, tdcId, tdcChannel);
389  if (hitOrder.find(channelIndex.getCode()) == hitOrder.end()) hitOrder[channelIndex.getCode()] = 0;
390  else hitOrder[channelIndex.getCode()]++;
391 
392 
393  int wheelId, stationId, sectorId, slId,layerId, cellId;
394  if ( ! mapping->readOutToGeometry(dduId, rosId, robId, tdcId, tdcChannel,
395  wheelId, stationId, sectorId, slId, layerId, cellId)) {
396 
397  DTWireId detId = DTWireId(wheelId, stationId, sectorId, slId, layerId, cellId);
398  int wire = detId.wire();
399 
400  DTDigi digi(wire, tdcTime, hitOrder[channelIndex.getCode()]);
401  digis.insertDigi(detId.layerId(),digi);
402 
403  }
404 
405  }
406  else if ( selector2 == 1 ) { // error word
407 
408  if ( debug_ ) edm::LogWarning("dturos_unpacker") << "Error word [" << std::dec << k << "] : " << std::hex << dataWord
409  << std::dec << " in slot " << slot << " in crate " << crate;
410 
411  int error = ( dataWord ) & 0x1FFFFFFF; // positions 0 -> 28
412  rwords.seterror(error);
413 
414  }
415 
416  }
417 
418  }
419 
420 
421  ++DTuROSiterator;
422  dataWord = (*DTuROSiterator); // Trailer AMC
423 
424 
425  rwords.settrailer(dataWord);
426  fwords.setuROS(slot, rwords);
427 
428  } // end for-loop container content
429 
430 
431  return;
432 }
void setuROS(int slot, DTuROSROSData rwords)
int theROS(int slot, int link)
void settrailer(long dword)
void setfed(int fed)
int theROB(int slot, int link)
void settrailer(long dword)
int readOutToGeometry(int dduId, int rosId, int robId, int tdcId, int channelId, DTWireId &wireId) const
transform identifiers
void setheader1(long dword)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void setokxword(int i, long okxword)
void seterror(int error)
void setslotsize(int slot, int size)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void setexword(long exword)
unsigned char * lineFED
void readline(int &lines, long &dataWord)
int theDDU(int crate, int slot, int link, bool tenDDU)
void setokword1(long okword)
long getokword1() const
void setheader2(long dword)
Definition: DTDigi.h:17
void setheader1(long dword)
int k[5][pyjets_maxn]
int wire() const
Return the wire number.
Definition: DTWireId.h:56
void setnslots(int nslots)
void setslot(int slot)
void setheader2(long dword)
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
void calcCRC(long, int &)
Definition: DTCRC.cc:3
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void setokword2(long okword)
void setevtlgth(int evtLgth)
void DTuROSRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Produce digis out of raw data.

Definition at line 52 of file DTuROSRawToDigi.cc.

References fillRawData(), eostools::move(), and edm::Event::put().

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

52  {
53 
54  DTDigiCollection digis;
55  std::vector<DTuROSFEDData> words;
56 
57  if (!fillRawData(e, c, digis, words)) return;
58 
59  auto uROSDTDigi_product = std::make_unique<DTDigiCollection>(digis);
60  auto uROSDTWord_product = std::make_unique<std::vector<DTuROSFEDData>>(words);
61 
62  e.put(std::move(uROSDTDigi_product));
63  e.put(std::move(uROSDTWord_product));
64 
65 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool fillRawData(edm::Event &e, const edm::EventSetup &c, DTDigiCollection &digis, std::vector< DTuROSFEDData > &words)
Generate and fill FED raw data for a full event.
def move(src, dest)
Definition: eostools.py:510
void DTuROSRawToDigi::readline ( int &  lines,
long &  dataWord 
)
inlineprivate

Definition at line 77 of file DTuROSRawToDigi.h.

References groupFilesInBlocks::lines, theDDU(), theROB(), and theROS().

Referenced by process().

77  {
78  dataWord = *((long*)lineFED);
79  lineFED += 8;
80  ++lines;
81  }
unsigned char * lineFED
int DTuROSRawToDigi::theDDU ( int  crate,
int  slot,
int  link,
bool  tenDDU 
)
private

Definition at line 435 of file DTuROSRawToDigi.cc.

References FEDNumbering::MAXDTUROSFEDID, FEDNumbering::MINDTUROSFEDID, and theROS().

Referenced by process(), and readline().

435  {
436 
437  int ros = theROS(slot,link);
438 
439  int ddu = 772;
440 
441  //if (crate == 1368) { ddu = 775; }
443 
444  if (crate == FEDNumbering::MINDTUROSFEDID) {
445  if (slot < 7)
446  ddu = 770;
447  else
448  ddu = 771;
449  }
450 
451  if (crate == (FEDNumbering::MINDTUROSFEDID+1)) { ddu = 772; }
452 
453  if (crate == FEDNumbering::MAXDTUROSFEDID) {
454  if (slot < 7)
455  ddu = 773;
456  else
457  ddu = 774;
458  }
459 
460  if (ros > 6 && tenDDU && ddu < 775)
461  ddu += 5;
462 
463  return ddu;
464 }
int theROS(int slot, int link)
int DTuROSRawToDigi::theROB ( int  slot,
int  link 
)
private

Definition at line 476 of file DTuROSRawToDigi.cc.

References DEFINE_FWK_MODULE.

Referenced by process(), and readline().

476  {
477 
478  if (slot%6 == 5) return 23;
479 
480  int rob = link%24;
481  if (rob < 15) return rob;
482  if (rob == 15) return 24;
483  return rob-1;
484 }
int DTuROSRawToDigi::theROS ( int  slot,
int  link 
)
private

Definition at line 467 of file DTuROSRawToDigi.cc.

Referenced by process(), readline(), and theDDU().

467  {
468 
469  if (slot%6 == 5) return link+1;
470 
471  int ros = (link/24) + 3*(slot%6) - 2;
472  return ros;
473 }

Member Data Documentation

bool DTuROSRawToDigi::debug_
private

Definition at line 58 of file DTuROSRawToDigi.h.

Referenced by DTuROSRawToDigi(), and process().

edm::InputTag DTuROSRawToDigi::DTuROSInputTag_
private

Definition at line 56 of file DTuROSRawToDigi.h.

Referenced by DTuROSRawToDigi(), and getDTuROSInputTag().

std::vector<int> DTuROSRawToDigi::feds_
private

Definition at line 62 of file DTuROSRawToDigi.h.

Referenced by DTuROSRawToDigi(), and fillRawData().

unsigned char* DTuROSRawToDigi::lineFED
private

Definition at line 64 of file DTuROSRawToDigi.h.

Referenced by process().

int DTuROSRawToDigi::nfeds_
private

Definition at line 60 of file DTuROSRawToDigi.h.

Referenced by DTuROSRawToDigi(), and fillRawData().

edm::EDGetTokenT<FEDRawDataCollection> DTuROSRawToDigi::Raw_token
private

Definition at line 91 of file DTuROSRawToDigi.h.

Referenced by DTuROSRawToDigi(), and fillRawData().