-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
285 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#ifndef RecoParticleFlow_PFProducer_interface_MLPFModel | ||
#define RecoParticleFlow_PFProducer_interface_MLPFModel | ||
|
||
#include "DataFormats/ParticleFlowReco/interface/PFCluster.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFBlock.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h" | ||
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" | ||
|
||
namespace reco::mlpf { | ||
//The model takes the following number of features for each input PFElement | ||
static constexpr unsigned int NUM_ELEMENT_FEATURES = 15; | ||
|
||
//these are defined at model creation time and set the random LSH codebook size | ||
static constexpr int NUM_MAX_ELEMENTS_BATCH = 20000; | ||
static constexpr int LSH_BIN_SIZE = 100; | ||
|
||
//In CPU mode, we only want to evaluate each event separately | ||
static constexpr int BATCH_SIZE = 1; | ||
|
||
//The model has 12 outputs for each particle: | ||
// out[0-7]: particle classification logits | ||
// out[8]: regressed eta | ||
// out[9]: regressed phi | ||
// out[10]: regressed energy | ||
// out[11]: regressed charge logit | ||
static constexpr unsigned int NUM_OUTPUTS = 12; | ||
static constexpr unsigned int NUM_CLASS = 7; | ||
static constexpr unsigned int IDX_ETA = 8; | ||
static constexpr unsigned int IDX_PHI = 9; | ||
static constexpr unsigned int IDX_ENERGY = 10; | ||
static constexpr unsigned int IDX_CHARGE = 11; | ||
|
||
//index [0, N_pdgids) -> PDGID | ||
//this maps the absolute values of the predicted PDGIDs to an array of ascending indices | ||
static const std::vector<int> pdgid_encoding = {0, 1, 2, 11, 13, 22, 130, 211}; | ||
|
||
//PFElement::type -> index [0, N_types) | ||
//this maps the type of the PFElement to an ascending index that is used by the model to distinguish between different elements | ||
static const std::map<int, int> elem_type_encoding = { | ||
{0, 0}, | ||
{1, 1}, | ||
{2, 2}, | ||
{3, 3}, | ||
{4, 4}, | ||
{5, 5}, | ||
{6, 6}, | ||
{7, 7}, | ||
{8, 8}, | ||
{9, 9}, | ||
{10, 10}, | ||
{11, 11}, | ||
}; | ||
|
||
std::array<float, NUM_ELEMENT_FEATURES> get_element_properties(const reco::PFBlockElement& orig); | ||
float normalize(float in); | ||
|
||
int arg_max(std::vector<float> const& vec); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.