CMS 3D CMS Logo

UnpackerFactory.cc
Go to the documentation of this file.
1 #include "UnpackerFactory.h"
2 
4 
5 #include <cmath>
6 
8 
9 namespace l1t {
10  const UnpackerFactory UnpackerFactory::instance_;
11 
12  void getBXRange(int nbx, int& first, int& last) {
13  last = std::floor(nbx / 2.);
14  first = std::min(0, -last + (1 - nbx % 2));
15  }
16 
17  std::shared_ptr<Unpacker> UnpackerFactory::make(const std::string& name) const {
18  auto unpacker = std::shared_ptr<Unpacker>(UnpackerFactoryT::get()->create("l1t::" + name));
19 
20  if (unpacker.get() == nullptr) {
21  throw edm::Exception(edm::errors::Configuration, "NoSourceModule") << "Cannot find an unpacker named " << name;
22  }
23 
24  return unpacker;
25  }
26 } // namespace l1t
void getBXRange(int nbx, int &first, int &last)
delete x;
Definition: CaloConfig.h:22
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:88
static const UnpackerFactory instance_
#define get
std::shared_ptr< Unpacker > make(const std::string &) const