CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
l1t::stage2::GlobalExtBlkUnpacker Class Reference
Inheritance diagram for l1t::stage2::GlobalExtBlkUnpacker:
l1t::Unpacker

Public Member Functions

virtual bool unpack (const Block &block, UnpackerCollections *coll) override
 

Detailed Description

Definition at line 9 of file GlobalExtBlkUnpacker.cc.

Member Function Documentation

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

Implements l1t::Unpacker.

Definition at line 21 of file GlobalExtBlkUnpacker.cc.

References coll, l1t::BlockHeader::getID(), l1t::BlockHeader::getSize(), l1t::Block::header(), LogDebug, and l1t::Block::payload().

22  {
23 
24  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
25 
26  int nBX = int(ceil(block.header().getSize() / 6.)); // FOR GT Not sure what we have here...put at 6 because of 6 frames. Since there are 12 EGamma objects reported per event (see CMS IN-2013/005)
27 
28  // Find the central, first and last BXs
29  int firstBX = -(ceil((double)nBX/2.)-1);
30  int lastBX;
31  if (nBX % 2 == 0) {
32  lastBX = ceil((double)nBX/2.);
33  } else {
34  lastBX = ceil((double)nBX/2.)-1;
35  }
36 
37  auto res_ = static_cast<GTCollections*>(coll)->getExts();
38  res_->setBXRange(firstBX, lastBX);
39 
40  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
41 
42  // Loop over multiple BX and then number of EG cands filling collection
43  for (int bx=firstBX; bx<=lastBX; bx++){
44 
45  // If this is the first block, instantiate GlobalAlg so it is there to fill from mult. blocks
46  if(block.header().getID()==1) {
47 
48  LogDebug("L1T") << "Creating GT External Block for BX =" << bx;
49  GlobalExtBlk tExt = GlobalExtBlk();
50  res_->push_back(bx,tExt);
51 
52  }
53 
54  //fetch from collection
55  GlobalExtBlk ext = res_->at(bx,0);
56 
57  for(unsigned int wd=0; wd<block.header().getSize(); wd++) {
58  uint32_t raw_data = block.payload()[wd];
59  LogDebug("L1T") << " payload word " << wd << " 0x" << hex << raw_data;
60  }
61 
62  // Put the object back into place (Must be better way???)
63  res_->set(bx,0,ext);
64 
65  //ext.print(std::cout);
66 
67  }
68 
69  return true;
70  }
#define LogDebug(id)
JetCorrectorParametersCollection coll
Definition: classes.h:10