CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1TMuonEndCapForestESProducer Class Reference
Inheritance diagram for L1TMuonEndCapForestESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

using ReturnType = std::unique_ptr< L1TMuonEndCapForest >
 

Public Member Functions

 L1TMuonEndCapForestESProducer (const edm::ParameterSet &)
 
ReturnType produce (const L1TMuonEndCapForestRcd &)
 
 ~L1TMuonEndCapForestESProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Member Functions

L1TMuonEndCapForest::DTree traverse (emtf::Node *tree)
 

Private Attributes

string bdtXMLDir
 
int ptLUTVersion
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Definition at line 23 of file L1TMuonEndCapForestESProducer.cc.

Member Typedef Documentation

◆ ReturnType

Definition at line 28 of file L1TMuonEndCapForestESProducer.cc.

Constructor & Destructor Documentation

◆ L1TMuonEndCapForestESProducer()

L1TMuonEndCapForestESProducer::L1TMuonEndCapForestESProducer ( const edm::ParameterSet iConfig)

Definition at line 41 of file L1TMuonEndCapForestESProducer.cc.

41  {
42  setWhatProduced(this);
43 
44  ptLUTVersion = iConfig.getParameter<int>("PtAssignVersion");
45  bdtXMLDir = iConfig.getParameter<string>("bdtXMLDir");
46 }

References fakeEmtfParams_empty_cff::bdtXMLDir, and edm::ParameterSet::getParameter().

◆ ~L1TMuonEndCapForestESProducer()

L1TMuonEndCapForestESProducer::~L1TMuonEndCapForestESProducer ( )
inlineoverride

Definition at line 26 of file L1TMuonEndCapForestESProducer.cc.

26 {}

Member Function Documentation

◆ produce()

L1TMuonEndCapForestESProducer::ReturnType L1TMuonEndCapForestESProducer::produce ( const L1TMuonEndCapForestRcd iRecord)

Definition at line 94 of file L1TMuonEndCapForestESProducer.cc.

94  {
95  // piggyback on the PtAssignmentEngine class to read the XMLs in
96  PtAssignmentEngine* pt_assign_engine_;
97  std::unique_ptr<PtAssignmentEngine> pt_assign_engine_2016_;
98  std::unique_ptr<PtAssignmentEngine> pt_assign_engine_2017_;
99 
100  pt_assign_engine_2016_ = std::make_unique<PtAssignmentEngine2016>();
101  pt_assign_engine_2017_ = std::make_unique<PtAssignmentEngine2017>();
102 
103  if (ptLUTVersion <= 5)
104  pt_assign_engine_ = pt_assign_engine_2016_.get();
105  else
106  pt_assign_engine_ = pt_assign_engine_2017_.get();
107 
108  pt_assign_engine_->read(ptLUTVersion, bdtXMLDir);
109 
110  // get a hold on the forests; copy to non-const locals
111  std::array<emtf::Forest, 16> forests = pt_assign_engine_->getForests();
112  std::vector<int> allowedModes = pt_assign_engine_->getAllowedModes();
113  // construct empty cond payload
114  auto pEMTFForest = std::make_unique<L1TMuonEndCapForest>();
115  // pack the forests into the cond payload for each mode
116  pEMTFForest->forest_coll_.resize(0);
117  for (unsigned int i = 0; i < allowedModes.size(); i++) {
118  int mode = allowedModes[i];
119  pEMTFForest->forest_map_[mode] = i;
120  // convert emtf::Forest into the L1TMuonEndCapForest::DForest
121  emtf::Forest& forest = forests.at(mode);
122  // Store boostWeight (initial pT value of tree 0) as an integer: boostWeight x 1 million
123  pEMTFForest->forest_map_[mode + 16] = forest.getTree(0)->getBoostWeight() * 1000000;
124  L1TMuonEndCapForest::DForest cond_forest;
125  for (unsigned int j = 0; j < forest.size(); j++)
126  cond_forest.push_back(traverse(forest.getTree(j)->getRootNode()));
127  // of course, move has no effect here, but I'll keep it in case move constructor will be provided some day
128  pEMTFForest->forest_coll_.push_back(std::move(cond_forest));
129  }
130 
131  return pEMTFForest;
132 }

References fakeEmtfParams_empty_cff::bdtXMLDir, PtAssignmentEngine::getAllowedModes(), emtf::Tree::getBoostWeight(), PtAssignmentEngine::getForests(), emtf::Tree::getRootNode(), emtf::Forest::getTree(), mps_fire::i, dqmiolumiharvest::j, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, eostools::move(), PtAssignmentEngine::read(), and emtf::Forest::size().

◆ traverse()

L1TMuonEndCapForest::DTree L1TMuonEndCapForestESProducer::traverse ( emtf::Node tree)
private

Definition at line 50 of file L1TMuonEndCapForestESProducer.cc.

