CMS 3D CMS Logo

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

#include <L1TTwinMuxRawToDigi.h>

Inheritance diagram for L1TTwinMuxRawToDigi:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool fillRawData (edm::Event &e, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data) const
 Generate and fill FED raw data for a full event. More...
 
 L1TTwinMuxRawToDigi (const edm::ParameterSet &pset)
 Constructor. More...
 
void processFed (int twinmuxfed, int wheel, std::array< short, 12 > const &twinMuxAmcSec, edm::Handle< FEDRawDataCollection > data, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data) const
 
void produce (edm::StreamID, edm::Event &e, const edm::EventSetup &c) const override
 Produce digis out of raw data. More...
 
 ~L1TTwinMuxRawToDigi () override
 Destructor. More...
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

int benAngConversion (int benAng_) const
 
edm::InputTag getDTTM7InputTag () const
 
int normBx (int bx_, int bxCnt_) const
 
int radAngConversion (int radAng_) const
 
unsigned char * readline (unsigned char *lineFED, int &lines, long &dataWord) const
 

Private Attributes

std::vector< std::array< short, 12 > > amcsec_
 
std::vector< long long int > amcsecmap_
 
bool debug_
 
edm::InputTag DTTM7InputTag_
 
std::vector< int > feds_
 
size_t nfeds_
 
edm::EDGetTokenT< FEDRawDataCollectionRaw_token
 
std::vector< int > wheels_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 30 of file L1TTwinMuxRawToDigi.h.

Constructor & Destructor Documentation

◆ L1TTwinMuxRawToDigi()

L1TTwinMuxRawToDigi::L1TTwinMuxRawToDigi ( const edm::ParameterSet pset)

Constructor.

Definition at line 34 of file L1TTwinMuxRawToDigi.cc.

35  :
36 
37  debug_(pset.getUntrackedParameter<bool>("debug", false)),
38  nfeds_(0),
39  DTTM7InputTag_(pset.getParameter<edm::InputTag>("DTTM7_FED_Source")),
40  feds_(pset.getUntrackedParameter<std::vector<int> >("feds", std::vector<int>())),
41  wheels_(pset.getUntrackedParameter<std::vector<int> >("wheels", std::vector<int>())),
42  amcsecmap_(pset.getUntrackedParameter<std::vector<long long int> >("amcsecmap", std::vector<long long int>()))
43 
44 {
45  produces<L1MuDTChambPhContainer>("PhIn").setBranchAlias("PhIn");
46  produces<L1MuDTChambThContainer>("ThIn").setBranchAlias("ThIn");
47  produces<L1MuDTChambPhContainer>("PhOut").setBranchAlias("PhOut");
48 
49  Raw_token = consumes<FEDRawDataCollection>(DTTM7InputTag_);
50 
51  nfeds_ = feds_.size();
52 
53  if (nfeds_ != wheels_.size())
54  throw cms::Exception("TwinMux_unpacker") << "Configuration file error. Size of \'wheels\' and \'feds\' differs.\n";
55 
56  if (amcsecmap_.size() != wheels_.size())
57  throw cms::Exception("TwinMux_unpacker")
58  << "Configuration file error. Size of \'wheels\' and \'amcsecmap\' differs.\n";
59 
60  for (size_t wh_i = 0; wh_i < amcsecmap_.size(); ++wh_i) {
61  std::array<short, 12> whmap;
62  for (size_t amc_i = 1; amc_i < 13; ++amc_i) {
63  short shift = (12 - amc_i) * 4;
64  whmap[amc_i - 1] = (amcsecmap_[wh_i] >> shift) & 0xF;
65  }
66  amcsec_.push_back(whmap);
67  }
68 }

References amcsec_, amcsecmap_, DTTM7InputTag_, feds_, nfeds_, Raw_token, edm::shift, and wheels_.

◆ ~L1TTwinMuxRawToDigi()

L1TTwinMuxRawToDigi::~L1TTwinMuxRawToDigi ( )
override

Destructor.

Definition at line 70 of file L1TTwinMuxRawToDigi.cc.

70 {}

Member Function Documentation

◆ benAngConversion()

int L1TTwinMuxRawToDigi::benAngConversion ( int  benAng_) const
private

Definition at line 127 of file L1TTwinMuxRawToDigi.cc.

127  {
128  if (benAng_ > 511)
129  return benAng_ - 1024;
130 
131  return benAng_;
132 }

Referenced by processFed().

◆ fillRawData()

bool L1TTwinMuxRawToDigi::fillRawData ( edm::Event e,
L1MuDTChambPhContainer::Phi_Container phi_data,
L1MuDTChambThContainer::The_Container the_data,
L1MuDTChambPhContainer::Phi_Container phi_out_data 
) const

Generate and fill FED raw data for a full event.

Definition at line 93 of file L1TTwinMuxRawToDigi.cc.

96  {
98  e.getByToken(Raw_token, data);
99 
100  for (size_t w_i = 0; w_i < nfeds_; ++w_i) {
101  processFed(feds_[w_i], wheels_[w_i], amcsec_[w_i], data, phi_data, the_data, phi_out_data);
102  }
103 
104  return true;
105 }

References amcsec_, data, MillePedeFileConverter_cfg::e, feds_, nfeds_, processFed(), Raw_token, and wheels_.

Referenced by produce().

◆ getDTTM7InputTag()

edm::InputTag L1TTwinMuxRawToDigi::getDTTM7InputTag ( ) const
inlineprivate

Definition at line 72 of file L1TTwinMuxRawToDigi.h.

72 { return DTTM7InputTag_; }

References DTTM7InputTag_.

◆ normBx()

int L1TTwinMuxRawToDigi::normBx ( int  bx_,
int  bxCnt_ 
) const
private

Definition at line 107 of file L1TTwinMuxRawToDigi.cc.

107  {
108  int bxNorm_ = bx_ - bxCnt_;
109  if (abs(bxNorm_) < 3000)
110  return bxNorm_;
111 
112  if (bxNorm_ > 0)
113  return bxNorm_ - 3564;
114  if (bxNorm_ < 0)
115  return bxNorm_ + 3564;
116 
117  return -99;
118 }

References funct::abs().

Referenced by processFed().

◆ processFed()

void L1TTwinMuxRawToDigi::processFed ( int  twinmuxfed,
int  wheel,
std::array< short, 12 > const &  twinMuxAmcSec,
edm::Handle< FEDRawDataCollection data,
L1MuDTChambPhContainer::Phi_Container phi_data,
L1MuDTChambThContainer::The_Container the_data,
L1MuDTChambPhContainer::Phi_Container phi_out_data 
) const

Container

Debug

Header

Variables

--> Header - line 1 [must start with 0x5]

--> Header - line 2

--> AMC - line 3 to 3+nAMC

--> Store payloads

--> Trailer - line 1

