CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTTFFEDReader Class Reference

#include <DTTFFEDReader.h>

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

Public Member Functions

 DTTFFEDReader (const edm::ParameterSet &pset)
 Constructor. More...
 
bool fillRawData (edm::Event &e, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTTrackContainer::TrackContainer &tra_data)
 Generate and fill FED raw data for a full event. More...
 
void produce (edm::Event &e, const edm::EventSetup &c)
 Produce digis out of raw data. More...
 
virtual ~DTTFFEDReader ()
 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
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void analyse (edm::Event &e)
 
int bxNr (int channel)
 
void calcCRC (int myD1, int myD2, int &myC)
 
int channel (int wheel, int sector, int bx)
 
void clear ()
 
edm::InputTag getDTTFInputTag ()
 
const
L1MuDTTrackContainer::TrackContainer
k_data ()
 
void match ()
 
const
L1MuDTChambPhContainer::Phi_Container
p_data ()
 
void process (edm::Event &e)
 
int sector (int channel)
 
const
L1MuDTChambThContainer::The_Container
t_data ()
 
int wheel (int channel)
 

Private Attributes

edm::InputTag DTTFInputTag
 
L1MuDTTrackContainer::TrackContainer dtTracks
 
unsigned int efTrack [3][12][6][2]
 
unsigned int etTrack [3][12][6][2]
 
L1MuDTChambPhContainer::Phi_Container phiSegments
 
edm::EDGetTokenT
< FEDRawDataCollection
Raw_token
 
L1MuDTChambThContainer::The_Container theSegments
 
bool verbose_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 Track Finder Raw-to-Digi

J. Troconiz UAM Madrid E. Delmeire UAM Madrid

Definition at line 32 of file DTTFFEDReader.h.

Constructor & Destructor Documentation

DTTFFEDReader::DTTFFEDReader ( const edm::ParameterSet pset)

Constructor.

Definition at line 25 of file DTTFFEDReader.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

