21 float sigmadeltap = 0.0;
28 float corr_energy = 0.0;
29 float trajpoint = 0.0;
37 float muon_dt_hits = 0.0;
38 float muon_csc_hits = 0.0;
39 float muon_type = 0.0;
40 float cluster_flags = 0.0;
41 float gsf_electronseed_trkorecal = 0.0;
45 const auto& matched_pftrack = orig.
trackRefPF();
46 if (matched_pftrack.isNonnull()) {
49 if (atHCAL.isValid()) {
50 eta_hcal = atHCAL.positionREP().eta();
51 phi_hcal = atHCAL.positionREP().phi();
53 if (atECAL.isValid()) {
54 eta_ecal = atECAL.positionREP().eta();
55 phi_ecal = atECAL.positionREP().phi();
66 charge = ref->charge();
67 num_hits = ref->recHitsSize();
73 muon_dt_hits = standAloneMu->hitPattern().numberOfValidMuonDTHits();
74 muon_csc_hits = standAloneMu->hitPattern().numberOfValidMuonCSCHits();
76 muon_type = muonRef->type();
81 const auto& ref = orig2->GsftrackRef();
82 trajpoint = orig2->indTrajPoint();
83 if (ref.isNonnull()) {
84 deltap = orig2->DeltaP();
85 sigmadeltap = orig2->SigmaDeltaP();
93 charge = ref->charge();
96 const auto& gsfextraref = ref->extra();
97 if (gsfextraref.isAvailable() && gsfextraref->seedRef().isAvailable()) {
100 if (seedref->isEcalDriven()) {
101 gsf_electronseed_trkorecal = 1.0;
102 }
else if (seedref->isTrackerDriven()) {
103 gsf_electronseed_trkorecal = 2.0;
111 const auto& vec = orig2->Pin();
118 energy = vec.energy();
120 const auto&
vec2 = orig2->Pout();
121 eta_ecal =
vec2.eta();
122 phi_ecal =
vec2.phi();
124 if (!orig2->GsftrackRefPF().isNull()) {
125 charge = orig2->GsftrackRefPF()->charge();
126 num_hits = orig2->GsftrackRefPF()->PFRecBrem().size();
129 const auto& ref = orig2->GsftrackRef();
131 const auto& gsfextraref = ref->extra();
132 if (gsfextraref.isAvailable() && gsfextraref->seedRef().isAvailable()) {
135 if (seedref->isEcalDriven()) {
136 gsf_electronseed_trkorecal = 1.0;
137 }
else if (seedref->isTrackerDriven()) {
138 gsf_electronseed_trkorecal = 2.0;
148 if (ref.isNonnull()) {
149 cluster_flags = ref->flags();
153 px = ref->position().x();
154 py = ref->position().y();
155 pz = ref->position().z();
156 energy = ref->energy();
157 corr_energy = ref->correctedEnergy();
158 layer = ref->layer();
159 depth = ref->depth();
160 num_hits = ref->recHitFractions().size();
164 if (clref.isNonnull()) {
165 cluster_flags = clref->flags();
168 px = clref->position().x();
169 py = clref->position().y();
170 pz = clref->position().z();
171 energy = clref->energy();
172 num_hits = clref->clustersSize();
200 gsf_electronseed_trkorecal,
216 int argMax(std::vector<float>
const& vec) {
217 return static_cast<int>(
std::distance(vec.begin(), max_element(vec.begin(), vec.end())));
227 float pred_phi = std::atan2(pred_sin_phi, pred_cos_phi);
231 if (pred_pid == 11 || pred_pid == 13 || pred_pid == 211) {
232 charge = pred_charge > 0 ? +1 : -1;
240 else if (pred_pid == 130)
242 else if (pred_pid == 22)
244 else if (pred_pid == 11)
246 else if (pred_pid == 13)
248 else if (pred_pid == 1)
250 else if (pred_pid == 2)
264 std::vector<reco::PFCandidate> pOutputCandidateCollection;
266 std::vector<const reco::PFBlockElement*> all_elements;
267 for (
const auto&
block : blocks) {
268 const auto& elems =
block.elements();
269 for (
const auto& elem : elems) {
271 all_elements.push_back(&elem);
274 edm::LogError(
"MLPFProducer") <<
"too many input PFElements for predefined model size: " << elems.size();
285 const std::vector<const reco::PFBlockElement*> elems,
286 size_t ielem_originator) {
293 cand.
setVertex(eltTrack->trackRef()->vertex());
300 const auto& muonRef = eltTrack->
muonRef();
303 cand.
setVertex(muonRef->track()->vertex());
Abstract base class for a PFBlock element (track, cluster...)
int Charge
electric charge type
virtual const MuonRef & muonRef() const
const reco::GsfTrackRef & GsftrackRef() const
ParticleType
particle types
bool isNonnull() const
Checks for non-null.
void setMass(double m) final
set particle mass
void setPositionAtECALEntrance(const math::XYZPointF &pos)
set position at ECAL entrance
std::array< float, NUM_ELEMENT_FEATURES > getElementProperties(const reco::PFBlockElement &orig)
int argMax(std::vector< float > const &vec)
constexpr bool isNotFinite(T x)
Log< level::Error, false > LogError
const std::vector< const reco::PFBlockElement * > getPFElements(const reco::PFBlockCollection &blocks)
void setVertex(const Point &vertex) override
set vertex
constexpr std::array< uint8_t, layerIndexSize > layer
int pdgId() const final
PDG identifier.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setMuonTrackType(const reco::Muon::MuonTrackType &type)
set the Best Muon Track Ref
Abs< T >::type abs(const T &t)
const reco::MuonRef & muonRef() const override
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiE4D< double > > PtEtaPhiELorentzVectorD
Lorentz vector with cartesian internal representation.
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
reco::PFCandidate makeCandidate(int pred_pid, int pred_charge, float pred_pt, float pred_eta, float pred_sin_phi, float pred_cos_phi, float pred_e)
virtual const PFRecTrackRef & trackRefPF() const
static const std::map< int, int > elem_type_encoding
void setGsfTrackRef(const reco::GsfTrackRef &ref)
set gsftrack reference
void setCandidateRefs(reco::PFCandidate &cand, const std::vector< const reco::PFBlockElement * > elems, size_t ielem_originator)
float normalize(float in)
Particle reconstructed by the particle flow algorithm.
void setMuonRef(const reco::MuonRef &ref)
set muon reference
static constexpr float PI_MASS
virtual const reco::TrackRef & trackRef() const
void setTrackRef(const reco::TrackRef &ref)
set track reference
static constexpr int NUM_MAX_ELEMENTS_BATCH