--> Trailer - line 2 [must start with 0xA]

--> AMC trailer - line 2

do not consider the trailer

2 words already read, last removed because trailer with CRC

==>> increment 3

BX info + theta info word

Two's complement conversion Important: here value 0x20 has been treated as -32 when in fact it is an error code denoting incorrect readout window configuration, but the case should really not happen

BX info + theta info word

Phi info word. MBx determined by selector 0x01 - 0x04

Phi info word.

bx normalized to the bxcounter

Trailer of payload with CRC

Definition at line 134 of file L1TTwinMuxRawToDigi.cc.

140  {
141  const unsigned int fw_rev_with_zerosupression =
142  93; // put the correct Firmware Revision of the first version with zerosuppression
143  int previous_selector = -100;
145  std::vector<long> DTTM7WordContainer;
146 
148  std::ofstream logfile;
149  if (debug_) {
150  std::ostringstream fname;
151  fname << "eventDump_" << twinMuxFed << ".txt";
152  logfile.open(fname.str());
153  }
154 
156  FEDRawData TM7data = data->FEDData(twinMuxFed);
157  if (TM7data.size() == 0)
158  return;
159 
161  unsigned char* lineFED = TM7data.data();
162  int nline = 0; // counting already include header
163  long dataWord = 0;
164  int newCRC = 0xFFFF;
165 
167  lineFED = readline(lineFED, nline, dataWord);
168  dt_crc::calcCRC(dataWord, newCRC);
169 
170  int TM7fedId = (dataWord >> 8) & 0xFFF; // positions 8 -> 19
171  /*** NOT UNPACKED
172  int bunchCnt = ( dataWord >> 20 ) & 0xFFF; // positions 20 -> 31
173  int eventCnt = ( dataWord >> 32 ) & 0xFFFFFF; // positions 32 -> 55
174  ***/
175  int BOEevTy = (dataWord >> 60) & 0xF; // positions 60 -> 63
176 
177  int linecounter = 0;
178  if (debug_)
179  logfile << '[' << ++linecounter << "]\t" << std::hex << dataWord << std::dec << "\t|\t"
180  << "BOEevTy " << BOEevTy << '\t' << "TM7fedId " << TM7fedId << '\n';
181 
182  if ((BOEevTy != 0x5) || (TM7fedId != twinMuxFed)) {
183  edm::LogWarning("TwinMux_unpacker") << "Not a TM7 of FED " << twinMuxFed << " header " << std::hex << dataWord;
184  return;
185  }
186 
188  lineFED = readline(lineFED, nline, dataWord);
189  dt_crc::calcCRC(dataWord, newCRC);
190 
191  std::map<int, int> AMCsizes;
192  /*** NOT UNPACKED
193  int orbit = ( dataWord >> 4 ) & 0xFFFFFFFF; // positions 4 -> 35
194  ***/
195  int nAMC = (dataWord >> 52) & 0xF; // positions 52 -> 55
196 
197  if (debug_)
198  logfile << '[' << ++linecounter << "]\t" << std::hex << dataWord << std::dec << "\t|\t"
199  << "nAMC " << nAMC << '\n';
200 
202  for (int j = 0; j < nAMC; ++j) {
203  lineFED = readline(lineFED, nline, dataWord);
204  dt_crc::calcCRC(dataWord, newCRC);
205 
206  int AMCno = (dataWord >> 16) & 0xF; // positions 16 -> 19
207  /*** NOT UNPACKED
208  int TM7boardID = dataWord & 0xFFFF; // positions 0 -> 15
209  int bulkno = (dataWord >> 20 ) & 0xFF; // positions 20 -> 27
210  ***/
211  if ((AMCno < 1) || (AMCno > 12)) {
212  edm::LogWarning("TwinMux_unpacker") << "AMCnumber " << std::dec << AMCno << " out of range (1-12)";
213  return;
214  }
215 
216  AMCsizes[AMCno] = (dataWord >> 32) & 0xFFFFFF; // positions 32 -> 55
217 
218  if (debug_)
219  logfile << '[' << ++linecounter << "]\t" << std::hex << dataWord << std::dec << "\t|\t"
220  << "AMCsizes[" << AMCno << "] " << AMCsizes[AMCno] << std::dec << '\n';
221  }
222 
224  std::map<int, int>::iterator AMCiterator = AMCsizes.begin();
225  std::map<int, int>::iterator AMCitend = AMCsizes.end();
226  for (; AMCiterator != AMCitend; ++AMCiterator) {
227  for (int k = 0; k < AMCiterator->second; ++k) {
228  lineFED = readline(lineFED, nline, dataWord);
229  dt_crc::calcCRC(dataWord, newCRC);
230 
231  DTTM7WordContainer.push_back(dataWord);
232  }
233  }
234 
236  lineFED = readline(lineFED, nline, dataWord);
237  dt_crc::calcCRC(dataWord, newCRC);
238 
240 
241  lineFED = readline(lineFED, nline, dataWord);
242  dt_crc::calcCRC(dataWord & 0xFFFFFFFF0000FFFF, newCRC);
243 
245  int chkEOE = (dataWord >> 60) & 0xF; // positions 60 -> 63
246  int CRC = (dataWord >> 16) & 0xFFFF; // positions 17 ->32
247  int evtLgth = (dataWord >> 32) & 0xFFFFFF; // positions 33 ->56
248 
249  if (chkEOE != 0xA) {
250  edm::LogWarning("TwinMux_unpacker") << "AMC block closing line " << std::hex << dataWord << std::dec
251  << " does not start with 0xA";
252  return;
253  }
254 
255  if (debug_)
256  logfile << "\tevtLgth " << std::hex << evtLgth << "\tCRC " << CRC << std::dec << '\n';
257 
258  if (nline != evtLgth) {
259  edm::LogWarning("TwinMux_unpacker") << "Number of words read " << std::dec << nline << " and event length "
260  << std::dec << evtLgth << " differ ";
261  return;
262  }
263 
264  if (newCRC != CRC) {
265  edm::LogWarning("TwinMux_unpacker") << "Calculated CRC " << std::hex << newCRC << " differs from CRC in trailer "
266  << std::hex << CRC;
267  return;
268  }
269 
270  // --> Analyze event
271  std::vector<long>::iterator DTTM7iterator = DTTM7WordContainer.begin();
272  std::vector<long>::iterator DTTM7itend = DTTM7WordContainer.end();
273 
274  int lcounter = 0;
275  for (; DTTM7iterator != DTTM7itend; ++DTTM7iterator) {
276  dataWord = (*DTTM7iterator);
277  int dataLenght = (dataWord & 0xFFFFF); // positions 0 -> 19
278  int bxCounter = (dataWord >> 20) & 0xFFF; // positions 20 -> 31
279  int event = (dataWord >> 32) & 0xFFFFFF; // positions 32 -> 55
280  int AMC_ID = (dataWord >> 56) & 0xF; // positions 56 -> 59
281  int control = (dataWord >> 60) & 0xF; // positions 59 -> 63
282  int wheel = twinMuxWheel;
283 
284  if ((AMC_ID < 1) or (AMC_ID > 12)) {
285  edm::LogWarning("TwinMux_unpacker") << "%%%%%% AMC_ID OUT OF RANGE \n"
286  << " TM7fedId " << TM7fedId << " AMC_ID " << AMC_ID;
287  break;
288  }
289 
290  int sector = twinMuxAmcSec[AMC_ID - 1];
291 
292  if ((sector < 1) or (sector > 12)) {
293  if (sector != 15)
294  edm::LogWarning("TwinMux_unpacker")
295  << "%%%%%% VALID AMC_ID POINTS TO SECTOR OUT OF RANGE \n"
296  << " TM7fedId " << TM7fedId << " AMC_ID " << AMC_ID << " wheel " << wheel << " sector " << sector;
297  break;
298  }
299 
300  if (debug_)
301  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWord << std::dec << "\t|\t"
302  << "AMC_ID " << AMC_ID << '\t' << "control " << control << '\t' << "event " << event << '\t'
303  << "bxCounter " << bxCounter << '\t' << "dataLenght " << dataLenght << '\n';
304 
305  ++DTTM7iterator; // User word empty /// ==>> increment 2
306  if (DTTM7iterator == DTTM7itend) {
307  LogDebug("TwinMux_unpacker") << "TRAILING WORD AS A PAYLOAD END in FED " << std::hex << TM7fedId << std::hex
308  << dataWord << std::dec << " [it pos " << int(DTTM7iterator - DTTM7itend) << " ]";
309  break;
310  }
311 
312  dataWord = (*DTTM7iterator);
313  unsigned int firmware_rev = (dataWord >> 7) & 0x1FF;
314  int boardID = (dataWord & 0xFFFF); // positions 0 -> 15
315  int orbit = (dataWord >> 16) & 0xFFFF; // positions 15 -> 32
316 
317  if (DTTM7iterator == DTTM7itend) {
318  edm::LogWarning("TwinMux_unpacker")
319  << "%%%%%% AMC_ID " << AMC_ID << " control " << control << " event " << event << " bxCounter " << bxCounter
320  << " size " << dataLenght << " orbit " << orbit << " board " << boardID << " AMCsizes " << AMCsizes[AMC_ID]
321  << " it pos " << int(DTTM7iterator - DTTM7itend);
322  break;
323  }
324 
325  if (debug_)
326  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWord << std::dec << "\t|\t"
327  << " orbit " << orbit << " board " << boardID << '\n';
328 
329  int AMCsize = AMCsizes[AMC_ID] - 1;
330  int bxID = 99;
331  int bc0 = -99;
332  int bxNr = -99;
333 
335  for (int tm7eventsize = 2; tm7eventsize < AMCsize; ++tm7eventsize) {
336  ++DTTM7iterator;
337  if (DTTM7iterator == DTTM7itend) {
338  edm::LogWarning("TwinMux_unpacker") << "UNEXPECTED END OF PAYLOAD INSIDE CHAMBER DESCRIPTION"
339  << " [it pos " << int(DTTM7iterator - DTTM7itend) << " ]";
340  break;
341  }
342 
343  long dataWordSub = (*DTTM7iterator);
344  int selector = (dataWordSub >> 60) & 0xF; // positions 60 -> 63
345 
346  if (firmware_rev >= fw_rev_with_zerosupression) { // zerosuppressed data unpacking
347  if (selector == 0xC) {
348 
349  bc0 = (dataWordSub >> 59) & 0x1; // position 59
350  /*** NOT UNPACKED
351  int L1A = ( dataWordSub >> 58) & 0x1; // position 58
352  ***/
353  int bxOffset = (dataWordSub >> 48) & 0x3F; // positions 48 -> 53
357  bxNr = bxOffset < 32 ? bxOffset : bxOffset - 64;
358 
359  //eta info
360 
361  int posBTI[7], qualBTI[7];
362 
363  int mb3_eta = (dataWordSub & 0xFF); // positions 0 -> 7
364  int mb3_eta_HQ = (dataWordSub >> 8) & 0xFF; // positions 8 -> 15
365  int mb2_eta = (dataWordSub >> 16) & 0xFF; // positions 16 -> 23
366  int mb2_eta_HQ = (dataWordSub >> 24) & 0xFF; // positions 24 -> 31
367  int mb1_eta = (dataWordSub >> 32) & 0xFF; // positions 32 -> 39
368  int mb1_eta_HQ = (dataWordSub >> 40) & 0xFF; // positions 40 -> 47
369 
370  //MB1
371  for (int i = 0; i <= 5; i++) {
372  posBTI[i] = (mb1_eta >> i) & 0x01;
373  qualBTI[i] = (mb1_eta_HQ >> i) & 0x01;
374  }
375  posBTI[6] = (((mb1_eta >> 6) & 0x01) || ((mb1_eta >> 7) & 0x01));
376  qualBTI[6] = (((mb1_eta_HQ >> 6) & 0x01) || ((mb1_eta_HQ >> 7) & 0x01));
377 
378  theSegments.push_back(L1MuDTChambThDigi(bxNr, wheel, sector - 1, 1, posBTI, qualBTI));
379 
380  // posBTI and qualBTI are reused!
381 
382  //MB2
383  for (int i = 0; i <= 5; i++) {
384  posBTI[i] = (mb2_eta >> i) & 0x01;
385  qualBTI[i] = (mb2_eta_HQ >> i) & 0x01;
386  }
387  posBTI[6] = ((mb2_eta >> 6) & 0x01) || ((mb2_eta >> 7) & 0x01);
388  qualBTI[6] = ((mb2_eta_HQ >> 6) & 0x01) || ((mb2_eta_HQ >> 7) & 0x01);
389 
390  theSegments.push_back(L1MuDTChambThDigi(bxNr, wheel, sector - 1, 2, posBTI, qualBTI));
391 
392  //MB3
393  for (int i = 0; i <= 5; i++) {
394  posBTI[i] = (mb3_eta >> i) & 0x01;
395  qualBTI[i] = (mb3_eta_HQ >> i) & 0x01;
396  }
397  posBTI[6] = ((mb3_eta >> 6) & 0x01) || ((mb3_eta >> 7) & 0x01);
398  qualBTI[6] = ((mb3_eta_HQ >> 6) & 0x01) || ((mb3_eta_HQ >> 7) & 0x01);
399 
400  theSegments.push_back(L1MuDTChambThDigi(bxNr, wheel, sector - 1, 3, posBTI, qualBTI));
401 
402  if (debug_)
403  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t bx info word\t"
404  << "bxOffset " << bxOffset << '\t' << "bc0 " << bc0 << '\t' << "mb1_eta " << mb1_eta << '\t'
405  << "mb2_eta " << mb2_eta << '\t' << "mb3_eta " << mb3_eta << '\t' << "mb1_eta_HQ " << mb1_eta_HQ
406  << '\t' << "mb2_eta_HQ " << mb2_eta_HQ << '\t' << "mb3_eta_HQ " << mb3_eta_HQ << '\n';
407 
408  }
409 
410  else if (selector >= 1 && selector <= 4) {
411 
412  int out_phi = (dataWordSub >> 0) & 0xFFF; // positions 0 -> 11
413  int out_phib = (dataWordSub >> 12) & 0x3FF; // positions 12 -> 21
414  int out_qual = (dataWordSub >> 22) & 0x7; // positions 22 -> 24
415  int out_q3 = (dataWordSub >> 25) & 0x1; // positions 25
416  int out_q4 = (dataWordSub >> 26) & 0x1; // positions 26
417  int out_updown = (dataWordSub >> 27) & 0x1; // positions 27
418  int out_ts2tag = (dataWordSub >> 28) & 0x1; // positions 28
419  /*** NOT UNPACKED
420  int out_parity = ( dataWordSub >> 29) & 0x1; // positions 29
421  ***/
422  int in_phi = (dataWordSub >> 30) & 0xFFF; // positions 30 -> 41
423  int in_phib = (dataWordSub >> 42) & 0x3FF; // positions 42 -> 51
424  int in_qual = (dataWordSub >> 52) & 0x7; // positions 52 -> 54
425  int in_updown = (dataWordSub >> 57) & 0x1; // positions 57
426  int in_ts2tag = (dataWordSub >> 58) & 0x1; // positions 58
427  /*** NOT UNPACKED
428  int in_parity = ( dataWordSub >> 59) & 0x1; // positions 59
429  ***/
430 
431  int in_phi_conv = radAngConversion(in_phi);
432  int in_phib_conv = benAngConversion(in_phib);
433  int out_phi_conv = radAngConversion(out_phi);
434  int out_phib_conv = benAngConversion(out_phib);
435 
436  if (previous_selector != selector) { // first track
437  if (in_qual != 7) {
438  phiSegments.push_back(L1MuDTChambPhDigi(bxNr,
439  wheel,
440  sector - 1,
441  selector,
442  in_phi_conv,
443  in_phib_conv,
444  in_qual,
445  in_ts2tag + in_updown * 2,
446  bxCounter));
447  }
448  if (out_qual != 7) {
449  phioutSegments.push_back(L1MuDTChambPhDigi(bxNr,
450  wheel,
451  sector - 1,
452  selector,
453  out_phi_conv,
454  out_phib_conv,
455  out_qual,
456  out_ts2tag + out_updown * 2,
457  bxCounter,
458  out_q3 + 2 * out_q4));
459  }
460  } else { // currently no seperation between first/second in data, keep it for possible later fix
461  // second track
462  if (in_qual != 7) {
463  phiSegments.push_back(L1MuDTChambPhDigi(bxNr,
464  wheel,
465  sector - 1,
466  selector,
467  in_phi_conv,
468  in_phib_conv,
469  in_qual,
470  in_ts2tag + in_updown * 2,
471  bxCounter));
472  }
473 
474  if (out_qual != 7) {
475  phioutSegments.push_back(L1MuDTChambPhDigi(bxNr,
476  wheel,
477  sector - 1,
478  selector,
479  out_phi_conv,
480  out_phib_conv,
481  out_qual,
482  out_ts2tag + out_updown * 2,
483  bxCounter,
484  out_q3 + 2 * out_q4));
485  }
486  }
487  if (debug_)
488  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t|\t"
489  << "in_ts2tag " << in_ts2tag << '\t' << "in_updown " << in_updown << '\t' << "in_qual " << in_qual
490  << '\t' << "in_phib " << in_phib_conv << '\t' << "in_phi " << in_phi_conv << '\t' << "out_ts2tag "
491  << out_ts2tag << '\t' << "out_updown " << out_updown << '\t' << "out_qual " << out_qual << '\t'
492  << "out_q3_out " << out_q3 << '\t' << "out_q4_out " << out_q4 << '\t' << "out_phib "
493  << out_phib_conv << '\t' << "out_phi " << out_phi_conv << '\t' << "2nd track "
494  << ((previous_selector == selector) ? 1 : 0) << '\n';
495  }
496 
497  else if (selector == 0x9 || selector == 0xE) { //RPC word
498 
499  LogDebug("TwinMux_unpacker") << "RPC WORD [" << std::dec << tm7eventsize << "] : " << std::hex << dataWordSub
500  << std::dec << " it pos " << int(DTTM7iterator - DTTM7itend);
501 
502  if (debug_)
503  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t RPC WORD\n";
504 
505  } //RPC word
506 
507  else if (selector == 0x6) { //HO word
508 
509  LogDebug("TwinMux_unpacker") << "HO WORD [" << std::dec << tm7eventsize << "] : " << std::hex << dataWordSub
510  << std::dec << " it pos " << int(DTTM7iterator - DTTM7itend);
511 
512  if (debug_)
513  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t HO WORD\n";
514 
515  } //HO word
516 
517  else if (selector == 0xF) { //ERROR word
518 
519  LogDebug("TwinMux_unpacker") << "ERROR WORD [" << std::dec << tm7eventsize << "] : " << std::hex
520  << dataWordSub << std::dec << " it pos " << int(DTTM7iterator - DTTM7itend);
521 
522  if (debug_)
523  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t ERROR WORD\n";
524  } //ERROR word
525 
526  else { //unkown word
527 
528  LogDebug("TwinMux_unpacker") << "UNKNOWN WORD received " << std::hex << dataWordSub << " in FED " << std::hex
529  << TM7fedId;
530 
531  if (debug_)
532  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t UNKNOWN WORD\n";
533  }
534  previous_selector = selector; // store selector to identify 2nd track
535  } else {
536  // normal data unpacking below
537  if (selector == 0x4) { //TSC word
538 
539  bxID = (dataWordSub >> 48) & 0xFFF; // positions 48 -> 60
540  bc0 = (dataWordSub >> 22) & 0x1; // positions 22 -> 23
541  bxNr = normBx(bxID, bxCounter);
542 
543  if (debug_)
544  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t TSC WORD\t"
545  << "bxID " << bxID << '\t' << "bc0 " << bc0 << '\n';
546 
547  } //TSC WORD
548 
549  else if (selector == 0x1) { //MB1/2 word
550 
551  int mb2_phi = (dataWordSub & 0xFFF); // positions 0 -> 11
552  int mb2_phib = (dataWordSub >> 12) & 0x3FF; // positions 12 -> 21
553  int mb2_qual = (dataWordSub >> 22) & 0x7; // positions 22 -> 24
554  int mb2_ts2tag = (dataWordSub >> 28) & 0x1; // positions 28
555  /*** NOT UNPACKED
556  int mb2_parity = ( dataWordSub >> 29) & 0x1; // positions 29
557  ***/
558 
559  int mb1_phi = (dataWordSub >> 30) & 0xFFF; // positions 30 -> 41
560  int mb1_phib = (dataWordSub >> 42) & 0x3FF; // positions 42 -> 51
561  int mb1_qual = (dataWordSub >> 52) & 0x7; // positions 52 -> 54
562  int mb1_ts2tag = (dataWordSub >> 58) & 0x1; // positions 58
563  /*** NOT UNPACKED
564  int mb1_parity = ( dataWordSub >> 59 ) &0x1; // positions 59
565  ***/
566 
567  int mb1_phi_conv = radAngConversion(mb1_phi);
568  int mb1_phib_conv = benAngConversion(mb1_phib);
569 
570  int mb2_phi_conv = radAngConversion(mb2_phi);
571  int mb2_phib_conv = benAngConversion(mb2_phib);
572 
573  phiSegments.push_back(L1MuDTChambPhDigi(
574  bxNr, wheel, sector - 1, 1, mb1_phi_conv, mb1_phib_conv, mb1_qual, mb1_ts2tag, bxCounter, -1));
575  phiSegments.push_back(L1MuDTChambPhDigi(
576  bxNr, wheel, sector - 1, 2, mb2_phi_conv, mb2_phib_conv, mb2_qual, mb2_ts2tag, bxCounter, -1));
577 
578  if (debug_)
579  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t|\t"
580  << "mb1_ts2tag " << mb1_ts2tag << '\t' << "mb1_qual " << mb1_qual << '\t' << "mb1_phib "
581  << mb1_phib_conv << '\t' << "mb1_phi " << mb1_phi_conv << '\t' << "mb2_ts2tag " << mb2_ts2tag
582  << '\t' << "mb2_qual " << mb2_qual << '\t' << "mb2_phib " << mb2_phib_conv << '\t' << "mb2_phi "
583  << mb2_phi_conv << '\n';
584  } //MB1/2 word
585 
586  else if (selector == 0x2) {
587  int mb4_phi = (dataWordSub & 0xFFF); // positions 0 -> 11
588  int mb4_phib = (dataWordSub >> 12) & 0x3FF; // positions 12 -> 21
589  int mb4_qual = (dataWordSub >> 22) & 0x7; // positions 22 -> 24
590  int mb4_ts2tag = (dataWordSub >> 28) & 0x1; // positions 28
591  /*** NOT UNPACKED
592  int mb4_parity = ( dataWordSub >> 29) & 0x1; // positions 29
593  ***/
594 
595  int mb3_phi = (dataWordSub >> 30) & 0xFFF; // positions 30 -> 41
596  int mb3_phib = (dataWordSub >> 42) & 0x3FF; // positions 42 -> 51
597  int mb3_qual = (dataWordSub >> 52) & 0x7; // positions 52 -> 54
598  int mb3_ts2tag = (dataWordSub >> 58) & 0x1; // positions 58
599  /*** NOT UNPACKED
600  int mb3_parity = ( dataWordSub >> 59 ) &0x1; // positions 59
601  ***/
602 
603  int mb3_phi_conv = radAngConversion(mb3_phi);
604  int mb3_phib_conv = benAngConversion(mb3_phib);
605 
606  int mb4_phi_conv = radAngConversion(mb4_phi);
607  int mb4_phib_conv = benAngConversion(mb4_phib);
608 
609  phiSegments.push_back(L1MuDTChambPhDigi(
610  bxNr, wheel, sector - 1, 3, mb3_phi_conv, mb3_phib_conv, mb3_qual, mb3_ts2tag, bxCounter, -1));
611  phiSegments.push_back(L1MuDTChambPhDigi(
612  bxNr, wheel, sector - 1, 4, mb4_phi_conv, mb4_phib_conv, mb4_qual, mb4_ts2tag, bxCounter, -1));
613 
614  if (debug_)
615  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t|\t"
616  << "mb3_ts2tag " << mb3_ts2tag << '\t' << "mb3_qual " << mb3_qual << '\t' << "mb3_phib "
617  << mb3_phib_conv << '\t' << "mb3_phi " << mb3_phi_conv << '\t' << "mb4_ts2tag " << mb4_ts2tag
618  << '\t' << "mb4_qual " << mb4_qual << '\t' << "mb4_phib " << mb4_phib_conv << '\t' << "mb4_phi "
619  << mb4_phi_conv << '\n';
620 
621  } //MB3/4 word
622 
623  else if (selector == 0x3) { //etha word
624 
625  int posBTI[7], qualBTI[7];
626 
627  int mb3_eta = (dataWordSub & 0xFF); // positions 0 -> 7
628  int mb2_eta = (dataWordSub >> 16) & 0xFF; // positions 16 -> 23
629  int mb1_eta = (dataWordSub >> 40) & 0xFF; // positions 40 -> 47
630 
631  int mb3_eta_HQ = (dataWordSub >> 8) & 0xFF; // positions 8 -> 15
632  int mb2_eta_HQ = (dataWordSub >> 32) & 0xFF; // positions 32 -> 39
633  int mb1_eta_HQ = (dataWordSub >> 48) & 0xFF; // positions 48 -> 55
634 
635  if (debug_)
636  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t|\t"
637  << "mb1_eta " << mb1_eta << '\t' << "mb2_eta " << mb2_eta << '\t' << "mb3_eta " << mb3_eta << '\t'
638  << "mb1_eta_HQ " << mb1_eta_HQ << '\t' << "mb2_eta_HQ " << mb2_eta_HQ << '\t' << "mb3_eta_HQ "
639  << mb3_eta_HQ << '\n';
640 
641  //MB1
642  posBTI[0] = (mb1_eta & 0x01);
643  posBTI[1] = ((mb1_eta & 0x02) >> 1);
644  posBTI[2] = ((mb1_eta & 0x04) >> 2);
645  posBTI[3] = ((mb1_eta & 0x08) >> 3);
646  posBTI[4] = ((mb1_eta & 0x10) >> 4);
647  posBTI[5] = ((mb1_eta & 0x20) >> 5);
648  posBTI[6] = (((mb1_eta & 0x40) >> 6) || ((mb1_eta & 0x80) >> 7));
649 
650  qualBTI[0] = (mb1_eta_HQ & 0x01);
651  qualBTI[1] = ((mb1_eta_HQ & 0x02) >> 1);
652  qualBTI[2] = ((mb1_eta_HQ & 0x04) >> 2);
653  qualBTI[3] = ((mb1_eta_HQ & 0x08) >> 3);
654  qualBTI[4] = ((mb1_eta_HQ & 0x10) >> 4);
655  qualBTI[5] = ((mb1_eta_HQ & 0x20) >> 5);
656  qualBTI[6] = (((mb1_eta_HQ & 0x40) >> 6) || ((mb1_eta_HQ & 0x80) >> 7));
657 
658  theSegments.push_back(L1MuDTChambThDigi(bxNr, wheel, sector - 1, 1, posBTI, qualBTI));
659 
660  //MB2
661  posBTI[0] = (mb2_eta & 0x01);
662  posBTI[1] = ((mb2_eta & 0x02) >> 1);
663  posBTI[2] = ((mb2_eta & 0x04) >> 2);
664  posBTI[3] = ((mb2_eta & 0x08) >> 3);
665  posBTI[4] = ((mb2_eta & 0x10) >> 4);
666  posBTI[5] = ((mb2_eta & 0x20) >> 5);
667  posBTI[6] = (((mb2_eta & 0x40) >> 6) || ((mb2_eta & 0x80) >> 7));
668 
669  qualBTI[0] = (mb2_eta_HQ & 0x01);
670  qualBTI[1] = ((mb2_eta_HQ & 0x02) >> 1);
671  qualBTI[2] = ((mb2_eta_HQ & 0x04) >> 2);
672  qualBTI[3] = ((mb2_eta_HQ & 0x08) >> 3);
673  qualBTI[4] = ((mb2_eta_HQ & 0x10) >> 4);
674  qualBTI[5] = ((mb2_eta_HQ & 0x20) >> 5);
675  qualBTI[6] = (((mb2_eta_HQ & 0x40) >> 6) || ((mb2_eta_HQ & 0x80) >> 7));
676 
677  theSegments.push_back(L1MuDTChambThDigi(bxNr, wheel, sector - 1, 2, posBTI, qualBTI));
678 
679  //MB3
680  posBTI[0] = (mb3_eta & 0x01);
681  posBTI[1] = ((mb3_eta & 0x02) >> 1);
682  posBTI[2] = ((mb3_eta & 0x04) >> 2);
683  posBTI[3] = ((mb3_eta & 0x08) >> 3);
684  posBTI[4] = ((mb3_eta & 0x10) >> 4);
685  posBTI[5] = ((mb3_eta & 0x20) >> 5);
686  posBTI[6] = (((mb3_eta & 0x40) >> 6) || ((mb3_eta & 0x80) >> 7));
687 
688  qualBTI[0] = (mb3_eta_HQ & 0x01);
689  qualBTI[1] = ((mb3_eta_HQ & 0x02) >> 1);
690  qualBTI[2] = ((mb3_eta_HQ & 0x04) >> 2);
691  qualBTI[3] = ((mb3_eta_HQ & 0x08) >> 3);
692  qualBTI[4] = ((mb3_eta_HQ & 0x10) >> 4);
693  qualBTI[5] = ((mb3_eta_HQ & 0x20) >> 5);
694  qualBTI[6] = (((mb3_eta_HQ & 0x40) >> 6) || ((mb3_eta_HQ & 0x80) >> 7));
695 
696  theSegments.push_back(L1MuDTChambThDigi(bxNr, wheel, sector - 1, 3, posBTI, qualBTI));
697 
698  } //etha word
699 
700  else if (selector == 0xB) { //MB1/2 output word
701 
702  int mb2_phi = (dataWordSub & 0xFFF); // positions 0 -> 11
703  int mb2_phib = (dataWordSub >> 12) & 0x3FF; // positions 12 -> 21
704  int mb2_qual = (dataWordSub >> 22) & 0x7; // positions 22 -> 24
705  int mb2_q3 = (dataWordSub >> 25) & 0x1; // positions 25
706  int mb2_q4 = (dataWordSub >> 26) & 0x1; // positions 26
707  int mb2_ts2tag = (dataWordSub >> 28) & 0x1; // positions 28
708  /*** NOT UNPACKED
709  int mb2_parity = ( dataWordSub >> 29) & 0x1; // positions 29
710  ***/
711 
712  int mb1_phi = (dataWordSub >> 30) & 0xFFF; // positions 30 -> 41
713  int mb1_phib = (dataWordSub >> 42) & 0x3FF; // positions 42 -> 51
714  int mb1_qual = (dataWordSub >> 52) & 0x7; // positions 52 -> 54
715  int mb1_q3 = (dataWordSub >> 55) & 0x1; // positions 55
716  int mb1_q4 = (dataWordSub >> 56) & 0x1; // positions 56
717  int mb1_ts2tag = (dataWordSub >> 58) & 0x1; // positions 58
718  /*** NOT UNPACKED
719  int mb1_parity = ( dataWordSub >> 59 ) &0x1; // positions 59
720  ***/
721 
722  int mb1_phi_conv = radAngConversion(mb1_phi);
723  int mb1_phib_conv = benAngConversion(mb1_phib);
724 
725  int mb2_phi_conv = radAngConversion(mb2_phi);
726  int mb2_phib_conv = benAngConversion(mb2_phib);
727 
728  phioutSegments.push_back(L1MuDTChambPhDigi(bxNr,
729  wheel,
730  sector - 1,
731  1,
732  mb1_phi_conv,
733  mb1_phib_conv,
734  mb1_qual,
735  mb1_ts2tag,
736  bxCounter,
737  mb1_q3 + 2 * mb1_q4));
738  phioutSegments.push_back(L1MuDTChambPhDigi(bxNr,
739  wheel,
740  sector - 1,
741  2,
742  mb2_phi_conv,
743  mb2_phib_conv,
744  mb2_qual,
745  mb2_ts2tag,
746  bxCounter,
747  mb2_q3 + 2 * mb2_q4));
748 
749  if (debug_)
750  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t|\t"
751  << "mb1_ts2tag_out " << mb1_ts2tag << '\t' << "mb1_qual_out " << mb1_qual << '\t' << "mb1_q3_out "
752  << mb1_q3 << '\t' << "mb1_q4_out " << mb1_q4 << '\t' << "mb1_phib_out " << mb1_phib_conv << '\t'
753  << "mb1_phi_out " << mb1_phi_conv << '\t' << "mb2_ts2tag_out " << mb2_ts2tag << '\t'
754  << "mb2_qual_out " << mb2_qual << '\t' << "mb2_q3_out " << mb2_q3 << '\t' << "mb2_q4_out " << mb2_q4
755  << '\t' << "mb2_phib_out " << mb2_phib_conv << '\t' << "mb2_phi_out " << mb2_phi_conv << '\n';
756 
757  } //MB1/2 output word
758 
759  else if (selector == 0xC) { //MB3/4 output word
760 
761  int mb4_phi = (dataWordSub & 0xFFF); // positions 0 -> 11
762  int mb4_phib = (dataWordSub >> 12) & 0x3FF; // positions 12 -> 21
763  int mb4_qual = (dataWordSub >> 22) & 0x7; // positions 22 -> 24
764  int mb4_q3 = (dataWordSub >> 25) & 0x1; // positions 25
765  int mb4_q4 = (dataWordSub >> 26) & 0x1; // positions 26
766  int mb4_ts2tag = (dataWordSub >> 28) & 0x1; // positions 28
767  /*** NOT UNPACKED
768  int mb4_parity = ( dataWordSub >> 29) & 0x1; // positions 29
769  ***/
770 
771  int mb3_phi = (dataWordSub >> 30) & 0xFFF; // positions 30 -> 41
772  int mb3_phib = (dataWordSub >> 42) & 0x3FF; // positions 42 -> 51
773  int mb3_qual = (dataWordSub >> 52) & 0x7; // positions 52 -> 54
774  int mb3_q3 = (dataWordSub >> 55) & 0x1; // positions 55
775  int mb3_q4 = (dataWordSub >> 56) & 0x1; // positions 56
776  int mb3_ts2tag = (dataWordSub >> 58) & 0x1; // positions 58
777  /*** NOT UNPACKED
778  int mb3_parity = ( dataWordSub >> 59 ) &0x1; // positions 59
779  ***/
780 
781  int mb3_phi_conv = radAngConversion(mb3_phi);
782  int mb3_phib_conv = benAngConversion(mb3_phib);
783 
784  int mb4_phi_conv = radAngConversion(mb4_phi);
785  int mb4_phib_conv = benAngConversion(mb4_phib);
786 
787  phioutSegments.push_back(L1MuDTChambPhDigi(bxNr,
788  wheel,
789  sector - 1,
790  3,
791  mb3_phi_conv,
792  mb3_phib_conv,
793  mb3_qual,
794  mb3_ts2tag,
795  bxCounter,
796  mb3_q3 + 2 * mb3_q4));
797  phioutSegments.push_back(L1MuDTChambPhDigi(bxNr,
798  wheel,
799  sector - 1,
800  4,
801  mb4_phi_conv,
802  mb4_phib_conv,
803  mb4_qual,
804  mb4_ts2tag,
805  bxCounter,
806  mb4_q3 + 2 * mb4_q4));
807 
808  if (debug_)
809  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t|\t"
810  << "mb3_ts2tag_out " << mb3_ts2tag << '\t' << "mb3_qual_out " << mb3_qual << '\t' << "mb3_q3_out "
811  << mb3_q3 << '\t' << "mb3_q4_out " << mb3_q4 << '\t' << "mb3_phib_out " << mb3_phib_conv << '\t'
812  << "mb3_phi_out " << mb3_phi_conv << '\t' << "mb4_ts2tag_out " << mb4_ts2tag << '\t'
813  << "mb4_qual_out " << mb4_qual << '\t' << "mb4_q3_out " << mb4_q3 << '\t' << "mb4_q4_out " << mb4_q4
814  << '\t' << "mb4_phib_out " << mb4_phib_conv << '\t' << "mb4_phi_out " << mb4_phi_conv << '\n';
815 
816  } //MB3/4 output word
817 
818  else if (selector == 0xD) { //etha output word
819 
820  if (debug_)
821  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t ETHA OUTPUT WORD\n";
822 
823  } //etha output word
824 
825  else if (selector == 0x9 || selector == 0xE) { //RPC word
826 
827  LogDebug("TwinMux_unpacker") << "RPC WORD [" << std::dec << tm7eventsize << "] : " << std::hex << dataWordSub
828  << std::dec << " it pos " << int(DTTM7iterator - DTTM7itend);
829 
830  if (debug_)
831  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t RPC WORD\n";
832 
833  } //RPC word
834 
835  else if (selector == 0x6) { //HO word
836 
837  LogDebug("TwinMux_unpacker") << "HO WORD [" << std::dec << tm7eventsize << "] : " << std::hex << dataWordSub
838  << std::dec << " it pos " << int(DTTM7iterator - DTTM7itend);
839 
840  if (debug_)
841  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t HO WORD\n";
842 
843  } //HO word
844 
845  else if (selector == 0xF) { //ERROR word
846 
847  LogDebug("TwinMux_unpacker") << "ERROR WORD [" << std::dec << tm7eventsize << "] : " << std::hex
848  << dataWordSub << std::dec << " it pos " << int(DTTM7iterator - DTTM7itend);
849 
850  if (debug_)
851  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t ERROR WORD\n";
852  } //ERROR word
853 
854  else { //unkown word
855 
856  LogDebug("TwinMux_unpacker") << "UNKNOWN WORD received " << std::hex << dataWordSub << " in FED " << std::hex
857  << TM7fedId;
858 
859  if (debug_)
860  logfile << '[' << ++lcounter << "]\t" << std::hex << dataWordSub << std::dec << "\t UNKNOWN WORD\n";
861  }
862 
863  if (DTTM7iterator == DTTM7itend)
864  break;
865  }
866  } //end of loop over AMCsize
867 
869  ++DTTM7iterator;
870 
871  if (DTTM7iterator == DTTM7itend)
872  break;
873 
874  } // end for-loop container content
875 
876  return;
877 }

