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
13  getBXRange(int nbx, int& first, int& last)
14  {
15  last = std::floor(nbx / 2.);
16  first = std::min(0, -last + (1 - nbx % 2));
17  }
18 
19  std::shared_ptr<Unpacker>
21  {
22  auto unpacker = std::shared_ptr<Unpacker>(UnpackerFactoryT::get()->create("l1t::" + name));
23 
24  if (unpacker.get() == nullptr) {
25  throw edm::Exception(edm::errors::Configuration, "NoSourceModule")
26  << "Cannot find an unpacker named " << name;
27  }
28 
29  return unpacker;
30  }
31 }
void getBXRange(int nbx, int &first, int &last)
delete x;
Definition: CaloConfig.h:22
std::shared_ptr< Unpacker > make(const std::string &) const
T min(T a, T b)
Definition: MathUtil.h:58
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:92
static const UnpackerFactory instance_
T get(const Candidate &c)
Definition: component.h:55