CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Namespaces | Functions
PhysCandUnpacker.cc File Reference
#include "FWCore/Framework/interface/MakerMacros.h"
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
#include "CaloCollections.h"
#include "PhysCandUnpacker.h"

Go to the source code of this file.

Namespaces

 l1t
 delete x;
 
 l1t::stage1
 

Functions

template<typename T , typename F >
bool process (const l1t::Block &block, BXVector< T > *coll, F modify, bool isleft, bool isfirst, bool istau)
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::IsoEGammaUnpackerLeft
s_maker__LINE__ ("l1t::stage1::IsoEGammaUnpackerLeft")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::NonIsoEGammaUnpackerLeft
s_maker__LINE__ ("l1t::stage1::NonIsoEGammaUnpackerLeft")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::CentralJetUnpackerLeft
s_maker__LINE__ ("l1t::stage1::CentralJetUnpackerLeft")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::ForwardJetUnpackerLeft
s_maker__LINE__ ("l1t::stage1::ForwardJetUnpackerLeft")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::TauUnpackerLeft
s_maker__LINE__ ("l1t::stage1::TauUnpackerLeft")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::IsoTauUnpackerLeft
s_maker__LINE__ ("l1t::stage1::IsoTauUnpackerLeft")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::IsoEGammaUnpackerRight
s_maker__LINE__ ("l1t::stage1::IsoEGammaUnpackerRight")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::NonIsoEGammaUnpackerRight
s_maker__LINE__ ("l1t::stage1::NonIsoEGammaUnpackerRight")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::CentralJetUnpackerRight
s_maker__LINE__ ("l1t::stage1::CentralJetUnpackerRight")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::ForwardJetUnpackerRight
s_maker__LINE__ ("l1t::stage1::ForwardJetUnpackerRight")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::TauUnpackerRight
s_maker__LINE__ ("l1t::stage1::TauUnpackerRight")
 
static const
l1t::UnpackerFactoryT::PMaker
< l1t::stage1::IsoTauUnpackerRight
s_maker__LINE__ ("l1t::stage1::IsoTauUnpackerRight")
 

Function Documentation

template<typename T , typename F >
bool process ( const l1t::Block block,
BXVector< T > *  coll,
F  modify,
bool  isleft,
bool  isfirst,
bool  istau 
)

Definition at line 8 of file PhysCandUnpacker.cc.

References makePileupJSON::bx, reco::ceil(), l1t::getBXRange(), l1t::BlockHeader::getID(), l1t::BlockHeader::getSize(), l1t::Block::header(), mps_fire::i, LogDebug, l1t::Block::payload(), BXVector< T >::resize(), BXVector< T >::set(), and BXVector< T >::setBXRange().

8  {
9  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
10 
11  int nBX, firstBX, lastBX;
12  nBX = int(ceil(block.header().getSize() / 2.));
13  l1t::getBXRange(nBX, firstBX, lastBX);
14 
15  coll->setBXRange(firstBX, lastBX);
16 
17  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
18 
19  // Initialise index
20  int unsigned i = 0;
21 
22  // Loop over multiple BX and then number of jets filling jet collection
23  for (int bx = firstBX; bx <= lastBX; bx++) {
24  if (!istau)
25  coll->resize(bx, 8);
26  else
27  coll->resize(bx, 4);
28 
29  uint32_t raw_data0 = block.payload()[i++];
30  uint32_t raw_data1 = block.payload()[i++];
31 
32  uint16_t candbit[2];
33  candbit[0] = raw_data0 & 0xFFFF;
34  candbit[1] = raw_data1 & 0xFFFF;
35 
36  for (int icand = 0; icand < 2; icand++) {
37  int candPt = candbit[icand] & 0x3F;
38  int candEta = (candbit[icand] >> 6) & 0x7;
39  int candEtasign = (candbit[icand] >> 9) & 0x1;
40  int candPhi = (candbit[icand] >> 10) & 0x1F;
41 
42  T cand;
43  cand.setHwPt(candPt);
44  cand.setHwEta((candEtasign << 3) | candEta);
45  cand.setHwPhi(candPhi);
46  //int qualflag=cand.hwQual();
47  //qualflag|= (candPt == 0x3F);
48  //cand.setHwQual(qualflag);
49 
50  /* std::cout << "cand: eta " << cand.hwEta() << " phi " << cand.hwPhi() << " pT " << cand.hwPt() << " qual " << cand.hwQual() << std::endl; */
51  //std::cout << cand.hwPt() << " @ " << cand.hwEta() << ", " << cand.hwPhi() << " > " << cand.hwQual() << " > " << cand.hwIso() << std::endl;
52 
53  if (isfirst) {
54  if (isleft) {
55  coll->set(bx, 2 * icand, modify(cand));
56  } else if (!isleft) {
57  coll->set(bx, 2 * icand + 1, modify(cand));
58  }
59  } else if (!isfirst) {
60  if (isleft) {
61  coll->set(bx, 2 * icand + 4, modify(cand));
62  } else if (!isleft) {
63  coll->set(bx, 2 * icand + 5, modify(cand));
64  }
65  }
66  }
67  }
68 
69  return true;
70 }
constexpr int32_t ceil(float num)
const std::vector< uint32_t > & payload() const
Definition: Block.h:86
unsigned int getID() const
Definition: Block.h:43
void getBXRange(int nbx, int &first, int &last)
BlockHeader header() const
Definition: Block.h:85
void set(int bx, unsigned i, const T &object)
void resize(int bx, unsigned size)
void setBXRange(int bxFirst, int bxLast)
unsigned int getSize() const
Definition: Block.h:44
long double T
#define LogDebug(id)
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::IsoEGammaUnpackerLeft > s_maker__LINE__ ( "l1t::stage1::IsoEGammaUnpackerLeft"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::NonIsoEGammaUnpackerLeft > s_maker__LINE__ ( "l1t::stage1::NonIsoEGammaUnpackerLeft"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::CentralJetUnpackerLeft > s_maker__LINE__ ( "l1t::stage1::CentralJetUnpackerLeft"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::ForwardJetUnpackerLeft > s_maker__LINE__ ( "l1t::stage1::ForwardJetUnpackerLeft"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::TauUnpackerLeft > s_maker__LINE__ ( "l1t::stage1::TauUnpackerLeft"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::IsoTauUnpackerLeft > s_maker__LINE__ ( "l1t::stage1::IsoTauUnpackerLeft"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::IsoEGammaUnpackerRight > s_maker__LINE__ ( "l1t::stage1::IsoEGammaUnpackerRight"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::NonIsoEGammaUnpackerRight > s_maker__LINE__ ( "l1t::stage1::NonIsoEGammaUnpackerRight"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::CentralJetUnpackerRight > s_maker__LINE__ ( "l1t::stage1::CentralJetUnpackerRight"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::ForwardJetUnpackerRight > s_maker__LINE__ ( "l1t::stage1::ForwardJetUnpackerRight"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::TauUnpackerRight > s_maker__LINE__ ( "l1t::stage1::TauUnpackerRight"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::IsoTauUnpackerRight > s_maker__LINE__ ( "l1t::stage1::IsoTauUnpackerRight"  )
static