References benAngConversion(), L1DTConfig_cfi::bxOffset, dt_crc::calcCRC(), RawDataTask_cfi::CRC, FEDRawData::data(), data, debug_, TauDecayModes::dec, alignmentValidation::fname, mps_fire::i, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, LogDebug, dqmPostProcessing_online::logfile, normBx(), or, radAngConversion(), readline(), FEDRawData::size(), makeMuonMisalignmentScenario::wheel, testProducerWithPsetDescEmpty_cfi::x1, and testProducerWithPsetDescEmpty_cfi::x2.

Referenced by fillRawData().

◆ produce()

void L1TTwinMuxRawToDigi::produce ( edm::StreamID  ,
edm::Event e,
const edm::EventSetup c 
) const
overridevirtual

Produce digis out of raw data.

Implements edm::global::EDProducerBase.

Definition at line 72 of file L1TTwinMuxRawToDigi.cc.

72  {
73  std::unique_ptr<L1MuDTChambPhContainer> TM7phi_product(new L1MuDTChambPhContainer);
74  std::unique_ptr<L1MuDTChambThContainer> TM7the_product(new L1MuDTChambThContainer);
75  std::unique_ptr<L1MuDTChambPhContainer> TM7phi_out_product(new L1MuDTChambPhContainer);
76 
80 
81  if (!fillRawData(e, phi_data, the_data, phi_out_data))
82  return;
83 
84  TM7phi_product->setContainer(phi_data);
85  TM7the_product->setContainer(the_data);
86  TM7phi_out_product->setContainer(phi_out_data);
87 
88  e.put(std::move(TM7phi_product), "PhIn");
89  e.put(std::move(TM7the_product), "ThIn");
90  e.put(std::move(TM7phi_out_product), "PhOut");
91 }

