CMS 3D CMS Logo

Namespaces | Functions
LegacyPhysCandUnpacker.cc File Reference
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
#include "CaloCollections.h"
#include "LegacyPhysCandUnpacker.h"

Go to the source code of this file.

Namespaces

 l1t
 delete x;
 
 l1t::stage1
 
 l1t::stage1::legacy
 

Functions

template<typename T , typename F >
bool process (const l1t::Block &block, BXVector< T > *coll, F modify)
 
static const l1t::UnpackerFactoryT::PMaker< l1t::stage1::legacy::IsoEGammaUnpackers_maker__LINE__ ("l1t::stage1::legacy::IsoEGammaUnpacker")
 
static const l1t::UnpackerFactoryT::PMaker< l1t::stage1::legacy::NonIsoEGammaUnpackers_maker__LINE__ ("l1t::stage1::legacy::NonIsoEGammaUnpacker")
 
static const l1t::UnpackerFactoryT::PMaker< l1t::stage1::legacy::CentralJetUnpackers_maker__LINE__ ("l1t::stage1::legacy::CentralJetUnpacker")
 
static const l1t::UnpackerFactoryT::PMaker< l1t::stage1::legacy::ForwardJetUnpackers_maker__LINE__ ("l1t::stage1::legacy::ForwardJetUnpacker")
 
static const l1t::UnpackerFactoryT::PMaker< l1t::stage1::legacy::TauUnpackers_maker__LINE__ ("l1t::stage1::legacy::TauUnpacker")
 
static const l1t::UnpackerFactoryT::PMaker< l1t::stage1::legacy::IsoTauUnpackers_maker__LINE__ ("l1t::stage1::legacy::IsoTauUnpacker")
 

Function Documentation

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

Definition at line 10 of file LegacyPhysCandUnpacker.cc.

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

Referenced by l1t::stage1::legacy::IsoEGammaUnpacker::unpack(), l1t::stage1::legacy::NonIsoEGammaUnpacker::unpack(), l1t::stage1::legacy::CentralJetUnpacker::unpack(), l1t::stage1::legacy::ForwardJetUnpacker::unpack(), l1t::stage1::legacy::TauUnpacker::unpack(), and l1t::stage1::legacy::IsoTauUnpacker::unpack().

10  {
11  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
12 
13  int nBX, firstBX, lastBX;
14  nBX = int(ceil(block.header().getSize() / 2.));
15  l1t::getBXRange(nBX, firstBX, lastBX);
16 
17  coll->setBXRange(firstBX, lastBX);
18 
19  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
20 
21  // Initialise index
22  int unsigned i = 0;
23 
24  // Loop over multiple BX and then number of jets filling jet collection
25  for (int bx=firstBX; bx<=lastBX; bx++){
26  uint32_t raw_data0 = block.payload()[i++];
27  uint32_t raw_data1 = block.payload()[i++];
28 
29  uint16_t candbit[4];
30  candbit[0] = raw_data0 & 0xFFFF;
31  candbit[1] = (raw_data0 >> 16) & 0xFFFF;
32  candbit[2] = raw_data1 & 0xFFFF;
33  candbit[3] = (raw_data1 >> 16) & 0xFFFF;
34 
35  for (int icand=0;icand<4;icand++){
36 
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  coll->push_back(bx, modify(cand));
53  }
54  }
55 
56  return true;
57 }
#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 setBXRange(int bxFirst, int bxLast)
unsigned int getSize() const
Definition: Block.h:23
long double T
void push_back(int bx, T object)
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::legacy::IsoEGammaUnpacker > s_maker__LINE__ ( "l1t::stage1::legacy::IsoEGammaUnpacker"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::legacy::NonIsoEGammaUnpacker > s_maker__LINE__ ( "l1t::stage1::legacy::NonIsoEGammaUnpacker"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::legacy::CentralJetUnpacker > s_maker__LINE__ ( "l1t::stage1::legacy::CentralJetUnpacker"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::legacy::ForwardJetUnpacker > s_maker__LINE__ ( "l1t::stage1::legacy::ForwardJetUnpacker"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::legacy::TauUnpacker > s_maker__LINE__ ( "l1t::stage1::legacy::TauUnpacker"  )
static
static const l1t::UnpackerFactoryT ::PMaker< l1t::stage1::legacy::IsoTauUnpacker > s_maker__LINE__ ( "l1t::stage1::legacy::IsoTauUnpacker"  )
static