CMS 3D CMS Logo

MLPFModel.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFProducer_interface_MLPFModel
2 #define RecoParticleFlow_PFProducer_interface_MLPFModel
3 
7 
8 namespace reco::mlpf {
9  //The model takes the following number of features for each input PFElement
10  static constexpr unsigned int NUM_ELEMENT_FEATURES = 15;
11 
12  //these are defined at model creation time and set the random LSH codebook size
13  static constexpr int NUM_MAX_ELEMENTS_BATCH = 20000;
14  static constexpr int LSH_BIN_SIZE = 100;
15 
16  //In CPU mode, we only want to evaluate each event separately
17  static constexpr int BATCH_SIZE = 1;
18 
19  //The model has 12 outputs for each particle:
20  // out[0-7]: particle classification logits
21  // out[8]: regressed eta
22  // out[9]: regressed phi
23  // out[10]: regressed energy
24  // out[11]: regressed charge logit
25  static constexpr unsigned int NUM_OUTPUTS = 12;
26  static constexpr unsigned int NUM_CLASS = 7;
27  static constexpr unsigned int IDX_ETA = 8;
28  static constexpr unsigned int IDX_PHI = 9;
29  static constexpr unsigned int IDX_ENERGY = 10;
30  static constexpr unsigned int IDX_CHARGE = 11;
31 
32  //index [0, N_pdgids) -> PDGID
33  //this maps the absolute values of the predicted PDGIDs to an array of ascending indices
34  static const std::vector<int> pdgid_encoding = {0, 1, 2, 11, 13, 22, 130, 211};
35 
36  //PFElement::type -> index [0, N_types)
37  //this maps the type of the PFElement to an ascending index that is used by the model to distinguish between different elements
38  static const std::map<int, int> elem_type_encoding = {
39  {0, 0},
40  {1, 1},
41  {2, 2},
42  {3, 3},
43  {4, 4},
44  {5, 5},
45  {6, 6},
46  {7, 7},
47  {8, 8},
48  {9, 9},
49  {10, 10},
50  {11, 11},
51  };
52 
53  std::array<float, NUM_ELEMENT_FEATURES> getElementProperties(const reco::PFBlockElement& orig);
54  float normalize(float in);
55 
56  int argMax(std::vector<float> const& vec);
57 
58  reco::PFCandidate makeCandidate(int pred_pid, int pred_charge, float pred_e, float pred_eta, float pred_phi);
59 
60  const std::vector<const reco::PFBlockElement*> getPFElements(const reco::PFBlockCollection& blocks);
61 
63  const std::vector<const reco::PFBlockElement*> elems,
64  size_t ielem_originator);
65 }; // namespace reco::mlpf
66 
67 #endif
reco::mlpf::IDX_ENERGY
static constexpr unsigned int IDX_ENERGY
Definition: MLPFModel.h:29
PFCandidate.h
reco::mlpf::normalize
float normalize(float in)
Definition: MLPFModel.cc:149
reco::mlpf::IDX_CHARGE
static constexpr unsigned int IDX_CHARGE
Definition: MLPFModel.h:30
reco::mlpf::LSH_BIN_SIZE
static constexpr int LSH_BIN_SIZE
Definition: MLPFModel.h:14
reco::mlpf::makeCandidate
reco::PFCandidate makeCandidate(int pred_pid, int pred_charge, float pred_e, float pred_eta, float pred_phi)
Definition: MLPFModel.cc:162
reco::mlpf::elem_type_encoding
static const std::map< int, int > elem_type_encoding
Definition: MLPFModel.h:38
reco::mlpf::NUM_CLASS
static constexpr unsigned int NUM_CLASS
Definition: MLPFModel.h:26
reco::mlpf::setCandidateRefs
void setCandidateRefs(reco::PFCandidate &cand, const std::vector< const reco::PFBlockElement * > elems, size_t ielem_originator)
Definition: MLPFModel.cc:204
reco::mlpf::NUM_MAX_ELEMENTS_BATCH
static constexpr int NUM_MAX_ELEMENTS_BATCH
Definition: MLPFModel.h:13
PFBlockElement.h
reco::mlpf::getElementProperties
std::array< float, NUM_ELEMENT_FEATURES > getElementProperties(const reco::PFBlockElement &orig)
Definition: MLPFModel.cc:15
reco::PFBlockCollection
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:10
reco::mlpf::NUM_ELEMENT_FEATURES
static constexpr unsigned int NUM_ELEMENT_FEATURES
Definition: MLPFModel.h:10
Event.h
reco::mlpf::BATCH_SIZE
static constexpr int BATCH_SIZE
Definition: MLPFModel.h:17
recoMuon::in
Definition: RecoMuonEnumerators.h:6
reco::mlpf::pdgid_encoding
static const std::vector< int > pdgid_encoding
Definition: MLPFModel.h:34
cand
Definition: decayParser.h:32
reco::mlpf::getPFElements
const std::vector< const reco::PFBlockElement * > getPFElements(const reco::PFBlockCollection &blocks)
Definition: MLPFModel.cc:185
reco::PFBlockElement
Abstract base class for a PFBlock element (track, cluster...)
Definition: PFBlockElement.h:26
reco::mlpf::IDX_ETA
static constexpr unsigned int IDX_ETA
Definition: MLPFModel.h:27
reco::mlpf::NUM_OUTPUTS
static constexpr unsigned int NUM_OUTPUTS
Definition: MLPFModel.h:25
reco::mlpf::IDX_PHI
static constexpr unsigned int IDX_PHI
Definition: MLPFModel.h:28
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
reco::mlpf
Definition: MLPFModel.h:8
reco::mlpf::argMax
int argMax(std::vector< float > const &vec)
Definition: MLPFModel.cc:158
gather_cfg.blocks
blocks
Definition: gather_cfg.py:90