References MillePedeFileConverter_cfg::e, fillRawData(), and eostools::move().

◆ radAngConversion()

int L1TTwinMuxRawToDigi::radAngConversion ( int  radAng_) const
private

Definition at line 120 of file L1TTwinMuxRawToDigi.cc.

120  {
121  if (radAng_ > 2047)
122  return radAng_ - 4096;
123 
124  return radAng_;
125 }

Referenced by processFed().

◆ readline()

unsigned char* L1TTwinMuxRawToDigi::readline ( unsigned char *  lineFED,
int &  lines,
long &  dataWord 
) const
inlineprivate

Definition at line 65 of file L1TTwinMuxRawToDigi.h.

65  {
66  dataWord = *((long*)lineFED);
67  lineFED += 8;
68  ++lines;
69  return lineFED;
70  }

References groupFilesInBlocks::lines.

Referenced by processFed().

Member Data Documentation

◆ amcsec_

std::vector<std::array<short, 12> > L1TTwinMuxRawToDigi::amcsec_
private

Definition at line 62 of file L1TTwinMuxRawToDigi.h.

Referenced by fillRawData(), and L1TTwinMuxRawToDigi().

◆ amcsecmap_

std::vector<long long int> L1TTwinMuxRawToDigi::amcsecmap_
private