25  {
26 
27  produces<L1MuDTChambPhContainer>();
28  produces<L1MuDTChambThContainer>();
29  produces<L1MuDTTrackContainer>("DATA");
30 
31  DTTFInputTag = pset.getParameter<edm::InputTag>("DTTF_FED_Source");
32 
33  verbose_ = pset.getUntrackedParameter<bool>("verbose",false);
34 
35  Raw_token = consumes<FEDRawDataCollection>(DTTFInputTag);
36 
37 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag DTTFInputTag
Definition: DTTFFEDReader.h:53
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
DTTFFEDReader::~DTTFFEDReader ( )
virtual

Destructor.

Definition at line 39 of file DTTFFEDReader.cc.

39 {}

Member Function Documentation

void DTTFFEDReader::analyse ( edm::Event e)
private

Definition at line 80 of file DTTFFEDReader.cc.

References hitfit::clear(), match(), and LaserDQM_cfg::process.

80  {
81  clear();
82  process(e);
83  match();
84  return;
85 }
void process(edm::Event &e)
int DTTFFEDReader::bxNr ( int  channel)
private

Definition at line 487 of file DTTFFEDReader.cc.

487  {
488 
489  int myChannel = channel;
490 
491  if (myChannel > 127) myChannel -= 2;
492 
493  if (myChannel < 0 || myChannel > 251 ){ return -999; }
494 
495  int myBx = 1-(myChannel%3);
496 
497  return myBx;
498 }
int channel(int wheel, int sector, int bx)
void DTTFFEDReader::calcCRC ( int  myD1,
int  myD2,
int &  myC 
)
private

Definition at line 524 of file DTTFFEDReader.cc.

References funct::C, and i.

524  {
525 
526  int myCRC[16],D[64],C[16];
527 
528  for( int i=0; i < 32; i++ ){ D[i]=(myD2>>i)&0x1; }
529  for( int i=0; i < 32; i++ ){ D[i+32]=(myD1>>i)&0x1; }
530  for( int i=0; i < 16; i++ ){ C[i]=(myC>>i)&0x1; }
531 
532  myCRC[0] = ( D[63] + D[62] + D[61] + D[60] + D[55] + D[54] +
533  D[53] + D[52] + D[51] + D[50] + D[49] + D[48] +
534  D[47] + D[46] + D[45] + D[43] + D[41] + D[40] +
535  D[39] + D[38] + D[37] + D[36] + D[35] + D[34] +
536  D[33] + D[32] + D[31] + D[30] + D[27] + D[26] +
537  D[25] + D[24] + D[23] + D[22] + D[21] + D[20] +
538  D[19] + D[18] + D[17] + D[16] + D[15] + D[13] +
539  D[12] + D[11] + D[10] + D[9] + D[8] + D[7] +
540  D[6] + D[5] + D[4] + D[3] + D[2] + D[1] +
541  D[0] + C[0] + C[1] + C[2] + C[3] + C[4] +
542  C[5] + C[6] + C[7] + C[12] + C[13] + C[14] +
543  C[15] )%2;
544 
545  myCRC[1] = ( D[63] + D[62] + D[61] + D[56] + D[55] + D[54] +
546  D[53] + D[52] + D[51] + D[50] + D[49] + D[48] +
547  D[47] + D[46] + D[44] + D[42] + D[41] + D[40] +
548  D[39] + D[38] + D[37] + D[36] + D[35] + D[34] +
549  D[33] + D[32] + D[31] + D[28] + D[27] + D[26] +
550  D[25] + D[24] + D[23] + D[22] + D[21] + D[20] +
551  D[19] + D[18] + D[17] + D[16] + D[14] + D[13] +
552  D[12] + D[11] + D[10] + D[9] + D[8] + D[7] +
553  D[6] + D[5] + D[4] + D[3] + D[2] + D[1] +
554  C[0] + C[1] + C[2] + C[3] + C[4] + C[5] +
555  C[6] + C[7] + C[8] + C[13] + C[14] + C[15] )%2;
556 
557  myCRC[2] = ( D[61] + D[60] + D[57] + D[56] + D[46] + D[42] +
558  D[31] + D[30] + D[29] + D[28] + D[16] + D[14] +
559  D[1] + D[0] + C[8] + C[9] + C[12] + C[13] )%2;
560 
561  myCRC[3] = ( D[62] + D[61] + D[58] + D[57] + D[47] + D[43] +
562  D[32] + D[31] + D[30] + D[29] + D[17] + D[15] +
563  D[2] + D[1] + C[9] + C[10] + C[13] + C[14] )%2;
564 
565  myCRC[4] = ( D[63] + D[62] + D[59] + D[58] + D[48] + D[44] +
566  D[33] + D[32] + D[31] + D[30] + D[18] + D[16] +
567  D[3] + D[2] + C[0] + C[10] + C[11] + C[14] +
568  C[15] )%2;
569 
570  myCRC[5] = ( D[63] + D[60] + D[59] + D[49] + D[45] + D[34] +
571  D[33] + D[32] + D[31] + D[19] + D[17] + D[4] +
572  D[3] + C[1] + C[11] + C[12] + C[15] )%2;
573 
574  myCRC[6] = ( D[61] + D[60] + D[50] + D[46] + D[35] + D[34] +
575  D[33] + D[32] + D[20] + D[18] + D[5] + D[4] +
576  C[2] + C[12] + C[13] )%2;
577 
578  myCRC[7] = ( D[62] + D[61] + D[51] + D[47] + D[36] + D[35] +
579  D[34] + D[33] + D[21] + D[19] + D[6] + D[5] +
580  C[3] + C[13] + C[14] )%2;
581 
582  myCRC[8] = ( D[63] + D[62] + D[52] + D[48] + D[37] + D[36] +
583  D[35] + D[34] + D[22] + D[20] + D[7] + D[6] +
584  C[0] + C[4] + C[14] + C[15] )%2;
585 
586  myCRC[9] = ( D[63] + D[53] + D[49] + D[38] + D[37] + D[36] +
587  D[35] + D[23] + D[21] + D[8] + D[7] + C[1] +
588  C[5] + C[15] )%2;
589 
590  myCRC[10] = ( D[54] + D[50] + D[39] + D[38] + D[37] + D[36] +
591  D[24] + D[22] + D[9] + D[8] + C[2] + C[6] )%2;
592 
593  myCRC[11] = ( D[55] + D[51] + D[40] + D[39] + D[38] + D[37] +
594  D[25] + D[23] + D[10] + D[9] + C[3] + C[7] )%2;
595 
596  myCRC[12] = ( D[56] + D[52] + D[41] + D[40] + D[39] + D[38] +
597  D[26] + D[24] + D[11] + D[10] + C[4] + C[8] )%2;
598 
599  myCRC[13] = ( D[57] + D[53] + D[42] + D[41] + D[40] + D[39] +
600  D[27] + D[25] + D[12] + D[11] + C[5] + C[9] )%2;
601 
602  myCRC[14] = ( D[58] + D[54] + D[43] + D[42] + D[41] + D[40] +
603  D[28] + D[26] + D[13] + D[12] + C[6] + C[10] )%2;
604 
605  myCRC[15] = ( D[63] + D[62] + D[61] + D[60] + D[59] + D[54] +
606  D[53] + D[52] + D[51] + D[50] + D[49] + D[48] +
607  D[47] + D[46] + D[45] + D[44] + D[42] + D[40] +
608  D[39] + D[38] + D[37] + D[36] + D[35] + D[34] +
609  D[33] + D[32] + D[31] + D[30] + D[29] + D[26] +
610  D[25] + D[24] + D[23] + D[22] + D[21] + D[20] +
611  D[19] + D[18] + D[17] + D[16] + D[15] + D[14] +
612  D[12] + D[11] + D[10] + D[9] + D[8] + D[7] +
613  D[6] + D[5] + D[4] + D[3] + D[2] + D[1] +
614  D[0] + C[0] + C[1] + C[2] + C[3] + C[4] +
615  C[5] + C[6] + C[11] + C[12] + C[13] + C[14] +
616  C[15] )%2;
617 
618  int tempC = 0x0;
619  for(int i=0; i<16 ; i++){ tempC = tempC + (myCRC[i]<<i); }
620  myC = tempC ;
621  return;
622 }
int i
Definition: DBlmapReader.cc:9
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
int DTTFFEDReader::channel ( int  wheel,
int  sector,
int  bx 
)
private

Definition at line 467 of file DTTFFEDReader.cc.

References funct::abs().

467  {
468 
469  // wheel : -3 -2 -1 +1 +2 +3 <=> PHTF's : N2, N1, N0, P0, P1, P2
470  // 0 <=> ETTF
471  // sector : 0 -> 11
472  // bx : -1 -> +1
473 
474  int myChannel = 255;
475 
476  if ( abs(bx) > 1) { return myChannel; }
477  if ( sector < 0 || sector > 11) { return myChannel; }
478  if ( abs(wheel) > 3) { return myChannel; }
479 
480  myChannel = sector*21 + wheel*3 - bx + 10 ;
481 
482  if (myChannel > 125) myChannel += 2;
483 
484  return myChannel;
485 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int wheel(int channel)
int sector(int channel)
void DTTFFEDReader::clear ( void  )
private

Definition at line 448 of file DTTFFEDReader.cc.

References i, j, relval_2017::k, and cmsLHEtoEOSManager::l.

Referenced by Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), Vispa.Views.WidgetView.WidgetView::setDataObjects(), Vispa.Views.TreeView.TreeView::updateContent(), Vispa.Views.TableView.TableView::updateContent(), Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and Vispa.Views.PropertyView.PropertyView::updateContent().

448  {
449  phiSegments.clear();
450  theSegments.clear();
451  dtTracks.clear();
452 
453  for(int i=0; i<3; i++){
454  for(int j=0; j<12; j++){
455  for(int k=0; k<6; k++){
456  for(int l=0; l<2; l++){
457  etTrack[i][j][k][l] = 0;
458  efTrack[i][j][k][l] = 0;
459  }
460  }
461  }
462  }
463 
464  return;
465 }
int i
Definition: DBlmapReader.cc:9
L1MuDTChambPhContainer::Phi_Container phiSegments
Definition: DTTFFEDReader.h:79
unsigned int etTrack[3][12][6][2]
Definition: DTTFFEDReader.h:85
int j
Definition: DBlmapReader.cc:9
L1MuDTChambThContainer::The_Container theSegments
Definition: DTTFFEDReader.h:81
L1MuDTTrackContainer::TrackContainer dtTracks
Definition: DTTFFEDReader.h:83
unsigned int efTrack[3][12][6][2]
Definition: DTTFFEDReader.h:87
bool DTTFFEDReader::fillRawData ( edm::Event e,
L1MuDTChambPhContainer::Phi_Container phi_data,
L1MuDTChambThContainer::The_Container the_data,
L1MuDTTrackContainer::TrackContainer tra_data 
)

Generate and fill FED raw data for a full event.

Definition at line 63 of file DTTFFEDReader.cc.

66  {
67 
68  analyse(e);
69 
70  phi_data = p_data();
71  the_data = t_data();
72  tra_data = k_data();
73 
74  return true;
75 }
const L1MuDTChambThContainer::The_Container & t_data()
const L1MuDTTrackContainer::TrackContainer & k_data()
void analyse(edm::Event &e)
const L1MuDTChambPhContainer::Phi_Container & p_data()
edm::InputTag DTTFFEDReader::getDTTFInputTag ( )
inlineprivate

Definition at line 100 of file DTTFFEDReader.h.

References DTTFInputTag.

100 { return DTTFInputTag; }
edm::InputTag DTTFInputTag
Definition: DTTFFEDReader.h:53
const L1MuDTTrackContainer::TrackContainer & DTTFFEDReader::k_data ( )
private

Definition at line 444 of file DTTFFEDReader.cc.

444  {
445  return dtTracks;
446 }
L1MuDTTrackContainer::TrackContainer dtTracks
Definition: DTTFFEDReader.h:83
void DTTFFEDReader::match ( )
private

Definition at line 417 of file DTTFFEDReader.cc.

References i.

417  {
418 
420  i != dtTracks.end();
421  i++ ) {
422  int bxTh = i->bx()+1;
423  int sectorTh = i->scNum();
424  int wheelTh = i->whNum()+3;
425  if(wheelTh > 3) wheelTh-=1;
426  int muonTh = i->TrkTag();
427 
428  i->setEtaPacked(etTrack[bxTh][sectorTh][wheelTh][muonTh]);
429  i->setFineHaloPacked(efTrack[bxTh][sectorTh][wheelTh][muonTh]);
430  }
431 
432  return;
433 }
int i
Definition: DBlmapReader.cc:9
unsigned int etTrack[3][12][6][2]
Definition: DTTFFEDReader.h:85
L1MuDTTrackContainer::TrackContainer dtTracks
Definition: DTTFFEDReader.h:83
unsigned int efTrack[3][12][6][2]
Definition: DTTFFEDReader.h:87
TrackContainer::iterator TrackIterator
const L1MuDTChambPhContainer::Phi_Container & DTTFFEDReader::p_data ( )
private

