19 [[maybe_unused]]
float deltap = 0.0;
20 [[maybe_unused]]
float sigmadeltap = 0.0;
21 [[maybe_unused]]
float px = 0.0;
22 [[maybe_unused]]
float py = 0.0;
23 [[maybe_unused]]
float pz = 0.0;
27 float trajpoint = 0.0;
35 float muon_dt_hits = 0.0;
36 float muon_csc_hits = 0.0;
39 const auto& matched_pftrack = orig.
trackRefPF();
40 if (matched_pftrack.isNonnull()) {
43 if (atHCAL.isValid()) {
44 eta_hcal = atHCAL.positionREP().eta();
45 phi_hcal = atHCAL.positionREP().phi();
47 if (atECAL.isValid()) {
48 eta_ecal = atECAL.positionREP().eta();
49 phi_ecal = atECAL.positionREP().phi();
60 charge = ref->charge();
66 muon_dt_hits = standAloneMu->hitPattern().numberOfValidMuonDTHits();
67 muon_csc_hits = standAloneMu->hitPattern().numberOfValidMuonCSCHits();
73 const auto& ref = orig2->GsftrackRef();
74 if (ref.isNonnull()) {
75 deltap = orig2->DeltaP();
76 sigmadeltap = orig2->SigmaDeltaP();
84 trajpoint = orig2->indTrajPoint();
85 charge = ref->charge();
90 const auto& vec = orig2->Pin();
97 energy = vec.energy();
98 if (!orig2->GsftrackRefPF().isNull()) {
99 charge = orig2->GsftrackRefPF()->charge();
106 if (ref.isNonnull()) {
109 px = ref->position().x();
110 py = ref->position().y();
111 pz = ref->position().z();
112 energy = ref->energy();
113 layer = ref->layer();
114 depth = ref->depth();
118 if (clref.isNonnull()) {
121 px = clref->position().x();
122 py = clref->position().y();
123 pz = clref->position().z();
124 energy = clref->energy();
131 return std::array<float, NUM_ELEMENT_FEATURES>({{typ_idx,
158 int argMax(std::vector<float>
const& vec) {
159 return static_cast<int>(
std::distance(vec.begin(), max_element(vec.begin(), vec.end())));
167 float pred_pt = pred_e / cosh(pred_eta);
171 if (pred_pid == 11 || pred_pid == 13 || pred_pid == 211) {
172 charge = pred_charge > 0 ? +1 : -1;
180 cand.setCharge(charge);
186 std::vector<reco::PFCandidate> pOutputCandidateCollection;
188 std::vector<const reco::PFBlockElement*> all_elements;
189 for (
const auto&
block : blocks) {
190 const auto& elems =
block.elements();
191 for (
const auto& elem : elems) {
193 all_elements.push_back(&elem);
196 edm::LogError(
"MLPFProducer") <<
"too many input PFElements for predefined model size: " << elems.size();
205 const std::vector<const reco::PFBlockElement*> elems,
206 size_t ielem_originator) {
213 const auto& muonref = elem->
muonRef();
214 if (muonref.isNonnull()) {
Abstract base class for a PFBlock element (track, cluster...)
int Charge
electric charge type
virtual const MuonRef & muonRef() const
ParticleType
particle types
bool isNonnull() const
Checks for non-null.
std::array< float, NUM_ELEMENT_FEATURES > getElementProperties(const reco::PFBlockElement &orig)
int argMax(std::vector< float > const &vec)
constexpr bool isNotFinite(T x)
virtual const PFClusterRef & clusterRef() const
Log< level::Error, false > LogError
const std::vector< const reco::PFBlockElement * > getPFElements(const reco::PFBlockCollection &blocks)
constexpr std::array< uint8_t, layerIndexSize > layer
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Abs< T >::type abs(const T &t)
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiE4D< double > > PtEtaPhiELorentzVectorD
Lorentz vector with cartesian internal representation.
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
virtual const PFRecTrackRef & trackRefPF() const
static const std::map< int, int > elem_type_encoding
void setCandidateRefs(reco::PFCandidate &cand, const std::vector< const reco::PFBlockElement * > elems, size_t ielem_originator)
constexpr valType make0To2pi(valType angle)
float normalize(float in)
Particle reconstructed by the particle flow algorithm.
void setMuonRef(const reco::MuonRef &ref)
set muon reference
virtual const reco::TrackRef & trackRef() const
void setTrackRef(const reco::TrackRef &ref)
set track reference
reco::PFCandidate makeCandidate(int pred_pid, int pred_charge, float pred_e, float pred_eta, float pred_phi)
void setPdgId(int pdgId) final
int charge() const final
electric charge
static constexpr int NUM_MAX_ELEMENTS_BATCH