Definition at line 61 of file L1TTwinMuxRawToDigi.h.

Referenced by L1TTwinMuxRawToDigi().

◆ debug_

bool L1TTwinMuxRawToDigi::debug_
private

Definition at line 56 of file L1TTwinMuxRawToDigi.h.

Referenced by processFed().

◆ DTTM7InputTag_

edm::InputTag L1TTwinMuxRawToDigi::DTTM7InputTag_
private

Definition at line 58 of file L1TTwinMuxRawToDigi.h.

Referenced by getDTTM7InputTag(), and L1TTwinMuxRawToDigi().

◆ feds_

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

Definition at line 59 of file L1TTwinMuxRawToDigi.h.

Referenced by fillRawData(), and L1TTwinMuxRawToDigi().

◆ nfeds_

size_t L1TTwinMuxRawToDigi::nfeds_
private

Definition at line 57 of file L1TTwinMuxRawToDigi.h.

Referenced by fillRawData(), and L1TTwinMuxRawToDigi().

◆ Raw_token

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

Definition at line 74 of file L1TTwinMuxRawToDigi.h.

Referenced by fillRawData(), and L1TTwinMuxRawToDigi().

◆ wheels_

std::vector<int> L1TTwinMuxRawToDigi::wheels_
private

Definition at line 60 of file L1TTwinMuxRawToDigi.h.

