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
l1t::UnpackerFactory::instance_
static const UnpackerFactory instance_
Definition: UnpackerFactory.h:18
min
T min(T a, T b)
Definition: MathUtil.h:58
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
dqmdumpme.first
first
Definition: dqmdumpme.py:55
EDMException.h
dqmdumpme.last
last
Definition: dqmdumpme.py:56
UnpackerFactory.h
EDM_REGISTER_PLUGINFACTORY
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:89
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1t
delete x;
Definition: CaloConfig.h:22
edmplugin::PluginFactory
Definition: PluginFactory.h:34
get
#define get
l1t::UnpackerFactory::make
std::shared_ptr< Unpacker > make(const std::string &) const
Definition: UnpackerFactory.cc:17
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
l1t::getBXRange
void getBXRange(int nbx, int &first, int &last)
Definition: UnpackerFactory.cc:12
edm::errors::Configuration
Definition: EDMException.h:36