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();
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();
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();
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();
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();
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;
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) {
292 cand.setTrackRef(eltTrack->trackRef());
293 cand.setVertex(eltTrack->trackRef()->vertex());
294 cand.setPositionAtECALEntrance(eltTrack->positionAtECALEntrance());
300 const auto& muonRef = eltTrack->
muonRef();
301 cand.setTrackRef(muonRef->track());
302 cand.setMuonTrackType(muonRef->muonBestTrackType());
303 cand.setVertex(muonRef->track()->vertex());
304 cand.setMuonRef(muonRef);
310 cand.setGsfTrackRef(ref);
Abstract base class for a PFBlock element (track, cluster...)
int Charge
electric charge type
ParticleType
particle types
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 reco::TrackRef & trackRef() const
bool isNonnull() const
Checks for non-null.
const reco::GsfTrackRef & GsftrackRef() const
Log< level::Error, false > LogError
virtual const PFRecTrackRef & trackRefPF() const
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)
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)
static const std::map< int, int > elem_type_encoding
float normalize(float in)
Particle reconstructed by the particle flow algorithm.
static constexpr float PI_MASS
void setCandidateRefs(reco::PFCandidate &cand, const std::vector< const reco::PFBlockElement *> elems, size_t ielem_originator)
virtual const MuonRef & muonRef() const
static constexpr int NUM_MAX_ELEMENTS_BATCH