Referenced by fillRawData(), and L1TTwinMuxRawToDigi().

L1TTwinMuxRawToDigi::processFed
void processFed(int twinmuxfed, int wheel, std::array< short, 12 > const &twinMuxAmcSec, edm::Handle< FEDRawDataCollection > data, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data) const
Definition: L1TTwinMuxRawToDigi.cc:134
mps_fire.i
i
Definition: mps_fire.py:355
L1TTwinMuxRawToDigi::amcsec_
std::vector< std::array< short, 12 > > amcsec_
Definition: L1TTwinMuxRawToDigi.h:62
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
L1TTwinMuxRawToDigi::readline
unsigned char * readline(unsigned char *lineFED, int &lines, long &dataWord) const
Definition: L1TTwinMuxRawToDigi.h:65
L1DTConfig_cfi.bxOffset
bxOffset
Definition: L1DTConfig_cfi.py:12
edm::Handle
Definition: AssociativeIterator.h:50
L1TTwinMuxRawToDigi::amcsecmap_
std::vector< long long int > amcsecmap_
Definition: L1TTwinMuxRawToDigi.h:61
L1MuDTChambPhContainer
Definition: L1MuDTChambPhContainer.h:33
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
L1TTwinMuxRawToDigi::feds_
std::vector< int > feds_
Definition: L1TTwinMuxRawToDigi.h:59
FEDRawData
Definition: FEDRawData.h:19
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
L1TTwinMuxRawToDigi::benAngConversion
int benAngConversion(int benAng_) const
Definition: L1TTwinMuxRawToDigi.cc:127
L1TTwinMuxRawToDigi::DTTM7InputTag_
edm::InputTag DTTM7InputTag_
Definition: L1TTwinMuxRawToDigi.h:58
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::LogWarning
Definition: MessageLogger.h:141
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
groupFilesInBlocks.lines
lines
Definition: groupFilesInBlocks.py:95
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
createfilelist.int
int
Definition: createfilelist.py:10
L1TTwinMuxRawToDigi::Raw_token
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
Definition: L1TTwinMuxRawToDigi.h:74
RawDataTask_cfi.CRC
CRC
Definition: RawDataTask_cfi.py:59
L1TTwinMuxRawToDigi::normBx
int normBx(int bx_, int bxCnt_) const
Definition: L1TTwinMuxRawToDigi.cc:107
L1MuDTChambThContainer::The_Container
std::vector< L1MuDTChambThDigi > The_Container
Definition: L1MuDTChambThContainer.h:35
L1TTwinMuxRawToDigi::radAngConversion
int radAngConversion(int radAng_) const
Definition: L1TTwinMuxRawToDigi.cc:120
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
eostools.move
def move(src, dest)
Definition: eostools.py:511
dt_crc::calcCRC
void calcCRC(long, int &)
Definition: DTCRC.cc:3
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
L1MuDTChambThDigi
Definition: L1MuDTChambThDigi.h:33
L1MuDTChambPhContainer::Phi_Container
std::vector< L1MuDTChambPhDigi > Phi_Container
Definition: L1MuDTChambPhContainer.h:35
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1TTwinMuxRawToDigi::wheels_
std::vector< int > wheels_
Definition: L1TTwinMuxRawToDigi.h:60
L1TTwinMuxRawToDigi::nfeds_
size_t nfeds_
Definition: L1TTwinMuxRawToDigi.h:57
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
L1MuDTChambThContainer
Definition: L1MuDTChambThContainer.h:33
L1TTwinMuxRawToDigi::debug_
bool debug_
Definition: L1TTwinMuxRawToDigi.h:56
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
L1TTwinMuxRawToDigi::fillRawData
bool fillRawData(edm::Event &e, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data) const
Generate and fill FED raw data for a full event.
Definition: L1TTwinMuxRawToDigi.cc:93
dqmPostProcessing_online.logfile
logfile
Definition: dqmPostProcessing_online.py:96
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
L1MuDTChambPhDigi
Definition: L1MuDTChambPhDigi.h:31
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37