File indexing completed on 2024-04-06 12:04:51
0001 #ifndef __PFBlockElementTrack__
0002 #define __PFBlockElementTrack__
0003
0004 #include <iostream>
0005
0006 #include "DataFormats/Math/interface/Point3D.h"
0007
0008 #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h"
0009 #include "DataFormats/ParticleFlowReco/interface/PFRecTrackFwd.h"
0010 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0011
0012 namespace reco {
0013
0014
0015
0016
0017 class PFBlockElementTrack final : public PFBlockElement {
0018 public:
0019 PFBlockElementTrack() {}
0020
0021 PFBlockElementTrack(const PFRecTrackRef& ref);
0022
0023 PFBlockElement* clone() const override { return new PFBlockElementTrack(*this); }
0024
0025 void Dump(std::ostream& out = std::cout, const char* tab = " ") const override;
0026
0027
0028 bool trackType(TrackType trType) const override { return (trackType_ >> trType) & 1; }
0029
0030
0031 void setTrackType(TrackType trType, bool value) override {
0032 if (value)
0033 trackType_ = trackType_ | (1 << trType);
0034 else
0035 trackType_ = trackType_ ^ (1 << trType);
0036 }
0037
0038
0039 void setPositionAtECALEntrance(float x, float y, float z) { positionAtECALEntrance_.SetCoordinates(x, y, z); }
0040
0041
0042 const math::XYZPointF& positionAtECALEntrance() const { return positionAtECALEntrance_; }
0043
0044
0045
0046 const PFRecTrackRef& trackRefPF() const override { return trackRefPF_; }
0047
0048
0049 const reco::TrackRef& trackRef() const override { return trackRef_; }
0050
0051 static constexpr unsigned int kPrimaryMask = 1 << T_TO_DISP;
0052
0053 static constexpr unsigned int kSecondaryMask = (1 << T_FROM_DISP) | (1 << T_FROM_GAMMACONV) | (1 << T_FROM_V0);
0054
0055 static constexpr unsigned int kLinkedToDisplacedVertexMask = kPrimaryMask | kSecondaryMask;
0056
0057
0058 bool isSecondary() const override { return trackType_ & kSecondaryMask; }
0059
0060 bool isPrimary() const override { return trackType_ & kPrimaryMask; }
0061
0062 bool isLinkedToDisplacedVertex() const override { return trackType_ & kLinkedToDisplacedVertexMask; }
0063
0064
0065 const PFDisplacedTrackerVertexRef& displacedVertexRef(TrackType trType) const override {
0066 if (trType == T_TO_DISP)
0067 return displacedVertexDaughterRef_;
0068 else if (trType == T_FROM_DISP)
0069 return displacedVertexMotherRef_;
0070 else
0071 return nullPFDispVertex_;
0072 }
0073
0074
0075 void setDisplacedVertexRef(const PFDisplacedTrackerVertexRef& niref, TrackType trType) override {
0076 if (trType == T_TO_DISP) {
0077 displacedVertexDaughterRef_ = niref;
0078 setTrackType(trType, true);
0079 } else if (trType == T_FROM_DISP) {
0080 displacedVertexMotherRef_ = niref;
0081 setTrackType(trType, true);
0082 }
0083 }
0084
0085
0086 const reco::MuonRef& muonRef() const override { return muonRef_; }
0087
0088
0089 void setMuonRef(const MuonRef& muref) override {
0090 muonRef_ = muref;
0091 setTrackType(MUON, true);
0092 }
0093
0094
0095 const ConversionRefVector& convRefs() const override { return convRefs_; }
0096
0097
0098 void setConversionRef(const ConversionRef& convRef, TrackType trType) override {
0099 convRefs_.push_back(convRef);
0100 setTrackType(trType, true);
0101 }
0102
0103
0104 const VertexCompositeCandidateRef& V0Ref() const override { return v0Ref_; }
0105
0106
0107 void setV0Ref(const VertexCompositeCandidateRef& V0Ref, TrackType trType) override {
0108 v0Ref_ = V0Ref;
0109 setTrackType(trType, true);
0110 }
0111
0112 private:
0113
0114 PFRecTrackRef trackRefPF_;
0115
0116
0117 reco::TrackRef trackRef_;
0118
0119 unsigned int trackType_;
0120
0121
0122 math::XYZPointF positionAtECALEntrance_;
0123
0124
0125 PFDisplacedTrackerVertexRef displacedVertexMotherRef_;
0126
0127
0128 PFDisplacedTrackerVertexRef displacedVertexDaughterRef_;
0129
0130
0131 reco::MuonRef muonRef_;
0132
0133
0134 ConversionRefVector convRefs_;
0135
0136
0137 VertexCompositeCandidateRef v0Ref_;
0138 };
0139 }
0140
0141 #endif