CMS 3D CMS Logo

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

#include <EGammaUnpacker.h>

Inheritance diagram for l1t::stage2::EGammaUnpacker:
l1t::Unpacker

Public Member Functions

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

Private Attributes

unsigned int EGammaCopy_
 

Detailed Description

Definition at line 8 of file EGammaUnpacker.h.

Constructor & Destructor Documentation

l1t::stage2::EGammaUnpacker::EGammaUnpacker ( )

Definition at line 13 of file EGammaUnpacker.cc.

13  : EGammaCopy_(0)
14  {
15  }
l1t::stage2::EGammaUnpacker::~EGammaUnpacker ( )
inlineoverride

Definition at line 11 of file EGammaUnpacker.h.

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

11 {};

Member Function Documentation

void l1t::stage2::EGammaUnpacker::setEGammaCopy ( const unsigned int  copy)
inline

Definition at line 15 of file EGammaUnpacker.h.

References popcon2dropbox::copy(), and EGammaCopy_.

15 { EGammaCopy_ = copy; };
def copy(args, dbName)
bool l1t::stage2::EGammaUnpacker::unpack ( const Block block,
UnpackerCollections coll 
)
overridevirtual

Implements l1t::Unpacker.

Definition at line 18 of file EGammaUnpacker.cc.

References coll, DEFINE_L1T_UNPACKER, ModuleToSequenceAssign::EGamma, EGammaCopy_, l1t::BlockHeader::getID(), l1t::BlockHeader::getSize(), l1t::Block::header(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwIso(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), createfilelist::int, LogDebug, l1t::stage2::layer2::demux::nEGPerLink, l1t::stage2::layer2::mp::nOutputFramePerBX, l1t::CaloTools::p4Demux(), l1t::Block::payload(), l1t::L1Candidate::setHwEta(), l1t::L1Candidate::setHwIso(), l1t::L1Candidate::setHwPhi(), l1t::L1Candidate::setHwPt(), l1t::L1Candidate::setHwQual(), and reco::LeafCandidate::setP4().

Referenced by ~EGammaUnpacker().

19  {
20 
21  using namespace l1t::stage2::layer2;
22 
23  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
24 
25  int nBX = int(ceil(block.header().getSize() / (double) demux::nOutputFramePerBX)); // 6 link frames per BX
26 
27  // Find the central, first and last BXs
28  int firstBX = -(ceil((double)nBX/2.)-1);
29  int lastBX;
30  if (nBX % 2 == 0) {
31  lastBX = ceil((double)nBX/2.);
32  } else {
33  lastBX = ceil((double)nBX/2.)-1;
34  }
35 
36  auto res_ = static_cast<L1TObjectCollections*>(coll)->getEGammas(EGammaCopy_);
37  res_->setBXRange(firstBX, lastBX);
38 
39  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
40 
41  // Loop over multiple BX and then number of EG cands filling collection
42  for (int bx=firstBX; bx<=lastBX; bx++){
43 
44  for (unsigned iEG=0; iEG < demux::nEGPerLink && iEG < block.header().getSize(); iEG++){
45 
46  int iFrame = (bx-firstBX) * demux::nOutputFramePerBX + iEG;
47  uint32_t raw_data = block.payload().at(iFrame);
48 
49  // skip padding to bring EG candidates up to 12 pre BX
50  if (raw_data == 0)
51  continue;
52 
53  l1t::EGamma eg = l1t::EGamma();
54 
55  eg.setHwPt(raw_data & 0x1FF);
56 
57  if (eg.hwPt()==0) continue;
58 
59  int abs_eta = (raw_data >> 9) & 0x7F;
60  if ((raw_data >> 16) & 0x1) {
61  eg.setHwEta(-1*(128-abs_eta));
62  } else {
63  eg.setHwEta(abs_eta);
64  }
65 
66  eg.setHwPhi((raw_data >> 17) & 0xFF);
67  eg.setHwIso((raw_data >> 25) & 0x3);
68  eg.setHwQual((raw_data >> 27) & 0x7); // Assume 3 bits for now? leaves 2 spare bits
69 
70  LogDebug("L1T") << "EG: eta " << eg.hwEta() << " phi " << eg.hwPhi() << " pT " << eg.hwPt() << " iso " << eg.hwIso() << " qual " << eg.hwQual();
71 
72  eg.setP4( l1t::CaloTools::p4Demux(&eg) );
73 
74  res_->push_back(bx,eg);
75 
76  }
77 
78  }
79 
80  return true;
81  }
#define LogDebug(id)
const unsigned int nOutputFramePerBX
void setHwQual(int qual)
Definition: L1Candidate.h:44
int hwPhi() const
Definition: L1Candidate.h:50
int hwIso() const
Definition: L1Candidate.h:52
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
void setHwPhi(int phi)
Definition: L1Candidate.h:43
void setHwIso(int iso)
Definition: L1Candidate.h:45
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.h:48
void setHwPt(int pt)
Definition: L1Candidate.h:41
void setHwEta(int eta)
Definition: L1Candidate.h:42
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:290
void setP4(const LorentzVector &p4) final
set 4-momentum

Member Data Documentation

unsigned int l1t::stage2::EGammaUnpacker::EGammaCopy_
private

Definition at line 15 of file EGammaUnpacker.h.

Referenced by setEGammaCopy(), and unpack().