50  {
51  // original implementation use 0 ptr for non-existing children nodes, return empty cond tree (vector of nodes)
52  if (!node)
54  // recur on left and then right child
55  L1TMuonEndCapForest::DTree left_subtree = traverse(node->getLeftDaughter());
56  L1TMuonEndCapForest::DTree right_subtree = traverse(node->getRightDaughter());
57  // allocate tree
58  L1TMuonEndCapForest::DTree cond_tree(1 + left_subtree.size() + right_subtree.size());
59  // copy the local root node
60  L1TMuonEndCapForest::DTreeNode& local_root = cond_tree[0];
61  local_root.splitVar = node->getSplitVariable();
62  local_root.splitVal = node->getSplitValue();
63  local_root.fitVal = node->getFitValue();
64  // shift children indicies and place the subtrees into the newly allocated tree
65  local_root.ileft =
66  (!left_subtree.empty() ? 1 : 0); // left subtree (if exists) is placed right after the root -> index=1
67  transform(left_subtree.cbegin(), // source from
68  left_subtree.cend(), // source till
69  cond_tree.begin() + 1, // destination
70  [](L1TMuonEndCapForest::DTreeNode cond_node) {
71  // increment indecies only for existing children, left 0 for non-existing
72  if (cond_node.ileft)
73  cond_node.ileft += 1;
74  if (cond_node.iright)
75  cond_node.iright += 1;
76  return cond_node;
77  });
78  unsigned int offset = left_subtree.size();
79  local_root.iright = (offset + right_subtree.size() ? 1 + offset : 0); // right subtree is placed after the left one
80  transform(right_subtree.cbegin(), // source from
81  right_subtree.cend(), // source till
82  cond_tree.begin() + 1 + offset, // destination
84  // increment indecies only for existing children, left 0 for non-existing
85  if (cond_node.ileft)
86  cond_node.ileft += 1 + offset;
87  if (cond_node.iright)
88  cond_node.iright += 1 + offset;
89  return cond_node;
90  });
91  return cond_tree;
92 }

References emtf::Node::getFitValue(), emtf::Node::getLeftDaughter(), emtf::Node::getRightDaughter(), emtf::Node::getSplitValue(), emtf::Node::getSplitVariable(), hltrates_dqm_sourceclient-live_cfg::offset, L1TMuonEndCapForest::DTreeNode::splitVar, and HcalDetIdTransform::transform().

Member Data Documentation

◆ bdtXMLDir

string L1TMuonEndCapForestESProducer::bdtXMLDir
private

Definition at line 34 of file L1TMuonEndCapForestESProducer.cc.

◆ ptLUTVersion

int L1TMuonEndCapForestESProducer::ptLUTVersion
private

Definition at line 33 of file L1TMuonEndCapForestESProducer.cc.

mps_fire.i
i
Definition: mps_fire.py:428
PtAssignmentEngine::getAllowedModes
const std::vector< int > & getAllowedModes(void) const
Definition: PtAssignmentEngine.h:26
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
PtAssignmentEngine
Definition: PtAssignmentEngine.h:16
L1TMuonEndCapForestESProducer::ptLUTVersion
int ptLUTVersion
Definition: L1TMuonEndCapForestESProducer.cc:33
PtAssignmentEngine::getForests
const std::array< emtf::Forest, 16 > & getForests(void) const
Definition: PtAssignmentEngine.h:25
emtf::Tree::getBoostWeight
double getBoostWeight(void) const
Definition: Tree.h:57
emtf::Forest::size
unsigned int size()
Definition: Forest.cc:127
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
emtf::Forest::getTree
Tree * getTree(unsigned int i)
Definition: Forest.cc:114
L1TMuonEndCapForest::DTreeNode
Definition: L1TMuonEndCapForest.h:17
L1TMuonEndCapForestESProducer::traverse
L1TMuonEndCapForest::DTree traverse(emtf::Node *tree)
Definition: L1TMuonEndCapForestESProducer.cc:50
emtf::Tree::getRootNode
Node * getRootNode()
Definition: Tree.cc:155
L1TMuonEndCapForest::DTree
std::vector< DTreeNode > DTree
Definition: L1TMuonEndCapForest.h:31
emtf::Forest
Definition: Forest.h:12
L1TMuonEndCapForest::DForest
std::vector< DTree > DForest
Definition: L1TMuonEndCapForest.h:32
PtAssignmentEngine::read
void read(int pt_lut_version, const std::string &xml_dir)
Definition: PtAssignmentEngine.cc:14
eostools.move
def move(src, dest)
Definition: eostools.py:511
L1TMuonEndCapForestESProducer::bdtXMLDir
string bdtXMLDir
Definition: L1TMuonEndCapForestESProducer.cc:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
L1TMuonEndCapForest::DTreeNode::splitVar
int splitVar
Definition: L1TMuonEndCapForest.h:23