Definition at line 436 of file DTTFFEDReader.cc.

436  {
437  return phiSegments;
438 }
L1MuDTChambPhContainer::Phi_Container phiSegments
Definition: DTTFFEDReader.h:79
void DTTFFEDReader::process ( edm::Event e)
private

Definition at line 88 of file DTTFFEDReader.cc.

References funct::abs(), FEDRawData::data(), data, TauDecayModes::dec, edm::Event::getByToken(), groupFilesInBlocks::lines, TopDecayID::muonID, phi(), EnergyCorrector::pt, and FEDRawData::size().

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::dumpPython(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::open(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::outputEventContent(), 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().

88  {
89 
90  // Container
91  vector<int> DTTFWordContainer;
92  vector<int>::iterator DTTFiterator;
93 
94  // Header constituents
95  int BOEevTy, DTTFId;
96 
97  // DTTF Payload constituents
98  int DTTFWord;
99  int DTTFChan, bitsID;
100  int addr1[2] = { 3, 3};
101  int addr2[2] = {15, 15};
102  int addr3[2] = {15, 15};
103  int addr4[2] = {15, 15};
104 
105  // Trailer constituents
106  int evtLgth , CRC;
107 
108  //--> Header
109 
111  e.getByToken(Raw_token,data);
112  FEDRawData dttfdata = data->FEDData(0x030C);
113  if ( dttfdata.size() == 0 ) return;
114 
115  int* dataWord1 = new int;
116  int* dataWord2 = new int;
117  unsigned char* LineFED=dttfdata.data();
118  *dataWord2=*((int*)LineFED);
119  LineFED+=4;
120  *dataWord1=*((int*)LineFED);
121  int lines = 1; // already counting header
122 
123  BOEevTy = ((*dataWord1)&0xFF000000)>>24; // positions 57 ->64
124  DTTFId = ((*dataWord2)&0x000FFF00)>>8; // positions 9 ->20
125 
126  if( (BOEevTy != 0x50) || ( DTTFId != 0x030C) ){
127  if ( verbose_ ) edm::LogWarning("dttf_unpacker")
128  << "Not a DTTF header " << hex << *dataWord1;
129  delete dataWord1;
130  delete dataWord2;
131  return;
132  }
133 
134  int newCRC = 0xFFFF;
135  calcCRC(*dataWord1, *dataWord2, newCRC);
136 
137 
138  //--> DTTF data
139 
140  LineFED+=4;
141  *dataWord2=*((int*)LineFED);
142  LineFED+=4;
143  *dataWord1=*((int*)LineFED);
144  int chkEOE = ((*dataWord1)&0xFFF00000)>>20;
145  lines++;
146 
147  while(chkEOE != 0xA00){
148 
149  calcCRC(*dataWord1, *dataWord2, newCRC);
150 
151  DTTFWord = *dataWord1;
152  DTTFWordContainer.push_back(DTTFWord);
153  DTTFWord = *dataWord2;
154  DTTFWordContainer.push_back(DTTFWord);
155 
156  LineFED+=4;
157  *dataWord2=*((int*)LineFED);
158  LineFED+=4;
159  *dataWord1=*((int*)LineFED);
160  chkEOE = ((*dataWord1)&0xFFF00000)>>20;
161  lines++;
162 
163  if(lines > 3026){
164  if ( verbose_ ) edm::LogWarning("dttf_unpacker")
165  << "Warning : number of DTTF lines > 3026 "; // 3026 = 1(header) + 3024(max # PHTF-ETTF 64 bits words) + 1(trailer)
166  delete dataWord1;
167  delete dataWord2;
168  return;
169  }
170 
171  } // end while-Data loop
172 
173 
174  //--> Trailer
175 
176  evtLgth = ((*dataWord1)&0x00FFFFFF); // positions 33 ->56
177  CRC = ((*dataWord2)&0xFFFF0000)>>16; // positions 17 ->32
178 
179  calcCRC(*dataWord1, (*dataWord2)&0xFFFF, newCRC);
180  if( newCRC != CRC){
181  if ( verbose_ ) edm::LogWarning("dttf_unpacker")
182  << "Calculated CRC " << hex << newCRC << " differs from CRC in trailer " << hex << CRC;
183  delete dataWord1;
184  delete dataWord2;
185  return;
186  }
187 
188  if( lines != evtLgth){
189  if ( verbose_ ) edm::LogWarning("dttf_unpacker")
190  << "Number of words read != event length " << dec << lines << " " << evtLgth;
191  delete dataWord1;
192  delete dataWord2;
193  return;
194  }
195 
196 
197  // --> analyse event
198 
199  for( DTTFiterator = DTTFWordContainer.begin();
200  DTTFiterator != DTTFWordContainer.end();
201  DTTFiterator++ ){
202 
203  DTTFChan = ((*DTTFiterator)&0xFF000000)>>24;
204  DTTFiterator++;
205  bitsID = ((*DTTFiterator)&0xF0000000)>>28;
206 
207  int bxID = bxNr(DTTFChan);
208  if(bxID == -999) continue;
209  int wheelID = wheel(DTTFChan);
210  if(wheelID == -999) continue;
211  int sectorID = sector(DTTFChan);
212  if(sectorID == -999) continue;
213 
214  //Input
215  if(wheelID!=0 && bitsID<=0x9){
216 
217  int wheelPh = (abs(wheelID)-1)*wheelID/abs(wheelID);
218  int stationID = 0;
219  int ra = 0;
220  int ba = 0;
221  int tsqual = 0;
222  int ts2tag = 0;
223 
224  if ( ( bitsID >> 1 ) == 0 ){ stationID = 1;}
225  if ( ( bitsID >> 1 ) == 1 ){ stationID = 2;}
226  if ( ( bitsID >> 1 ) == 4 ){ stationID = 3;}
227  if ( ( bitsID >> 1 ) == 2 ){ stationID = 4;}
228 
229  if(stationID != 3){
230 
231  ts2tag = (bitsID)&0x1;
232  tsqual = (~(*DTTFiterator)&0x07)-1;
233  ba = (~(*DTTFiterator)&0x1FF8)>>3;
234  if( ba>0x1FF) ba-=0x400;
235  ra = (~(*DTTFiterator)&0x1FFE000)>>13;
236  if( ra>0x7FF) ra-=0x1000;
237  }
238  else{
239 
240  ts2tag = (bitsID)&0x1;
241  tsqual = (~(*DTTFiterator)&0x07)-1;
242  ra = (~(*DTTFiterator)&0x7FF8)>>3;
243  if( ra>0x7FF) ra-=0x1000;
244  }
245 
246  if(tsqual!=7 && wheelID!=-1){
247  phiSegments.push_back(
248  L1MuDTChambPhDigi( bxID+ts2tag, wheelPh, sectorID, stationID,
249  ra, ba, tsqual, ts2tag, 0) );
250  }
251  }
252  //Input
253 
254  //Input
255  if(wheelID==0 && bitsID<=0x4){
256 
257  int wheelTh = bitsID-2;
258 
259  int posALL, posBTI[7];
260 
261  if ( wheelTh == -2 || wheelTh == -1 ||
262  ( wheelTh == 0 && (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11) ) ) {
263 
264  posALL = ~(*DTTFiterator)&0x7F;
265  posBTI[0] = ~(*DTTFiterator)&0x01;
266  posBTI[1] = (~(*DTTFiterator)&0x02)>>1;
267  posBTI[2] = (~(*DTTFiterator)&0x04)>>2;
268  posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
269  posBTI[4] = (~(*DTTFiterator)&0x10)>>4;
270  posBTI[5] = (~(*DTTFiterator)&0x20)>>5;
271  posBTI[6] = (~(*DTTFiterator)&0x40)>>6;
272 
273  if(posALL){
274  theSegments.push_back(
275  L1MuDTChambThDigi( bxID, wheelTh, sectorID, 1, posBTI) );
276  }
277 
278  posALL = ~(*DTTFiterator)&0x3F80;
279  posBTI[0] = (~(*DTTFiterator)&0x0080)>>7;
280  posBTI[1] = (~(*DTTFiterator)&0x0100)>>8;
281  posBTI[2] = (~(*DTTFiterator)&0x0200)>>9;
282  posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
283  posBTI[4] = (~(*DTTFiterator)&0x0800)>>11;
284  posBTI[5] = (~(*DTTFiterator)&0x1000)>>12;
285  posBTI[6] = (~(*DTTFiterator)&0x2000)>>13;
286 
287  if(posALL){
288  theSegments.push_back(
289  L1MuDTChambThDigi( bxID, wheelTh, sectorID, 2, posBTI) );
290  }
291 
292  posALL = ~(*DTTFiterator)&0x1FC000;
293  posBTI[0] = (~(*DTTFiterator)&0x004000)>>14;
294  posBTI[1] = (~(*DTTFiterator)&0x008000)>>15;
295  posBTI[2] = (~(*DTTFiterator)&0x010000)>>16;
296  posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
297  posBTI[4] = (~(*DTTFiterator)&0x040000)>>18;
298  posBTI[5] = (~(*DTTFiterator)&0x080000)>>19;
299  posBTI[6] = (~(*DTTFiterator)&0x100000)>>20;
300 
301  if(posALL){
302  theSegments.push_back(
303  L1MuDTChambThDigi( bxID, wheelTh, sectorID, 3, posBTI) );
304  }
305  }
306 
307  else {
308 
309  posALL = ~(*DTTFiterator)&0x7F;
310  posBTI[6] = ~(*DTTFiterator)&0x01;
311  posBTI[5] = (~(*DTTFiterator)&0x02)>>1;
312  posBTI[4] = (~(*DTTFiterator)&0x04)>>2;
313  posBTI[3] = (~(*DTTFiterator)&0x08)>>3;
314  posBTI[2] = (~(*DTTFiterator)&0x10)>>4;
315  posBTI[1] = (~(*DTTFiterator)&0x20)>>5;
316  posBTI[0] = (~(*DTTFiterator)&0x40)>>6;
317 
318  if(posALL){
319  theSegments.push_back(
320  L1MuDTChambThDigi( bxID, wheelTh, sectorID, 1, posBTI) );
321  }
322 
323  posALL = ~(*DTTFiterator)&0x3F80;
324  posBTI[6] = (~(*DTTFiterator)&0x0080)>>7;
325  posBTI[5] = (~(*DTTFiterator)&0x0100)>>8;
326  posBTI[4] = (~(*DTTFiterator)&0x0200)>>9;
327  posBTI[3] = (~(*DTTFiterator)&0x0400)>>10;
328  posBTI[2] = (~(*DTTFiterator)&0x0800)>>11;
329  posBTI[1] = (~(*DTTFiterator)&0x1000)>>12;
330  posBTI[0] = (~(*DTTFiterator)&0x2000)>>13;
331 
332  if(posALL){
333  theSegments.push_back(
334  L1MuDTChambThDigi( bxID, wheelTh, sectorID, 2, posBTI) );
335  }
336 
337  posALL = ~(*DTTFiterator)&0x1FC000;
338  posBTI[6] = (~(*DTTFiterator)&0x004000)>>14;
339  posBTI[5] = (~(*DTTFiterator)&0x008000)>>15;
340  posBTI[4] = (~(*DTTFiterator)&0x010000)>>16;
341  posBTI[3] = (~(*DTTFiterator)&0x020000)>>17;
342  posBTI[2] = (~(*DTTFiterator)&0x040000)>>18;
343  posBTI[1] = (~(*DTTFiterator)&0x080000)>>19;
344  posBTI[0] = (~(*DTTFiterator)&0x100000)>>20;
345 
346  if(posALL){
347  theSegments.push_back(
348  L1MuDTChambThDigi( bxID, wheelTh, sectorID, 3, posBTI) );
349  }
350  }
351  }
352  //Input
353 
354  //Addresses
355  if(wheelID!=0 && bitsID>=0xA && bitsID<=0xB){
356 
357  int candID = bitsID - 0xA;
358 
359  addr4[candID] = ((*DTTFiterator)&0x0F);
360  addr3[candID] = ((*DTTFiterator)&0xF0)>>4;
361  addr2[candID] = ((*DTTFiterator)&0xF00)>>8;
362  addr1[candID] = ((*DTTFiterator)&0x3000)>>12;
363  }
364  //Addresses
365 
366  //Output
367  if(wheelID!=0 && bitsID>=0xC){
368 
369  int muonID = 0;
370  int pt = 0;
371  int ch = 0;
372  int phi = 0;
373  int qual = 0;
374 
375  muonID = (bitsID&0x1);
376  qual = (~(*DTTFiterator)&0x07);
377  phi = ((*DTTFiterator)&0x7F8)>>3;
378  ch = (~(*DTTFiterator)&0x800)>>11;
379  pt = (~(*DTTFiterator)&0x1F000)>>12;
380 
381  if(qual!=0){
382  dtTracks.push_back(
383  L1MuDTTrackCand( 0, phi, 0, pt, ch, 1, 0, qual, bxID, wheelID, sectorID,
384  muonID, addr1[muonID], addr2[muonID], addr3[muonID], addr4[muonID] ) );
385  }
386  }
387  //Output
388 
389  //Output
390  if(wheelID==0 && bitsID>=0x8){
391 
392  int wheelTh = bitsID&0x7;
393 
394  int etaALL;
395 
396  etaALL = ~(*DTTFiterator)&0x007F;
397  if (etaALL) {
398  etTrack[bxID+1][sectorID][wheelTh][0] = (*DTTFiterator)&0x003F;
399  efTrack[bxID+1][sectorID][wheelTh][0] = (~(*DTTFiterator)&0x0040)>>6;
400  }
401 
402  etaALL = (~(*DTTFiterator)&0x3F80)>>7;
403  if (etaALL) {
404  etTrack[bxID+1][sectorID][wheelTh][1]= ( (*DTTFiterator)&0x1F80)>>7;
405  efTrack[bxID+1][sectorID][wheelTh][1]= (~(*DTTFiterator)&0x2000)>>13;
406  }
407  }
408  //Output
409 
410  } // end for-loop container content
411 
412  delete dataWord1;
413  delete dataWord2;
414  return;
415 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
L1MuDTChambPhContainer::Phi_Container phiSegments
Definition: DTTFFEDReader.h:79
unsigned int etTrack[3][12][6][2]
Definition: DTTFFEDReader.h:85
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuDTChambThContainer::The_Container theSegments
Definition: DTTFFEDReader.h:81
L1MuDTTrackContainer::TrackContainer dtTracks
Definition: DTTFFEDReader.h:83
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
unsigned int efTrack[3][12][6][2]
Definition: DTTFFEDReader.h:87
static const int muonID
Definition: TopGenEvent.h:20
void calcCRC(int myD1, int myD2, int &myC)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
int wheel(int channel)
int bxNr(int channel)
int sector(int channel)
void DTTFFEDReader::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Produce digis out of raw data.

Implements edm::stream::EDProducerBase.

Definition at line 41 of file DTTFFEDReader.cc.

References edm::Event::put().

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

41  {
42 
43  auto_ptr<L1MuDTChambPhContainer> phi_product(new L1MuDTChambPhContainer);
44  auto_ptr<L1MuDTChambThContainer> the_product(new L1MuDTChambThContainer);
45  auto_ptr<L1MuDTTrackContainer> tra_product(new L1MuDTTrackContainer);
46 
50 
51  if (!fillRawData(e, phi_data, the_data, tra_data)) return;
52 
53  phi_product->setContainer(phi_data);
54  the_product->setContainer(the_data);
55  tra_product->setContainer(tra_data);
56 
57  e.put(phi_product);
58  e.put(the_product);
59  e.put(tra_product,"DATA");
60 
61 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
std::vector< L1MuDTTrackCand > TrackContainer
std::vector< L1MuDTChambPhDigi > Phi_Container
std::vector< L1MuDTChambThDigi > The_Container
bool fillRawData(edm::Event &e, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTTrackContainer::TrackContainer &tra_data)
Generate and fill FED raw data for a full event.
int DTTFFEDReader::sector ( int  channel)
private

Definition at line 500 of file DTTFFEDReader.cc.

Referenced by geometryXMLparser.DTAlignable::index().

500  {
501 
502  int myChannel = channel;
503 
504  if (myChannel > 127) myChannel -= 2;
505 
506  if (myChannel < 0 || myChannel > 251 ){ return -999; }
507 
508  return myChannel/21;
509 }
int channel(int wheel, int sector, int bx)
const L1MuDTChambThContainer::The_Container & DTTFFEDReader::t_data ( )
private

Definition at line 440 of file DTTFFEDReader.cc.

440  {
441  return theSegments;
442 }
L1MuDTChambThContainer::The_Container theSegments
Definition: DTTFFEDReader.h:81
int DTTFFEDReader::wheel ( int  channel)
private

Definition at line 511 of file DTTFFEDReader.cc.

Referenced by geometryXMLparser.DTAlignable::index().

511  {
512 
513  int myChannel = channel;
514 
515  if (myChannel > 127) myChannel -= 2;
516 
517  if (myChannel < 0 || myChannel > 251 ){ return -999; }
518 
519  int myWheel = ((myChannel%21)/3)-3;
520 
521  return myWheel;
522 }
int channel(int wheel, int sector, int bx)

Member Data Documentation

edm::InputTag DTTFFEDReader::DTTFInputTag
private

Definition at line 53 of file DTTFFEDReader.h.

Referenced by getDTTFInputTag().

L1MuDTTrackContainer::TrackContainer DTTFFEDReader::dtTracks
private

Definition at line 83 of file DTTFFEDReader.h.

unsigned int DTTFFEDReader::efTrack[3][12][6][2]
private

Definition at line 87 of file DTTFFEDReader.h.

unsigned int DTTFFEDReader::etTrack[3][12][6][2]
private

Definition at line 85 of file DTTFFEDReader.h.

L1MuDTChambPhContainer::Phi_Container DTTFFEDReader::phiSegments
private

Definition at line 79 of file DTTFFEDReader.h.

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

Definition at line 102 of file DTTFFEDReader.h.

L1MuDTChambThContainer::The_Container DTTFFEDReader::theSegments
private

Definition at line 81 of file DTTFFEDReader.h.

bool DTTFFEDReader::verbose_
private

Definition at line 55 of file DTTFFEDReader.h.