CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
l1t::stage2::BMTFUnpackerOutput Class Reference

#include <BMTFUnpackerOutput.h>

Inheritance diagram for l1t::stage2::BMTFUnpackerOutput:
l1t::Unpacker

Public Member Functions

 BMTFUnpackerOutput ()
 
 BMTFUnpackerOutput (const bool isTriggering_)
 
void setKalmanAlgoTrue ()
 
bool unpack (const Block &block, UnpackerCollections *coll) override
 
 ~BMTFUnpackerOutput () override
 
- Public Member Functions inherited from l1t::Unpacker
unsigned int getAlgoVersion ()
 
void setAlgoVersion (const unsigned int version)
 
 Unpacker ()
 
virtual ~Unpacker ()=default
 

Private Attributes

bool isKalman
 
bool isTriggeringAlgo
 

Detailed Description

Definition at line 9 of file BMTFUnpackerOutput.h.

Constructor & Destructor Documentation

l1t::stage2::BMTFUnpackerOutput::BMTFUnpackerOutput ( )
inline

Definition at line 14 of file BMTFUnpackerOutput.h.

References isKalman, and isTriggeringAlgo.

l1t::stage2::BMTFUnpackerOutput::BMTFUnpackerOutput ( const bool  isTriggering_)
inline

Definition at line 18 of file BMTFUnpackerOutput.h.

References isKalman, and isTriggeringAlgo.

18  {
19  isKalman = false;
20  isTriggeringAlgo = isTriggering_;
21  }
l1t::stage2::BMTFUnpackerOutput::~BMTFUnpackerOutput ( )
inlineoverride

Definition at line 22 of file BMTFUnpackerOutput.h.

References groupFilesInBlocks::block, coll, and unpack().

22 {};

Member Function Documentation

void l1t::stage2::BMTFUnpackerOutput::setKalmanAlgoTrue ( )
inline

Definition at line 24 of file BMTFUnpackerOutput.h.

References isKalman.

bool l1t::stage2::BMTFUnpackerOutput::unpack ( const Block block,
UnpackerCollections coll 
)
overridevirtual

Implements l1t::Unpacker.

Definition at line 12 of file BMTFUnpackerOutput.cc.

References l1t::Block::amc(), l1t::bmtf, electrons_cff::bool, coll, DEFINE_L1T_UNPACKER, l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(), l1t::Block::getBxBlocks(), l1t::getBXRange(), l1t::BlockHeader::getFlags(), l1t::BlockHeader::getID(), l1t::BlockHeader::getSize(), l1t::Block::header(), l1t::RegionalMuonCand::hwEta(), l1t::RegionalMuonCand::hwPhi(), l1t::RegionalMuonCand::hwPt(), l1t::RegionalMuonCand::hwPt2(), l1t::RegionalMuonCand::hwQual(), isKalman, isTriggeringAlgo, LogDebug, BXVector< T >::push_back(), BXVector< T >::setBXRange(), l1t::RegionalMuonCand::setHwDXY(), l1t::RegionalMuonCand::setHwPt2(), and l1t::RegionalMuonCand::setLink().

Referenced by ~BMTFUnpackerOutput().

13  {
14  unsigned int blockId = block.header().getID();
15  LogDebug("L1T") << "Block ID: " << blockId << " size: " << block.header().getSize();
16 
17  //ZeroSupression Handler
18  BxBlocks bxBlocks;
19  bool ZS_enabled = (bool)((block.header().getFlags() >> 1) & 0x01);//getFlags() returns first 8-bits from the amc header
20  if (ZS_enabled)
21  bxBlocks = block.getBxBlocks((unsigned int)6, true);//it returnes 7-32bit bxBlocks originated from the amc13 Block
22  else
23  bxBlocks = block.getBxBlocks((unsigned int)6, false);//it returnes 6-32bit bxBlocks originated from the amc13 Block
24 
26  if (isTriggeringAlgo)
27  res = static_cast<BMTFCollections*>(coll)->getBMTFMuons();
28  else
29  res = static_cast<BMTFCollections*>(coll)->getBMTF2Muons();
30 
31  //BxBlocks changed the format of the blocks
32  int firstBX = 0, lastBX = 0;
33  int nBX = 0;
34  if (!bxBlocks.empty()) {
35  nBX = bxBlocks[0].header().getTotalBx();//how many BX included in the BxBlock before Suppression
36  getBXRange(nBX, firstBX, lastBX);
37  res->setBXRange(firstBX, lastBX);
38  }
39  else {
40  res->setBXRange(-2, 2);
41  LogDebug("L1T") << "No BXs included in the given Block. Set the BXRange to be (-2,2).";
42  return true;
43  }
44 
45  LogDebug("L1T") << "nBX = " << nBX << " firstBX = " << firstBX << " lastBX = " << lastBX;
46 
47  int processor = block.amc().getBoardID() - 1;
48  if ( processor < 0 || processor > 11 )
49  {
50  edm::LogInfo ("l1t:stage2::BMTFUnpackerOutput::unpack") << "Processor found out of range so it will be calculated by the old way";
51  if ( block.amc().getAMCNumber()%2 != 0 )
52  processor = block.amc().getAMCNumber()/2 ;
53  else
54  processor = 6 + (block.amc().getAMCNumber()/2 -1);
55  }
56 
57  for (auto bxBlock : bxBlocks) {
58  int ibx = bxBlock.header().getBx();
59 
60  for (auto iw = 0; iw < 6; iw+=2) {
61  uint32_t raw_first = bxBlock.payload()[iw];//payload[ip+(ibx+lastBX)*6];
62  uint32_t raw_secnd = bxBlock.payload()[iw+1];//payload[ip+(ibx+lastBX)*6];
63  if ( raw_first == 0 )
64  {
65  LogDebug("L1T") << "Raw data is zero";
66  continue;
67  }
68 
69  RegionalMuonCand muCand;
70  RegionalMuonRawDigiTranslator::fillRegionalMuonCand(muCand, raw_first, raw_secnd, processor, tftype::bmtf);
71 
72  if (muCand.hwQual() == 0)
73  continue;
74 
75  muCand.setLink(48 + processor); //the link corresponds to the uGMT input
76  if (isKalman) {
77  muCand.setHwPt2((raw_secnd >> 23) & 0xFF);
78  muCand.setHwDXY((raw_secnd >> 2) & 0x3);
79  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi() << " diplacedPt = " << muCand.hwPt2();
80  }
81  else
82  LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi();
83 
84  res->push_back(ibx, muCand);
85 
86  }//for iw
87  }//for ibx
88 
89  return true;
90  }//unpack
#define LogDebug(id)
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
void getBXRange(int nbx, int &first, int &last)
Definition: Electron.h:6
JetCorrectorParametersCollection coll
Definition: classes.h:10
std::vector< BxBlock > BxBlocks
Definition: BxBlock.h:68
static void fillRegionalMuonCand(RegionalMuonCand &, uint32_t, uint32_t, int, tftype)

Member Data Documentation

bool l1t::stage2::BMTFUnpackerOutput::isKalman
private

Definition at line 27 of file BMTFUnpackerOutput.h.

Referenced by BMTFUnpackerOutput(), setKalmanAlgoTrue(), and unpack().

bool l1t::stage2::BMTFUnpackerOutput::isTriggeringAlgo
private

Definition at line 26 of file BMTFUnpackerOutput.h.

Referenced by BMTFUnpackerOutput(), and unpack().