test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 9 of file PhysCandUnpacker.cc.

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

9  {
10  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
11 
12  int nBX, firstBX, lastBX;
13  nBX = int(ceil(block.header().getSize() / 2.));
14  l1t::getBXRange(nBX, firstBX, lastBX);
15 
16  coll->setBXRange(firstBX, lastBX);
17 
18  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
19 
20  // Initialise index
21  int unsigned i = 0;
22 
23  // Loop over multiple BX and then number of jets filling jet collection
24  for (int bx=firstBX; bx<=lastBX; bx++){
25 
26  if(!istau)coll->resize(bx,8);
27  else 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 
38  int candPt=candbit[icand] & 0x3F;
39  int candEta=(candbit[icand]>>6 ) & 0x7;
40  int candEtasign=(candbit[icand]>>9) & 0x1;
41  int candPhi=(candbit[icand]>>10) & 0x1F;
42 
43  T cand;
44  cand.setHwPt(candPt);
45  cand.setHwEta((candEtasign << 3) | candEta);
46  cand.setHwPhi(candPhi);
47  //int qualflag=cand.hwQual();
48  //qualflag|= (candPt == 0x3F);
49  //cand.setHwQual(qualflag);
50 
51  /* std::cout << "cand: eta " << cand.hwEta() << " phi " << cand.hwPhi() << " pT " << cand.hwPt() << " qual " << cand.hwQual() << std::endl; */
52  //std::cout << cand.hwPt() << " @ " << cand.hwEta() << ", " << cand.hwPhi() << " > " << cand.hwQual() << " > " << cand.hwIso() << std::endl;
53 
54  if(isfirst){
55  if(isleft){
56  coll->set(bx, 2*icand,modify(cand));
57  }
58  else if (!isleft){
59  coll->set(bx, 2*icand+1,modify(cand));
60  }
61  }
62  else if (!isfirst){
63  if(isleft){
64  coll->set(bx, 2*icand+4,modify(cand));
65  }
66  else if (!isleft){
67  coll->set(bx, 2*icand+5,modify(cand));
68  }
69  }
70  }
71  }
72 
73  return true;
74 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
unsigned int getID() const
Definition: Block.h:22
void getBXRange(int nbx, int &first, int &last)
BlockHeader header() const
Definition: Block.h:56
std::vector< uint32_t > payload() const
Definition: Block.h:57
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:23
long double T
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