diff --git a/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml b/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml index 6548b7d588923..f8b1ead65506a 100644 --- a/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml +++ b/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml @@ -1,6 +1,6 @@ - + diff --git a/AnalysisDataFormats/TopObjects/src/classes_def.xml b/AnalysisDataFormats/TopObjects/src/classes_def.xml index ee2f9b9cf6837..bc3ebd1a3a77d 100644 --- a/AnalysisDataFormats/TopObjects/src/classes_def.xml +++ b/AnalysisDataFormats/TopObjects/src/classes_def.xml @@ -1,30 +1,24 @@ - - - - + + - - - + + - - + + - - + + - - - + + - - - + + - - - + + @@ -32,7 +26,6 @@ - @@ -42,18 +35,15 @@ - - - - + - - + + diff --git a/AnalysisDataFormats/TrackInfo/src/classes_def.xml b/AnalysisDataFormats/TrackInfo/src/classes_def.xml index bf91896029484..5df56f94c2da1 100644 --- a/AnalysisDataFormats/TrackInfo/src/classes_def.xml +++ b/AnalysisDataFormats/TrackInfo/src/classes_def.xml @@ -25,7 +25,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/DataFormats/BTauReco/interface/BaseTagInfo.h b/DataFormats/BTauReco/interface/BaseTagInfo.h index cac8aa7c4d7cf..e7862e877935b 100644 --- a/DataFormats/BTauReco/interface/BaseTagInfo.h +++ b/DataFormats/BTauReco/interface/BaseTagInfo.h @@ -8,28 +8,32 @@ #include "DataFormats/BTauReco/interface/TaggingVariable.h" namespace reco { + namespace io_v1 { - class BaseTagInfo { - public: - BaseTagInfo(void) {} + class BaseTagInfo { + public: + BaseTagInfo(void) {} - virtual ~BaseTagInfo(void) {} + virtual ~BaseTagInfo(void) {} - /// clone - virtual BaseTagInfo* clone(void) const { return new BaseTagInfo(*this); } + /// clone + virtual BaseTagInfo* clone(void) const { return new BaseTagInfo(*this); } - /// returns a polymorphic reference to the tagged jet - virtual edm::RefToBase jet(void) const { return edm::RefToBase(); } + /// returns a polymorphic reference to the tagged jet + virtual edm::RefToBase jet(void) const { return edm::RefToBase(); } - /// returns a list of tracks associated to the jet - virtual TrackRefVector tracks(void) const { return TrackRefVector(); } + /// returns a list of tracks associated to the jet + virtual TrackRefVector tracks(void) const { return TrackRefVector(); } - /// check if the algorithm is using the tracks or not - virtual bool hasTracks(void) const { return false; } + /// check if the algorithm is using the tracks or not + virtual bool hasTracks(void) const { return false; } - /// returns a description of the extended informations in a TaggingVariableList - virtual TaggingVariableList taggingVariables(void) const { return TaggingVariableList(); } - }; + /// returns a description of the extended informations in a TaggingVariableList + virtual TaggingVariableList taggingVariables(void) const { return TaggingVariableList(); } + }; + + } // namespace io_v1 + using BaseTagInfo = io_v1::BaseTagInfo; DECLARE_EDM_REFS(BaseTagInfo) diff --git a/DataFormats/BTauReco/interface/JetTagInfo.h b/DataFormats/BTauReco/interface/JetTagInfo.h index 9892806fd646e..8230674a61c13 100644 --- a/DataFormats/BTauReco/interface/JetTagInfo.h +++ b/DataFormats/BTauReco/interface/JetTagInfo.h @@ -5,35 +5,37 @@ #include "DataFormats/BTauReco/interface/BaseTagInfo.h" namespace reco { + namespace io_v1 { - class JetTagInfo : public BaseTagInfo { - public: - JetTagInfo(void) : m_jet() {} + class JetTagInfo : public BaseTagInfo { + public: + JetTagInfo(void) : m_jet() {} - template - JetTagInfo(const edm::Ref& jetRef) : m_jet(jetRef) {} + template + JetTagInfo(const edm::Ref& jetRef) : m_jet(jetRef) {} - JetTagInfo(const edm::RefToBase& jetRef) : m_jet(jetRef) {} + JetTagInfo(const edm::RefToBase& jetRef) : m_jet(jetRef) {} - ~JetTagInfo(void) override {} + ~JetTagInfo(void) override {} - JetTagInfo* clone(void) const override { return new JetTagInfo(*this); } + JetTagInfo* clone(void) const override { return new JetTagInfo(*this); } - edm::RefToBase jet(void) const override { return m_jet; } + edm::RefToBase jet(void) const override { return m_jet; } - template - void setJetRef(const edm::Ref& jetRef) { - m_jet = edm::RefToBase(jetRef); - } + template + void setJetRef(const edm::Ref& jetRef) { + m_jet = edm::RefToBase(jetRef); + } - void setJetRef(const edm::RefToBase& jetRef) { m_jet = edm::RefToBase(jetRef); } + void setJetRef(const edm::RefToBase& jetRef) { m_jet = edm::RefToBase(jetRef); } - protected: - edm::RefToBase m_jet; - }; + protected: + edm::RefToBase m_jet; + }; + } // namespace io_v1 + using JetTagInfo = io_v1::JetTagInfo; DECLARE_EDM_REFS(JetTagInfo) - } // namespace reco #endif // DataFormats_BTauReco_JetTagInfo_h diff --git a/DataFormats/BTauReco/interface/PixelClusterTagInfo.h b/DataFormats/BTauReco/interface/PixelClusterTagInfo.h index 78ce0a8422e94..e39c636968bb7 100644 --- a/DataFormats/BTauReco/interface/PixelClusterTagInfo.h +++ b/DataFormats/BTauReco/interface/PixelClusterTagInfo.h @@ -6,69 +6,70 @@ #include "DataFormats/BTauReco/interface/BaseTagInfo.h" namespace reco { - - struct PixelClusterProperties { - float x = 0; - float y = 0; - float z = 0; - int charge = 0; - unsigned int layer = 0; - }; - - struct PixelClusterData { - std::vector r004; - std::vector r006; - std::vector r008; - std::vector r010; - std::vector r016; - std::vector rvar; - std::vector rvwt; - PixelClusterData(unsigned int l = 4) { - r004 = std::vector(l, 0); - r006 = std::vector(l, 0); - r008 = std::vector(l, 0); - r010 = std::vector(l, 0); - r016 = std::vector(l, 0); - rvar = std::vector(l, 0); - rvwt = std::vector(l, 0); - } - CMS_CLASS_VERSION(3) - }; - - class PixelClusterTagInfo : public BaseTagInfo { - public: - PixelClusterTagInfo() {} - - PixelClusterTagInfo(const PixelClusterData& data, const edm::RefToBase& ref) - : pixelClusters_(data), jetRef_(ref) {} - - ~PixelClusterTagInfo() override {} - - // without overriding clone from base class will be store/retrieved - PixelClusterTagInfo* clone(void) const override { return new PixelClusterTagInfo(*this); } - - // method to set the jet RefToBase - void setJetRef(const edm::RefToBase& ref) { jetRef_ = ref; } - - // method to jet the jet RefToBase - edm::RefToBase jet() const override { return jetRef_; } - - // method to set the PixelClusterData - void setData(const PixelClusterData& data) { pixelClusters_ = data; } - - // method to get the PixelClusterData struct - const PixelClusterData& data() const { return pixelClusters_; } - - CMS_CLASS_VERSION(3) - - private: - PixelClusterData pixelClusters_; - - edm::RefToBase jetRef_; - }; - - typedef std::vector PixelClusterTagInfoCollection; - + namespace io_v1 { + + struct PixelClusterProperties { + float x = 0; + float y = 0; + float z = 0; + int charge = 0; + unsigned int layer = 0; + }; + + struct PixelClusterData { + std::vector r004; + std::vector r006; + std::vector r008; + std::vector r010; + std::vector r016; + std::vector rvar; + std::vector rvwt; + PixelClusterData(unsigned int l = 4) { + r004 = std::vector(l, 0); + r006 = std::vector(l, 0); + r008 = std::vector(l, 0); + r010 = std::vector(l, 0); + r016 = std::vector(l, 0); + rvar = std::vector(l, 0); + rvwt = std::vector(l, 0); + } + }; + + class PixelClusterTagInfo : public BaseTagInfo { + public: + PixelClusterTagInfo() {} + + PixelClusterTagInfo(const PixelClusterData& data, const edm::RefToBase& ref) + : pixelClusters_(data), jetRef_(ref) {} + + ~PixelClusterTagInfo() override {} + + // without overriding clone from base class will be store/retrieved + PixelClusterTagInfo* clone(void) const override { return new PixelClusterTagInfo(*this); } + + // method to set the jet RefToBase + void setJetRef(const edm::RefToBase& ref) { jetRef_ = ref; } + + // method to jet the jet RefToBase + edm::RefToBase jet() const override { return jetRef_; } + + // method to set the PixelClusterData + void setData(const PixelClusterData& data) { pixelClusters_ = data; } + + // method to get the PixelClusterData struct + const PixelClusterData& data() const { return pixelClusters_; } + + private: + PixelClusterData pixelClusters_; + + edm::RefToBase jetRef_; + }; + + } // namespace io_v1 + using PixelClusterProperties = io_v1::PixelClusterProperties; + using PixelClusterData = io_v1::PixelClusterData; + using PixelClusterTagInfo = io_v1::PixelClusterTagInfo; + using PixelClusterTagInfoCollection = std::vector; } // namespace reco #endif // DataFormats_BTauReco_PixelClusterTagInfo_h diff --git a/DataFormats/BTauReco/src/classes_def.xml b/DataFormats/BTauReco/src/classes_def.xml index 934dce458d59e..3a4bb5229af75 100644 --- a/DataFormats/BTauReco/src/classes_def.xml +++ b/DataFormats/BTauReco/src/classes_def.xml @@ -1,7 +1,7 @@ - - + + @@ -10,9 +10,8 @@ - - - + + @@ -22,7 +21,7 @@ - + @@ -41,7 +40,7 @@ - + @@ -51,7 +50,7 @@ - + @@ -62,7 +61,7 @@ - + @@ -73,7 +72,7 @@ - + @@ -84,7 +83,7 @@ - + @@ -94,7 +93,7 @@ - + @@ -133,8 +132,8 @@ - - + + @@ -144,14 +143,13 @@ - - + + - + - - - + + @@ -162,17 +160,17 @@ - + - + - + @@ -188,16 +186,16 @@ - - - - + + + + - - - - + + + + @@ -229,7 +227,7 @@ - + @@ -239,7 +237,7 @@ - + @@ -249,7 +247,7 @@ - + @@ -296,116 +294,116 @@ - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - + + + + + + + + - + - + - - - - + + + + - - - - + + + + @@ -500,12 +498,12 @@ - - - + + + - - + + diff --git a/DataFormats/BeamSpot/interface/BeamSpot.h b/DataFormats/BeamSpot/interface/BeamSpot.h index b25b300e7b21c..4ab6f5a31c859 100644 --- a/DataFormats/BeamSpot/interface/BeamSpot.h +++ b/DataFormats/BeamSpot/interface/BeamSpot.h @@ -17,148 +17,152 @@ #include namespace reco { - - class BeamSpot { - public: - /// beam spot flags - enum BeamType { Unknown = -1, Fake = 0, LHC = 1, Tracker = 2 }; - - /// point in the space - typedef math::XYZPoint Point; - enum { dimension = 7 }; - typedef math::Error::type CovarianceMatrix; - enum { dim3 = 3 }; - typedef math::Error::type Covariance3DMatrix; - enum { resdim = 2 }; - typedef math::Error::type ResCovMatrix; - - /// default constructor - BeamSpot(); - - /// constructor from values - BeamSpot(const Point& point, - double sigmaZ, - double dxdz, - double dydz, - double BeamWidthX, - const CovarianceMatrix& error, - BeamType type = Unknown) { - position_ = point; - sigmaZ_ = sigmaZ; - dxdz_ = dxdz; - dydz_ = dydz; - BeamWidthX_ = BeamWidthX; - BeamWidthY_ = BeamWidthX; - error_ = error; - type_ = type; - emittanceX_ = emittanceY_ = 0; - betaStar_ = 0; - }; - - /// position - const Point& position() const { return position_; } - /// x coordinate - double x0() const { return position_.X(); } - /// y coordinate - double y0() const { return position_.Y(); } - /// z coordinate - double z0() const { return position_.Z(); } - - /// x coordinate of the beeam spot position at a given z value (it takes into account the dxdz slope) - double x(const double z) const { return x0() + dxdz() * (z - z0()); } - /// y coordinate of the beeam spot position at a given z value (it takes into account the dydz slope) - double y(const double z) const { return y0() + dydz() * (z - z0()); } - /// position of the beam spot at a given z value (it takes into account the dxdz and dydz slopes) - const Point position(const double z) const; - // const Point position(const double z) const {Point pos(x(z),y(z),z); return pos;} - - /// sigma z - double sigmaZ() const { return sigmaZ_; } - /// dxdz slope - double dxdz() const { return dxdz_; } - /// dydz slope - double dydz() const { return dydz_; } - /// beam width X - double BeamWidthX() const { return BeamWidthX_; } - /// beam width Y - double BeamWidthY() const { return BeamWidthY_; } - /// error on x - double x0Error() const { return sqrt(error_(0, 0)); } - /// error on y - double y0Error() const { return sqrt(error_(1, 1)); } - /// error on z - double z0Error() const { return sqrt(error_(2, 2)); } - /// error on sigma z - double sigmaZ0Error() const { return sqrt(error_(3, 3)); } - /// error on dxdz - double dxdzError() const { return sqrt(error_(4, 4)); } - /// error on dydz - double dydzError() const { return sqrt(error_(5, 5)); } - - /// error on beam width X, assume error in X = Y - double BeamWidthXError() const { return sqrt(error_(6, 6)); } - /// error on beam width Y, assume error in X = Y - double BeamWidthYError() const { return sqrt(error_(6, 6)); } - - /// - void setBeamWidthX(double v) { BeamWidthX_ = v; } - void setBeamWidthY(double v) { BeamWidthY_ = v; } - - /// (i,j)-th element of error matrix - double covariance(int i, int j) const { return error_(i, j); } - /// return full covariance matrix of dim 7 - CovarianceMatrix covariance() const { return error_; } - /// return only 3D position covariance matrix - Covariance3DMatrix covariance3D() const { - Covariance3DMatrix matrix; - for (int j = 0; j < 3; j++) { - for (int k = j; k < 3; k++) { - matrix(j, k) = error_(j, k); + namespace io_v1 { + + class BeamSpot { + public: + /// beam spot flags + enum BeamType { Unknown = -1, Fake = 0, LHC = 1, Tracker = 2 }; + + /// point in the space + typedef math::XYZPoint Point; + enum { dimension = 7 }; + typedef math::Error::type CovarianceMatrix; + enum { dim3 = 3 }; + typedef math::Error::type Covariance3DMatrix; + enum { resdim = 2 }; + typedef math::Error::type ResCovMatrix; + + /// default constructor + BeamSpot(); + + /// constructor from values + BeamSpot(const Point& point, + double sigmaZ, + double dxdz, + double dydz, + double BeamWidthX, + const CovarianceMatrix& error, + BeamType type = Unknown) { + position_ = point; + sigmaZ_ = sigmaZ; + dxdz_ = dxdz; + dydz_ = dydz; + BeamWidthX_ = BeamWidthX; + BeamWidthY_ = BeamWidthX; + error_ = error; + type_ = type; + emittanceX_ = emittanceY_ = 0; + betaStar_ = 0; + }; + + /// position + const Point& position() const { return position_; } + /// x coordinate + double x0() const { return position_.X(); } + /// y coordinate + double y0() const { return position_.Y(); } + /// z coordinate + double z0() const { return position_.Z(); } + + /// x coordinate of the beeam spot position at a given z value (it takes into account the dxdz slope) + double x(const double z) const { return x0() + dxdz() * (z - z0()); } + /// y coordinate of the beeam spot position at a given z value (it takes into account the dydz slope) + double y(const double z) const { return y0() + dydz() * (z - z0()); } + /// position of the beam spot at a given z value (it takes into account the dxdz and dydz slopes) + const Point position(const double z) const; + // const Point position(const double z) const {Point pos(x(z),y(z),z); return pos;} + + /// sigma z + double sigmaZ() const { return sigmaZ_; } + /// dxdz slope + double dxdz() const { return dxdz_; } + /// dydz slope + double dydz() const { return dydz_; } + /// beam width X + double BeamWidthX() const { return BeamWidthX_; } + /// beam width Y + double BeamWidthY() const { return BeamWidthY_; } + /// error on x + double x0Error() const { return sqrt(error_(0, 0)); } + /// error on y + double y0Error() const { return sqrt(error_(1, 1)); } + /// error on z + double z0Error() const { return sqrt(error_(2, 2)); } + /// error on sigma z + double sigmaZ0Error() const { return sqrt(error_(3, 3)); } + /// error on dxdz + double dxdzError() const { return sqrt(error_(4, 4)); } + /// error on dydz + double dydzError() const { return sqrt(error_(5, 5)); } + + /// error on beam width X, assume error in X = Y + double BeamWidthXError() const { return sqrt(error_(6, 6)); } + /// error on beam width Y, assume error in X = Y + double BeamWidthYError() const { return sqrt(error_(6, 6)); } + + /// + void setBeamWidthX(double v) { BeamWidthX_ = v; } + void setBeamWidthY(double v) { BeamWidthY_ = v; } + + /// (i,j)-th element of error matrix + double covariance(int i, int j) const { return error_(i, j); } + /// return full covariance matrix of dim 7 + CovarianceMatrix covariance() const { return error_; } + /// return only 3D position covariance matrix + Covariance3DMatrix covariance3D() const { + Covariance3DMatrix matrix; + for (int j = 0; j < 3; j++) { + for (int k = j; k < 3; k++) { + matrix(j, k) = error_(j, k); + } } + return matrix; + }; + /// return beam type + BeamType type() const { return type_; } + /// set beam type + void setType(BeamType type) { type_ = type; } + /// + Covariance3DMatrix rotatedCovariance3D() const; + + /// additional information + double emittanceX() const { return emittanceX_; } + double emittanceY() const { return emittanceY_; } + double betaStar() const { return betaStar_; } + double beamWidthFromBeta(double z, double e) const { + return sqrt(e * betaStar_ * (1 + pow((z - position_.Z()) / betaStar_, 2))); } - return matrix; + /// + void setEmittanceX(double v) { emittanceX_ = v; } + void setEmittanceY(double v) { emittanceY_ = v; } + void setbetaStar(double v) { betaStar_ = v; } + + /// print information + void print(std::stringstream& ss) const; + + private: + /// position + Point position_; + /// errors + CovarianceMatrix error_; + + Double32_t sigmaZ_; + Double32_t BeamWidthX_; + Double32_t BeamWidthY_; + Double32_t dxdz_; + Double32_t dydz_; + Double32_t emittanceX_; + Double32_t emittanceY_; + Double32_t betaStar_; + + BeamType type_; }; - /// return beam type - BeamType type() const { return type_; } - /// set beam type - void setType(BeamType type) { type_ = type; } - /// - Covariance3DMatrix rotatedCovariance3D() const; - - /// additional information - double emittanceX() const { return emittanceX_; } - double emittanceY() const { return emittanceY_; } - double betaStar() const { return betaStar_; } - double beamWidthFromBeta(double z, double e) const { - return sqrt(e * betaStar_ * (1 + pow((z - position_.Z()) / betaStar_, 2))); - } /// - void setEmittanceX(double v) { emittanceX_ = v; } - void setEmittanceY(double v) { emittanceY_ = v; } - void setbetaStar(double v) { betaStar_ = v; } - - /// print information - void print(std::stringstream& ss) const; - - private: - /// position - Point position_; - /// errors - CovarianceMatrix error_; - - Double32_t sigmaZ_; - Double32_t BeamWidthX_; - Double32_t BeamWidthY_; - Double32_t dxdz_; - Double32_t dydz_; - Double32_t emittanceX_; - Double32_t emittanceY_; - Double32_t betaStar_; - - BeamType type_; - }; - /// - std::ostream& operator<<(std::ostream&, BeamSpot beam); + std::ostream& operator<<(std::ostream&, BeamSpot beam); + + } // namespace io_v1 + using BeamSpot = io_v1::BeamSpot; } // namespace reco diff --git a/DataFormats/BeamSpot/interface/BeamSpotFwd.h b/DataFormats/BeamSpot/interface/BeamSpotFwd.h index de50e55009470..ca8a8918a04b6 100644 --- a/DataFormats/BeamSpot/interface/BeamSpotFwd.h +++ b/DataFormats/BeamSpot/interface/BeamSpotFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_BeamSpot_BeamSpotFwd_h #define DataFormats_BeamSpot_BeamSpotFwd_h namespace reco { - class BeamSpot; -} + namespace io_v1 { + class BeamSpot; + } + using BeamSpot = io_v1::BeamSpot; +} // namespace reco #endif diff --git a/DataFormats/BeamSpot/src/BeamSpot.cc b/DataFormats/BeamSpot/src/BeamSpot.cc index fb672ce09f0d1..6256936c3c727 100644 --- a/DataFormats/BeamSpot/src/BeamSpot.cc +++ b/DataFormats/BeamSpot/src/BeamSpot.cc @@ -17,85 +17,85 @@ #include namespace reco { + namespace io_v1 { + using namespace math; - using namespace math; - - BeamSpot::BeamSpot() { - // initialize - position_ = Point(0., 0., 0.); - sigmaZ_ = 0.; - dxdz_ = 0.; - dydz_ = 0.; - BeamWidthX_ = 0.; - BeamWidthY_ = 0; - for (int j = 0; j < 7; j++) { - for (int k = j; k < 7; k++) { - error_(j, k) = 0.; + BeamSpot::BeamSpot() { + // initialize + position_ = Point(0., 0., 0.); + sigmaZ_ = 0.; + dxdz_ = 0.; + dydz_ = 0.; + BeamWidthX_ = 0.; + BeamWidthY_ = 0; + for (int j = 0; j < 7; j++) { + for (int k = j; k < 7; k++) { + error_(j, k) = 0.; + } } + type_ = Unknown; + emittanceX_ = 0; + emittanceY_ = 0; + betaStar_ = 0; } - type_ = Unknown; - emittanceX_ = 0; - emittanceY_ = 0; - betaStar_ = 0; - } - - const BeamSpot::Point BeamSpot::position(const double z) const { - Point pos(x(z), y(z), z); - return pos; - } - void BeamSpot::print(std::stringstream& ss) const { - ss << "-----------------------------------------------------\n" - << " Beam Spot Data\n\n" - << " Beam type = " << type() << "\n" - << " X0 = " << x0() << " +/- " << x0Error() << " [cm]\n" - << " Y0 = " << y0() << " +/- " << y0Error() << " [cm]\n" - << " Z0 = " << z0() << " +/- " << z0Error() << " [cm]\n" - << " Sigma Z0 = " << sigmaZ() << " +/- " << sigmaZ0Error() << " [cm]\n" - << " dxdz = " << dxdz() << " +/- " << dxdzError() << " [radians]\n" - << " dydz = " << dydz() << " +/- " << dydzError() << " [radians]\n" - << " Beam width X = " << BeamWidthX() << " +/- " << BeamWidthXError() << " [cm]\n" - << " Beam width Y = " << BeamWidthY() << " +/- " << BeamWidthYError() << " [cm]\n" - << " EmittanceX = " << emittanceX() << " [cm]\n" - << " EmittanceY = " << emittanceY() << " [cm]\n" - << " beta-star = " << betaStar() << " [cm]\n" - << "-----------------------------------------------------\n\n"; - } + const BeamSpot::Point BeamSpot::position(const double z) const { + Point pos(x(z), y(z), z); + return pos; + } - // - std::ostream& operator<<(std::ostream& os, BeamSpot beam) { - std::stringstream ss; - beam.print(ss); - os << ss.str(); - return os; - } + void BeamSpot::print(std::stringstream& ss) const { + ss << "-----------------------------------------------------\n" + << " Beam Spot Data\n\n" + << " Beam type = " << type() << "\n" + << " X0 = " << x0() << " +/- " << x0Error() << " [cm]\n" + << " Y0 = " << y0() << " +/- " << y0Error() << " [cm]\n" + << " Z0 = " << z0() << " +/- " << z0Error() << " [cm]\n" + << " Sigma Z0 = " << sigmaZ() << " +/- " << sigmaZ0Error() << " [cm]\n" + << " dxdz = " << dxdz() << " +/- " << dxdzError() << " [radians]\n" + << " dydz = " << dydz() << " +/- " << dydzError() << " [radians]\n" + << " Beam width X = " << BeamWidthX() << " +/- " << BeamWidthXError() << " [cm]\n" + << " Beam width Y = " << BeamWidthY() << " +/- " << BeamWidthYError() << " [cm]\n" + << " EmittanceX = " << emittanceX() << " [cm]\n" + << " EmittanceY = " << emittanceY() << " [cm]\n" + << " beta-star = " << betaStar() << " [cm]\n" + << "-----------------------------------------------------\n\n"; + } - BeamSpot::Covariance3DMatrix BeamSpot::rotatedCovariance3D() const { - AlgebraicVector3 newZ(dxdz(), dydz(), 1.); - AlgebraicVector3 globalZ(0., 0., 1.); - AlgebraicVector3 rotationAxis = ROOT::Math::Cross(globalZ.Unit(), newZ.Unit()); - float rotationAngle = -acos(ROOT::Math::Dot(globalZ.Unit(), newZ.Unit())); - Basic3DVector aa(rotationAxis[0], rotationAxis[1], rotationAxis[2]); - TkRotation rotation(aa, rotationAngle); - AlgebraicMatrix33 rotationMatrix; - rotationMatrix(0, 0) = rotation.xx(); - rotationMatrix(0, 1) = rotation.xy(); - rotationMatrix(0, 2) = rotation.xz(); - rotationMatrix(1, 0) = rotation.yx(); - rotationMatrix(1, 1) = rotation.yy(); - rotationMatrix(1, 2) = rotation.yz(); - rotationMatrix(2, 0) = rotation.zx(); - rotationMatrix(2, 1) = rotation.zy(); - rotationMatrix(2, 2) = rotation.zz(); + // + std::ostream& operator<<(std::ostream& os, BeamSpot beam) { + std::stringstream ss; + beam.print(ss); + os << ss.str(); + return os; + } - AlgebraicSymMatrix33 diagError; - diagError(0, 0) = pow(BeamWidthX(), 2); - diagError(1, 1) = pow(BeamWidthY(), 2); - diagError(2, 2) = pow(sigmaZ(), 2); + BeamSpot::Covariance3DMatrix BeamSpot::rotatedCovariance3D() const { + AlgebraicVector3 newZ(dxdz(), dydz(), 1.); + AlgebraicVector3 globalZ(0., 0., 1.); + AlgebraicVector3 rotationAxis = ROOT::Math::Cross(globalZ.Unit(), newZ.Unit()); + float rotationAngle = -acos(ROOT::Math::Dot(globalZ.Unit(), newZ.Unit())); + Basic3DVector aa(rotationAxis[0], rotationAxis[1], rotationAxis[2]); + TkRotation rotation(aa, rotationAngle); + AlgebraicMatrix33 rotationMatrix; + rotationMatrix(0, 0) = rotation.xx(); + rotationMatrix(0, 1) = rotation.xy(); + rotationMatrix(0, 2) = rotation.xz(); + rotationMatrix(1, 0) = rotation.yx(); + rotationMatrix(1, 1) = rotation.yy(); + rotationMatrix(1, 2) = rotation.yz(); + rotationMatrix(2, 0) = rotation.zx(); + rotationMatrix(2, 1) = rotation.zy(); + rotationMatrix(2, 2) = rotation.zz(); - Covariance3DMatrix matrix; - matrix = ROOT::Math::Similarity(rotationMatrix, diagError) + covariance3D(); - return matrix; - } + AlgebraicSymMatrix33 diagError; + diagError(0, 0) = pow(BeamWidthX(), 2); + diagError(1, 1) = pow(BeamWidthY(), 2); + diagError(2, 2) = pow(sigmaZ(), 2); + Covariance3DMatrix matrix; + matrix = ROOT::Math::Similarity(rotationMatrix, diagError) + covariance3D(); + return matrix; + } + } // namespace io_v1 } // namespace reco diff --git a/DataFormats/BeamSpot/src/classes_def.xml b/DataFormats/BeamSpot/src/classes_def.xml index 846be19d45b6b..94995e5ded3fe 100644 --- a/DataFormats/BeamSpot/src/classes_def.xml +++ b/DataFormats/BeamSpot/src/classes_def.xml @@ -1,9 +1,8 @@ - - - + + - + diff --git a/DataFormats/CaloRecHit/interface/CaloCluster.h b/DataFormats/CaloRecHit/interface/CaloCluster.h index 941ec56dadae0..caf8457578d26 100644 --- a/DataFormats/CaloRecHit/interface/CaloCluster.h +++ b/DataFormats/CaloRecHit/interface/CaloCluster.h @@ -24,231 +24,234 @@ #include namespace reco { + namespace io_v1 { + + class CaloCluster { + public: + enum AlgoId { + island = 0, + hybrid = 1, + fixedMatrix = 2, + dynamicHybrid = 3, + multi5x5 = 4, + particleFlow = 5, + hgcal_em = 6, + hgcal_had = 7, + hgcal_scintillator = 8, + hfnose = 9, + barrel_em = 10, + barrel_had = 11, + undefined = 1000 + }; + + // super-cluster flags + enum SCFlags { cleanOnly = 0, common = 100, uncleanOnly = 200 }; + // hcal cluster flags (used for pf) + enum HCalFlags { badHcalMarker = 1 }; + + //FIXME: + //temporary fix... to be removed before 310 final + typedef AlgoId AlgoID; + + /// default constructor. Sets energy and position to zero + CaloCluster() + : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(undefined), flags_(0) {} + + /// constructor with algoId, to be used in all child classes + CaloCluster(AlgoID algoID) + : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(algoID), flags_(0) {} + + CaloCluster(double energy, const math::XYZPoint& position, const CaloID& caloID) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + caloID_(caloID), + algoID_(undefined), + flags_(0) {} + + /// resets the CaloCluster (position, energy, hitsAndFractions) + void reset(); + + /// constructor from values + CaloCluster(double energy, const math::XYZPoint& position) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + algoID_(undefined), + flags_(0) {} + + CaloCluster( + double energy, const math::XYZPoint& position, const CaloID& caloID, const AlgoID& algoID, uint32_t flags = 0) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + caloID_(caloID), + algoID_(algoID) { + flags_ = flags & flagsMask_; + } + + CaloCluster(double energy, + const math::XYZPoint& position, + const CaloID& caloID, + const std::vector >& usedHitsAndFractions, + const AlgoId algoId, + const DetId seedId = DetId(0), + uint32_t flags = 0) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + caloID_(caloID), + hitsAndFractions_(usedHitsAndFractions), + algoID_(algoId), + seedId_(seedId) { + flags_ = flags & flagsMask_; + } + + //FIXME: + /// temporary compatibility constructor + CaloCluster(double energy, + const math::XYZPoint& position, + float chi2, + const std::vector& usedHits, + const AlgoId algoId, + uint32_t flags = 0) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + algoID_(algoId) { + hitsAndFractions_.reserve(usedHits.size()); + for (size_t i = 0; i < usedHits.size(); i++) + hitsAndFractions_.push_back(std::pair(usedHits[i], 1.)); + flags_ = flags & flagsMask_; + } + + /// destructor + virtual ~CaloCluster() {} + + void setEnergy(double energy) { energy_ = energy; } + void setCorrectedEnergy(double cenergy) { correctedEnergy_ = cenergy; } + void setCorrectedEnergyUncertainty(float energyerr) { correctedEnergyUncertainty_ = energyerr; } + + void setPosition(const math::XYZPoint& p) { position_ = p; } + + void setCaloId(const CaloID& id) { caloID_ = id; } + + void setAlgoId(const AlgoId& id) { algoID_ = id; } + + void setSeed(const DetId& id) { seedId_ = id; } + + /// cluster energy + double energy() const { return energy_; } + double correctedEnergy() const { return correctedEnergy_; } + float correctedEnergyUncertainty() const { return correctedEnergyUncertainty_; } + + /// cluster centroid position + const math::XYZPoint& position() const { return position_; } + + /// comparison >= operator + bool operator>=(const CaloCluster& rhs) const { return (energy_ >= rhs.energy_); } + + /// comparison > operator + bool operator>(const CaloCluster& rhs) const { return (energy_ > rhs.energy_); } + + /// comparison <= operator + bool operator<=(const CaloCluster& rhs) const { return (energy_ <= rhs.energy_); } + + /// comparison < operator + bool operator<(const CaloCluster& rhs) const { return (energy_ < rhs.energy_); } + + /// comparison == operator + bool operator==(const CaloCluster& rhs) const { return (energy_ == rhs.energy_); }; + + /// x coordinate of cluster centroid + double x() const { return position_.x(); } + + /// y coordinate of cluster centroid + double y() const { return position_.y(); } + + /// z coordinate of cluster centroid + double z() const { return position_.z(); } + + /// pseudorapidity of cluster centroid + double eta() const { return position_.eta(); } + + /// azimuthal angle of cluster centroid + double phi() const { return position_.phi(); } + + /// size in number of hits (e.g. in crystals for ECAL) + size_t size() const { return hitsAndFractions_.size(); } + + /// algorithm identifier + AlgoId algo() const { return algoID_; } + AlgoID algoID() const { return algo(); } + + uint32_t flags() const { return flags_ & flagsMask_; } + void setFlags(uint32_t flags) { + uint32_t reserved = (flags_ & ~flagsMask_); + flags_ = (reserved) | (flags & flagsMask_); + } + bool isInClean() const { return flags() < uncleanOnly; } + bool isInUnclean() const { return flags() >= common; } + + const CaloID& caloID() const { return caloID_; } - class CaloCluster; - std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); - - class CaloCluster { - public: - enum AlgoId { - island = 0, - hybrid = 1, - fixedMatrix = 2, - dynamicHybrid = 3, - multi5x5 = 4, - particleFlow = 5, - hgcal_em = 6, - hgcal_had = 7, - hgcal_scintillator = 8, - hfnose = 9, - barrel_em = 10, - barrel_had = 11, - undefined = 1000 - }; + void addHitAndFraction(DetId id, float fraction) { + hitsAndFractions_.push_back(std::pair(id, fraction)); + } + + /// replace getHitsByDetId() : return hits by DetId + /// and their corresponding fraction of energy considered + /// to compute the total cluster energy + const std::vector >& hitsAndFractions() const { return hitsAndFractions_; } - // super-cluster flags - enum SCFlags { cleanOnly = 0, common = 100, uncleanOnly = 200 }; - // hcal cluster flags (used for pf) - enum HCalFlags { badHcalMarker = 1 }; - - //FIXME: - //temporary fix... to be removed before 310 final - typedef AlgoId AlgoID; - - /// default constructor. Sets energy and position to zero - CaloCluster() - : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(undefined), flags_(0) {} - - /// constructor with algoId, to be used in all child classes - CaloCluster(AlgoID algoID) - : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(algoID), flags_(0) {} - - CaloCluster(double energy, const math::XYZPoint& position, const CaloID& caloID) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - caloID_(caloID), - algoID_(undefined), - flags_(0) {} - - /// resets the CaloCluster (position, energy, hitsAndFractions) - void reset(); - - /// constructor from values - CaloCluster(double energy, const math::XYZPoint& position) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - algoID_(undefined), - flags_(0) {} - - CaloCluster( - double energy, const math::XYZPoint& position, const CaloID& caloID, const AlgoID& algoID, uint32_t flags = 0) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - caloID_(caloID), - algoID_(algoID) { - flags_ = flags & flagsMask_; - } - - CaloCluster(double energy, - const math::XYZPoint& position, - const CaloID& caloID, - const std::vector >& usedHitsAndFractions, - const AlgoId algoId, - const DetId seedId = DetId(0), - uint32_t flags = 0) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - caloID_(caloID), - hitsAndFractions_(usedHitsAndFractions), - algoID_(algoId), - seedId_(seedId) { - flags_ = flags & flagsMask_; - } - - //FIXME: - /// temporary compatibility constructor - CaloCluster(double energy, - const math::XYZPoint& position, - float chi2, - const std::vector& usedHits, - const AlgoId algoId, - uint32_t flags = 0) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - algoID_(algoId) { - hitsAndFractions_.reserve(usedHits.size()); - for (size_t i = 0; i < usedHits.size(); i++) - hitsAndFractions_.push_back(std::pair(usedHits[i], 1.)); - flags_ = flags & flagsMask_; - } - - /// destructor - virtual ~CaloCluster() {} - - void setEnergy(double energy) { energy_ = energy; } - void setCorrectedEnergy(double cenergy) { correctedEnergy_ = cenergy; } - void setCorrectedEnergyUncertainty(float energyerr) { correctedEnergyUncertainty_ = energyerr; } - - void setPosition(const math::XYZPoint& p) { position_ = p; } - - void setCaloId(const CaloID& id) { caloID_ = id; } - - void setAlgoId(const AlgoId& id) { algoID_ = id; } - - void setSeed(const DetId& id) { seedId_ = id; } - - /// cluster energy - double energy() const { return energy_; } - double correctedEnergy() const { return correctedEnergy_; } - float correctedEnergyUncertainty() const { return correctedEnergyUncertainty_; } - - /// cluster centroid position - const math::XYZPoint& position() const { return position_; } - - /// comparison >= operator - bool operator>=(const CaloCluster& rhs) const { return (energy_ >= rhs.energy_); } - - /// comparison > operator - bool operator>(const CaloCluster& rhs) const { return (energy_ > rhs.energy_); } - - /// comparison <= operator - bool operator<=(const CaloCluster& rhs) const { return (energy_ <= rhs.energy_); } - - /// comparison < operator - bool operator<(const CaloCluster& rhs) const { return (energy_ < rhs.energy_); } - - /// comparison == operator - bool operator==(const CaloCluster& rhs) const { return (energy_ == rhs.energy_); }; - - /// x coordinate of cluster centroid - double x() const { return position_.x(); } - - /// y coordinate of cluster centroid - double y() const { return position_.y(); } - - /// z coordinate of cluster centroid - double z() const { return position_.z(); } - - /// pseudorapidity of cluster centroid - double eta() const { return position_.eta(); } - - /// azimuthal angle of cluster centroid - double phi() const { return position_.phi(); } - - /// size in number of hits (e.g. in crystals for ECAL) - size_t size() const { return hitsAndFractions_.size(); } - - /// algorithm identifier - AlgoId algo() const { return algoID_; } - AlgoID algoID() const { return algo(); } - - uint32_t flags() const { return flags_ & flagsMask_; } - void setFlags(uint32_t flags) { - uint32_t reserved = (flags_ & ~flagsMask_); - flags_ = (reserved) | (flags & flagsMask_); - } - bool isInClean() const { return flags() < uncleanOnly; } - bool isInUnclean() const { return flags() >= common; } - - const CaloID& caloID() const { return caloID_; } - - void addHitAndFraction(DetId id, float fraction) { - hitsAndFractions_.push_back(std::pair(id, fraction)); - } + /// print hitAndFraction + std::string printHitAndFraction(unsigned i) const; - /// replace getHitsByDetId() : return hits by DetId - /// and their corresponding fraction of energy considered - /// to compute the total cluster energy - const std::vector >& hitsAndFractions() const { return hitsAndFractions_; } + /// print me + friend std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); - /// print hitAndFraction - std::string printHitAndFraction(unsigned i) const; + /// return DetId of seed + DetId seed() const { return seedId_; } - /// print me - friend std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); + protected: + /// cluster energy + double energy_; + double correctedEnergy_; + float correctedEnergyUncertainty_; - /// return DetId of seed - DetId seed() const { return seedId_; } + /// cluster centroid position + math::XYZPoint position_; - protected: - /// cluster energy - double energy_; - double correctedEnergy_; - float correctedEnergyUncertainty_; + /// bitmask for detector information + CaloID caloID_; - /// cluster centroid position - math::XYZPoint position_; + // used hits by detId + std::vector > hitsAndFractions_; - /// bitmask for detector information - CaloID caloID_; + // cluster algorithm Id + AlgoID algoID_; - // used hits by detId - std::vector > hitsAndFractions_; + /// DetId of seed + DetId seedId_; - // cluster algorithm Id - AlgoID algoID_; + /// flags (e.g. for handling of cleaned/uncleaned SC) + /// 4 most significant bits reserved + /// 28 bits for handling of cleaned/uncleaned + uint32_t flags_; - /// DetId of seed - DetId seedId_; + static const uint32_t flagsMask_ = 0x0FFFFFFF; + static const uint32_t flagsOffset_ = 28; + }; - /// flags (e.g. for handling of cleaned/uncleaned SC) - /// 4 most significant bits reserved - /// 28 bits for handling of cleaned/uncleaned - uint32_t flags_; + std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); - static const uint32_t flagsMask_ = 0x0FFFFFFF; - static const uint32_t flagsOffset_ = 28; - }; + } // namespace io_v1 + using CaloCluster = io_v1::CaloCluster; } // namespace reco diff --git a/DataFormats/CaloRecHit/interface/CaloClusterFwd.h b/DataFormats/CaloRecHit/interface/CaloClusterFwd.h index 329d936b29eb9..b7c435ae35701 100644 --- a/DataFormats/CaloRecHit/interface/CaloClusterFwd.h +++ b/DataFormats/CaloRecHit/interface/CaloClusterFwd.h @@ -7,7 +7,10 @@ namespace edm { } namespace reco { - class CaloCluster; -} + namespace io_v1 { + class CaloCluster; + } + using CaloCluster = io_v1::CaloCluster; +} // namespace reco #endif diff --git a/DataFormats/CaloRecHit/src/CaloCluster.cc b/DataFormats/CaloRecHit/src/CaloCluster.cc index 7b130a8c5da0c..eca84526147d5 100644 --- a/DataFormats/CaloRecHit/src/CaloCluster.cc +++ b/DataFormats/CaloRecHit/src/CaloCluster.cc @@ -21,7 +21,7 @@ string CaloCluster::printHitAndFraction(unsigned i) const { return out.str(); } -std::ostream& reco::operator<<(std::ostream& out, const CaloCluster& cluster) { +std::ostream& reco::io_v1::operator<<(std::ostream& out, const CaloCluster& cluster) { if (!out) return out; diff --git a/DataFormats/CaloRecHit/src/classes_def.xml b/DataFormats/CaloRecHit/src/classes_def.xml index fa250a91eb62d..96568968b6d6c 100644 --- a/DataFormats/CaloRecHit/src/classes_def.xml +++ b/DataFormats/CaloRecHit/src/classes_def.xml @@ -2,30 +2,28 @@ - - - - - + + - - - + + + - - - - + + + + + - - + + - - + + diff --git a/DataFormats/CaloTowers/src/classes_def.xml b/DataFormats/CaloTowers/src/classes_def.xml index 88f2394498357..32a3e6b74d991 100644 --- a/DataFormats/CaloTowers/src/classes_def.xml +++ b/DataFormats/CaloTowers/src/classes_def.xml @@ -3,11 +3,8 @@ - - - - - + + @@ -24,9 +21,9 @@ - + - + diff --git a/DataFormats/Candidate/interface/Candidate.h b/DataFormats/Candidate/interface/Candidate.h index 10a6da7cb2f56..807893a83483e 100644 --- a/DataFormats/Candidate/interface/Candidate.h +++ b/DataFormats/Candidate/interface/Candidate.h @@ -23,282 +23,291 @@ class OverlapChecker; namespace reco { + class ShallowCloneCandidate; + class ShallowClonePtrCandidate; + namespace io_v1 { class Track; } using Track = io_v1::Track; - class Candidate { - public: - typedef size_t size_type; - typedef candidate::const_iterator const_iterator; - typedef candidate::iterator iterator; + namespace io_v1 { + + class Candidate { + public: + typedef size_t size_type; + typedef candidate::const_iterator const_iterator; + typedef candidate::iterator iterator; - /// electric charge type - typedef int Charge; - /// Lorentz vector - typedef math::XYZTLorentzVector LorentzVector; - /// Lorentz vector - typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; - /// point in the space - typedef math::XYZPoint Point; - /// point in the space - typedef math::XYZVector Vector; + /// electric charge type + typedef int Charge; + /// Lorentz vector + typedef math::XYZTLorentzVector LorentzVector; + /// Lorentz vector + typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; + /// point in the space + typedef math::XYZPoint Point; + /// point in the space + typedef math::XYZVector Vector; - enum { dimension = 3 }; - /// covariance error matrix (3x3) - typedef math::Error::type CovarianceMatrix; - /// matix size - enum { size = dimension * (dimension + 1) / 2 }; - /// index type - typedef unsigned int index; + enum { dimension = 3 }; + /// covariance error matrix (3x3) + typedef math::Error::type CovarianceMatrix; + /// matix size + enum { size = dimension * (dimension + 1) / 2 }; + /// index type + typedef unsigned int index; - /// default constructor - Candidate() {} - /// destructor - virtual ~Candidate(); - /// electric charge - virtual int charge() const = 0; - /// set electric charge - virtual void setCharge(Charge q) = 0; - /// electric charge - virtual int threeCharge() const = 0; - /// set electric charge - virtual void setThreeCharge(Charge qx3) = 0; - /// four-momentum Lorentz vector - virtual const LorentzVector& p4() const = 0; - /// four-momentum Lorentz vector - virtual const PolarLorentzVector& polarP4() const = 0; - /// spatial momentum vector - virtual Vector momentum() const = 0; - /// boost vector to boost a Lorentz vector - /// to the particle center of mass system - virtual Vector boostToCM() const = 0; - /// magnitude of momentum vector - virtual double p() const = 0; - /// energy - virtual double energy() const = 0; - /// transverse energy - virtual double et() const = 0; - /// transverse energy squared (use this for cut!) - virtual double et2() const = 0; - /// mass - virtual double mass() const = 0; - /// mass squared - virtual double massSqr() const = 0; - /// transverse mass - virtual double mt() const = 0; - /// transverse mass squared - virtual double mtSqr() const = 0; - /// x coordinate of momentum vector - virtual double px() const = 0; - /// y coordinate of momentum vector - virtual double py() const = 0; - /// z coordinate of momentum vector - virtual double pz() const = 0; - /// transverse momentum - virtual double pt() const = 0; - /// momentum azimuthal angle - virtual double phi() const = 0; - /// momentum polar angle - virtual double theta() const = 0; - /// momentum pseudorapidity - virtual double eta() const = 0; - /// rapidity - virtual double rapidity() const = 0; - /// rapidity - virtual double y() const = 0; - /// set 4-momentum - virtual void setP4(const LorentzVector& p4) = 0; - /// set 4-momentum - virtual void setP4(const PolarLorentzVector& p4) = 0; - /// set particle mass - virtual void setMass(double m) = 0; - virtual void setPz(double pz) = 0; - /// vertex position - virtual const Point& vertex() const = 0; - /// x coordinate of vertex position - virtual double vx() const = 0; - /// y coordinate of vertex position - virtual double vy() const = 0; - /// z coordinate of vertex position - virtual double vz() const = 0; - /// set vertex - virtual void setVertex(const Point& vertex) = 0; - /// PDG identifier - virtual int pdgId() const = 0; - // set PDG identifier - virtual void setPdgId(int pdgId) = 0; - /// status word - virtual int status() const = 0; - /// set status word - virtual void setStatus(int status) = 0; - /// set long lived flag - virtual void setLongLived() = 0; - /// is long lived? - virtual bool longLived() const = 0; - /// set mass constraint flag - virtual void setMassConstraint() = 0; - /// do mass constraint? - virtual bool massConstraint() const = 0; - /// returns a clone of the Candidate object - virtual Candidate* clone() const = 0; - /// first daughter const_iterator - const_iterator begin() const { return const_iterator(this, 0); } - /// last daughter const_iterator - const_iterator end() const { return const_iterator(this, numberOfDaughters()); } - /// first daughter iterator - iterator begin() { return iterator(this, 0); } - /// last daughter iterator - iterator end() { return iterator(this, numberOfDaughters()); } - /// number of daughters - virtual size_type numberOfDaughters() const = 0; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) - virtual const Candidate* daughter(size_type i) const = 0; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 - virtual Candidate* daughter(size_type i) = 0; - /// return daughter with a specified role name - virtual Candidate* daughter(const std::string& s) = 0; - /// return daughter with a specified role name - virtual const Candidate* daughter(const std::string& s) const = 0; - /// number of mothers (zero or one in most of but not all the cases) - virtual size_type numberOfMothers() const = 0; - /// return pointer to mother - virtual const Candidate* mother(size_type i = 0) const = 0; - /// return the number of source Candidates - /// ( the candidates used to construct this Candidate) - virtual size_t numberOfSourceCandidatePtrs() const = 0; - /// return a Ptr to one of the source Candidates - /// ( the candidates used to construct this Candidate) - virtual CandidatePtr sourceCandidatePtr(size_type i) const { return CandidatePtr(); } - /// \brief Set the ptr to the source Candidate. - /// - /// necessary, to allow a parallel treatment of all candidates - /// in PF2PAT. Does nothing for most Candidate classes, including - /// CompositePtrCandidates, where the source information is in fact - /// the collection of ptrs to daughters. For non-Composite Candidates, - /// this function can be used to set the ptr to the source of the - /// Candidate, which will allow to keep track - /// of the reconstruction history. - virtual void setSourceCandidatePtr(const CandidatePtr& ptr) {} + /// default constructor + Candidate() {} + /// destructor + virtual ~Candidate(); + /// electric charge + virtual int charge() const = 0; + /// set electric charge + virtual void setCharge(Charge q) = 0; + /// electric charge + virtual int threeCharge() const = 0; + /// set electric charge + virtual void setThreeCharge(Charge qx3) = 0; + /// four-momentum Lorentz vector + virtual const LorentzVector& p4() const = 0; + /// four-momentum Lorentz vector + virtual const PolarLorentzVector& polarP4() const = 0; + /// spatial momentum vector + virtual Vector momentum() const = 0; + /// boost vector to boost a Lorentz vector + /// to the particle center of mass system + virtual Vector boostToCM() const = 0; + /// magnitude of momentum vector + virtual double p() const = 0; + /// energy + virtual double energy() const = 0; + /// transverse energy + virtual double et() const = 0; + /// transverse energy squared (use this for cut!) + virtual double et2() const = 0; + /// mass + virtual double mass() const = 0; + /// mass squared + virtual double massSqr() const = 0; + /// transverse mass + virtual double mt() const = 0; + /// transverse mass squared + virtual double mtSqr() const = 0; + /// x coordinate of momentum vector + virtual double px() const = 0; + /// y coordinate of momentum vector + virtual double py() const = 0; + /// z coordinate of momentum vector + virtual double pz() const = 0; + /// transverse momentum + virtual double pt() const = 0; + /// momentum azimuthal angle + virtual double phi() const = 0; + /// momentum polar angle + virtual double theta() const = 0; + /// momentum pseudorapidity + virtual double eta() const = 0; + /// rapidity + virtual double rapidity() const = 0; + /// rapidity + virtual double y() const = 0; + /// set 4-momentum + virtual void setP4(const LorentzVector& p4) = 0; + /// set 4-momentum + virtual void setP4(const PolarLorentzVector& p4) = 0; + /// set particle mass + virtual void setMass(double m) = 0; + virtual void setPz(double pz) = 0; + /// vertex position + virtual const Point& vertex() const = 0; + /// x coordinate of vertex position + virtual double vx() const = 0; + /// y coordinate of vertex position + virtual double vy() const = 0; + /// z coordinate of vertex position + virtual double vz() const = 0; + /// set vertex + virtual void setVertex(const Point& vertex) = 0; + /// PDG identifier + virtual int pdgId() const = 0; + // set PDG identifier + virtual void setPdgId(int pdgId) = 0; + /// status word + virtual int status() const = 0; + /// set status word + virtual void setStatus(int status) = 0; + /// set long lived flag + virtual void setLongLived() = 0; + /// is long lived? + virtual bool longLived() const = 0; + /// set mass constraint flag + virtual void setMassConstraint() = 0; + /// do mass constraint? + virtual bool massConstraint() const = 0; + /// returns a clone of the Candidate object + virtual Candidate* clone() const = 0; + /// first daughter const_iterator + const_iterator begin() const { return const_iterator(this, 0); } + /// last daughter const_iterator + const_iterator end() const { return const_iterator(this, numberOfDaughters()); } + /// first daughter iterator + iterator begin() { return iterator(this, 0); } + /// last daughter iterator + iterator end() { return iterator(this, numberOfDaughters()); } + /// number of daughters + virtual size_type numberOfDaughters() const = 0; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) + virtual const Candidate* daughter(size_type i) const = 0; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 + virtual Candidate* daughter(size_type i) = 0; + /// return daughter with a specified role name + virtual Candidate* daughter(const std::string& s) = 0; + /// return daughter with a specified role name + virtual const Candidate* daughter(const std::string& s) const = 0; + /// number of mothers (zero or one in most of but not all the cases) + virtual size_type numberOfMothers() const = 0; + /// return pointer to mother + virtual const Candidate* mother(size_type i = 0) const = 0; + /// return the number of source Candidates + /// ( the candidates used to construct this Candidate) + virtual size_t numberOfSourceCandidatePtrs() const = 0; + /// return a Ptr to one of the source Candidates + /// ( the candidates used to construct this Candidate) + virtual CandidatePtr sourceCandidatePtr(size_type i) const { return CandidatePtr(); } + /// \brief Set the ptr to the source Candidate. + /// + /// necessary, to allow a parallel treatment of all candidates + /// in PF2PAT. Does nothing for most Candidate classes, including + /// CompositePtrCandidates, where the source information is in fact + /// the collection of ptrs to daughters. For non-Composite Candidates, + /// this function can be used to set the ptr to the source of the + /// Candidate, which will allow to keep track + /// of the reconstruction history. + virtual void setSourceCandidatePtr(const CandidatePtr& ptr) {} - /// chi-squares - virtual double vertexChi2() const = 0; - /** Number of degrees of freedom + /// chi-squares + virtual double vertexChi2() const = 0; + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - virtual double vertexNdof() const = 0; - /// chi-squared divided by n.d.o.f. - virtual double vertexNormalizedChi2() const = 0; - /// (i, j)-th element of error matrix, i, j = 0, ... 2 - virtual double vertexCovariance(int i, int j) const = 0; - /// fill SMatrix - virtual CovarianceMatrix vertexCovariance() const { - CovarianceMatrix m; - fillVertexCovariance(m); - return m; - } //TODO - virtual void fillVertexCovariance(CovarianceMatrix& v) const = 0; - /// returns true if this candidate has a reference to a master clone. - /// This only happens if the concrete Candidate type is ShallowCloneCandidate - virtual bool hasMasterClone() const = 0; - /// returns ptr to master clone, if existing. - /// Throws an exception unless the concrete Candidate type is ShallowCloneCandidate - virtual const CandidateBaseRef& masterClone() const = 0; - /// returns true if this candidate has a ptr to a master clone. - /// This only happens if the concrete Candidate type is ShallowClonePtrCandidate - virtual bool hasMasterClonePtr() const = 0; - /// returns ptr to master clone, if existing. - /// Throws an exception unless the concrete Candidate type is ShallowClonePtrCandidate - virtual const CandidatePtr& masterClonePtr() const = 0; - /// cast master clone reference to a concrete type - template - Ref masterRef() const { - return masterClone().template castTo(); - } - /// get a component + virtual double vertexNdof() const = 0; + /// chi-squared divided by n.d.o.f. + virtual double vertexNormalizedChi2() const = 0; + /// (i, j)-th element of error matrix, i, j = 0, ... 2 + virtual double vertexCovariance(int i, int j) const = 0; + /// fill SMatrix + virtual CovarianceMatrix vertexCovariance() const { + CovarianceMatrix m; + fillVertexCovariance(m); + return m; + } //TODO + virtual void fillVertexCovariance(CovarianceMatrix& v) const = 0; + /// returns true if this candidate has a reference to a master clone. + /// This only happens if the concrete Candidate type is ShallowCloneCandidate + virtual bool hasMasterClone() const = 0; + /// returns ptr to master clone, if existing. + /// Throws an exception unless the concrete Candidate type is ShallowCloneCandidate + virtual const CandidateBaseRef& masterClone() const = 0; + /// returns true if this candidate has a ptr to a master clone. + /// This only happens if the concrete Candidate type is ShallowClonePtrCandidate + virtual bool hasMasterClonePtr() const = 0; + /// returns ptr to master clone, if existing. + /// Throws an exception unless the concrete Candidate type is ShallowClonePtrCandidate + virtual const CandidatePtr& masterClonePtr() const = 0; + /// cast master clone reference to a concrete type + template + Ref masterRef() const { + return masterClone().template castTo(); + } + /// get a component + + template + T get() const { + if (hasMasterClone()) + return masterClone()->get(); + else + return reco::get(*this); + } + /// get a component + template + T get() const { + if (hasMasterClone()) + return masterClone()->get(); + else + return reco::get(*this); + } + /// get a component + template + T get(size_type i) const { + if (hasMasterClone()) + return masterClone()->get(i); + else + return reco::get(*this, i); + } + /// get a component + template + T get(size_type i) const { + if (hasMasterClone()) + return masterClone()->get(i); + else + return reco::get(*this, i); + } + /// number of components + template + size_type numberOf() const { + if (hasMasterClone()) + return masterClone()->numberOf(); + else + return reco::numberOf(*this); + } + /// number of components + template + size_type numberOf() const { + if (hasMasterClone()) + return masterClone()->numberOf(); + else + return reco::numberOf(*this); + } + + virtual const Track* bestTrack() const { return nullptr; } - template - T get() const { - if (hasMasterClone()) - return masterClone()->get(); - else - return reco::get(*this); - } - /// get a component - template - T get() const { - if (hasMasterClone()) - return masterClone()->get(); - else - return reco::get(*this); - } - /// get a component - template - T get(size_type i) const { - if (hasMasterClone()) - return masterClone()->get(i); - else - return reco::get(*this, i); - } - /// get a component - template - T get(size_type i) const { - if (hasMasterClone()) - return masterClone()->get(i); - else - return reco::get(*this, i); - } - /// number of components - template - size_type numberOf() const { - if (hasMasterClone()) - return masterClone()->numberOf(); - else - return reco::numberOf(*this); - } - /// number of components - template - size_type numberOf() const { - if (hasMasterClone()) - return masterClone()->numberOf(); - else - return reco::numberOf(*this); - } + /// uncertainty on dz + virtual float dzError() const { + return 0; + } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dzError(); else return 0; } + /// uncertainty on dxy + virtual float dxyError() const { + return 0; + } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dxyError(); else return 0; } - virtual const Track* bestTrack() const { return nullptr; } + virtual bool isElectron() const = 0; + virtual bool isMuon() const = 0; + virtual bool isStandAloneMuon() const = 0; + virtual bool isGlobalMuon() const = 0; + virtual bool isTrackerMuon() const = 0; + virtual bool isCaloMuon() const = 0; + virtual bool isPhoton() const = 0; + virtual bool isConvertedPhoton() const = 0; + virtual bool isJet() const = 0; - /// uncertainty on dz - virtual float dzError() const { - return 0; - } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dzError(); else return 0; } - /// uncertainty on dxy - virtual float dxyError() const { - return 0; - } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dxyError(); else return 0; } + protected: + /// check overlap with another Candidate + virtual bool overlap(const Candidate&) const = 0; + template + friend struct component; + friend class ::OverlapChecker; + friend class reco::ShallowCloneCandidate; + friend class reco::ShallowClonePtrCandidate; + }; - virtual bool isElectron() const = 0; - virtual bool isMuon() const = 0; - virtual bool isStandAloneMuon() const = 0; - virtual bool isGlobalMuon() const = 0; - virtual bool isTrackerMuon() const = 0; - virtual bool isCaloMuon() const = 0; - virtual bool isPhoton() const = 0; - virtual bool isConvertedPhoton() const = 0; - virtual bool isJet() const = 0; + } // namespace io_v1 - protected: - /// check overlap with another Candidate - virtual bool overlap(const Candidate&) const = 0; - template - friend struct component; - friend class ::OverlapChecker; - friend class ShallowCloneCandidate; - friend class ShallowClonePtrCandidate; - }; + using Candidate = io_v1::Candidate; namespace candidate { diff --git a/DataFormats/Candidate/interface/CandidateFwd.h b/DataFormats/Candidate/interface/CandidateFwd.h index 943e74951db7a..2d92278c75fd6 100644 --- a/DataFormats/Candidate/interface/CandidateFwd.h +++ b/DataFormats/Candidate/interface/CandidateFwd.h @@ -2,10 +2,6 @@ #define Candidate_CandidateFwd_h #include "DataFormats/Common/interface/OwnVector.h" -namespace reco { - class Candidate; -} - #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/Ptr.h" #include "DataFormats/Common/interface/PtrVector.h" @@ -16,6 +12,8 @@ namespace reco { #include "DataFormats/Common/interface/RefToBaseProd.h" #include "DataFormats/Common/interface/View.h" +#include "DataFormats/Candidate/interface/CandidateOnlyFwd.h" + namespace reco { /// collection of Candidate objects typedef edm::OwnVector CandidateCollection; diff --git a/DataFormats/Candidate/interface/CandidateOnlyFwd.h b/DataFormats/Candidate/interface/CandidateOnlyFwd.h index f5f3e09f1ca3a..8c7542fcba863 100644 --- a/DataFormats/Candidate/interface/CandidateOnlyFwd.h +++ b/DataFormats/Candidate/interface/CandidateOnlyFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_Candidate_CandidateOnlyFwd_h #define DataFormats_Candidate_CandidateOnlyFwd_h namespace reco { - class Candidate; -} + namespace io_v1 { + class Candidate; + } + using Candidate = io_v1::Candidate; +} // namespace reco #endif diff --git a/DataFormats/Candidate/interface/CompositeCandidate.h b/DataFormats/Candidate/interface/CompositeCandidate.h index 93730723ca42f..9a14f763d5654 100644 --- a/DataFormats/Candidate/interface/CompositeCandidate.h +++ b/DataFormats/Candidate/interface/CompositeCandidate.h @@ -17,77 +17,81 @@ #include namespace reco { + namespace io_v1 { - class CompositeCandidate : public LeafCandidate { - public: - /// collection of daughters - typedef CandidateCollection daughters; - typedef std::vector role_collection; - /// default constructor - CompositeCandidate(std::string name = "") : LeafCandidate(), name_(name) {} - /// constructor from values - template - CompositeCandidate(Charge q, - const P4& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 0, - int status = 0, - bool integerCharge = true, - std::string name = "") - : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name) {} - /// constructor from values - explicit CompositeCandidate(const Candidate& p, const std::string& name = ""); - /// constructor from values - explicit CompositeCandidate(const Candidate& p, const std::string& name, role_collection const& roles); - /// destructor - ~CompositeCandidate() override; - /// get the name of the candidate - std::string name() const { return name_; } - /// set the name of the candidate - void setName(std::string name) { name_ = name; } - /// get the roles - role_collection const& roles() const { return roles_; } - /// set the roles - void setRoles(const role_collection& roles) { - roles_.clear(); - roles_ = roles; - } - /// returns a clone of the candidate - CompositeCandidate* clone() const override; - /// number of daughters - size_type numberOfDaughters() const override; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) - const Candidate* daughter(size_type) const override; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 - Candidate* daughter(size_type) override; - // Get candidate based on role - Candidate* daughter(const std::string& s) override; - const Candidate* daughter(const std::string& s) const override; - /// add a clone of the passed candidate as daughter - void addDaughter(const Candidate&, const std::string& s = ""); - /// add a clone of the passed candidate as daughter - void addDaughter(std::unique_ptr, const std::string& s = ""); - /// clear daughters - void clearDaughters() { dau.clear(); } - // clear roles - void clearRoles() { roles_.clear(); } - // Apply the roles to the objects - void applyRoles(); - /// number of mothers (zero or one in most of but not all the cases) - size_type numberOfMothers() const override; - /// return pointer to mother - const Candidate* mother(size_type i = 0) const override; + class CompositeCandidate : public LeafCandidate { + public: + /// collection of daughters + typedef CandidateCollection daughters; + typedef std::vector role_collection; + /// default constructor + CompositeCandidate(std::string name = "") : LeafCandidate(), name_(name) {} + /// constructor from values + template + CompositeCandidate(Charge q, + const P4& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 0, + int status = 0, + bool integerCharge = true, + std::string name = "") + : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name) {} + /// constructor from values + explicit CompositeCandidate(const Candidate& p, const std::string& name = ""); + /// constructor from values + explicit CompositeCandidate(const Candidate& p, const std::string& name, role_collection const& roles); + /// destructor + ~CompositeCandidate() override; + /// get the name of the candidate + std::string name() const { return name_; } + /// set the name of the candidate + void setName(std::string name) { name_ = name; } + /// get the roles + role_collection const& roles() const { return roles_; } + /// set the roles + void setRoles(const role_collection& roles) { + roles_.clear(); + roles_ = roles; + } + /// returns a clone of the candidate + CompositeCandidate* clone() const override; + /// number of daughters + size_type numberOfDaughters() const override; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) + const Candidate* daughter(size_type) const override; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 + Candidate* daughter(size_type) override; + // Get candidate based on role + Candidate* daughter(const std::string& s) override; + const Candidate* daughter(const std::string& s) const override; + /// add a clone of the passed candidate as daughter + void addDaughter(const Candidate&, const std::string& s = ""); + /// add a clone of the passed candidate as daughter + void addDaughter(std::unique_ptr, const std::string& s = ""); + /// clear daughters + void clearDaughters() { dau.clear(); } + // clear roles + void clearRoles() { roles_.clear(); } + // Apply the roles to the objects + void applyRoles(); + /// number of mothers (zero or one in most of but not all the cases) + size_type numberOfMothers() const override; + /// return pointer to mother + const Candidate* mother(size_type i = 0) const override; - private: - /// collection of daughters - daughters dau; - /// check overlap with another daughter - bool overlap(const Candidate&) const override; - /// candidate name - std::string name_; - /// candidate roles - role_collection roles_; - }; + private: + /// collection of daughters + daughters dau; + /// check overlap with another daughter + bool overlap(const Candidate&) const override; + /// candidate name + std::string name_; + /// candidate roles + role_collection roles_; + }; + + } // namespace io_v1 + using CompositeCandidate = io_v1::CompositeCandidate; } // namespace reco diff --git a/DataFormats/Candidate/interface/CompositeCandidateFwd.h b/DataFormats/Candidate/interface/CompositeCandidateFwd.h index f97279e182f54..d5270cac46c4c 100644 --- a/DataFormats/Candidate/interface/CompositeCandidateFwd.h +++ b/DataFormats/Candidate/interface/CompositeCandidateFwd.h @@ -3,8 +3,11 @@ #include "DataFormats/Common/interface/OwnVector.h" namespace reco { - class CompositeCandidate; -} + namespace io_v1 { + class CompositeCandidate; + } + using CompositeCandidate = io_v1::CompositeCandidate; +} // namespace reco #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/RefProd.h" diff --git a/DataFormats/Candidate/interface/LeafRefCandidateT.h b/DataFormats/Candidate/interface/LeafRefCandidateT.h index 7651ecafd0afe..26e7889ddae06 100644 --- a/DataFormats/Candidate/interface/LeafRefCandidateT.h +++ b/DataFormats/Candidate/interface/LeafRefCandidateT.h @@ -157,8 +157,6 @@ namespace reco { bool isConvertedPhoton() const final { return false; } bool isJet() const final { return false; } - CMS_CLASS_VERSION(13) - protected: /// check overlap with another Candidate bool overlap(const Candidate&) const override; diff --git a/DataFormats/Candidate/interface/VertexCompositeCandidate.h b/DataFormats/Candidate/interface/VertexCompositeCandidate.h index 5ea32d742e812..1bc6e5b88d2b1 100644 --- a/DataFormats/Candidate/interface/VertexCompositeCandidate.h +++ b/DataFormats/Candidate/interface/VertexCompositeCandidate.h @@ -13,69 +13,72 @@ #include "DataFormats/Candidate/interface/CompositeCandidate.h" namespace reco { - class VertexCompositeCandidate : public CompositeCandidate { - public: - VertexCompositeCandidate() : CompositeCandidate() {} - /// constructor from values - VertexCompositeCandidate( - Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) - : CompositeCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0) {} - /// constructor from values - VertexCompositeCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - const CovarianceMatrix &err, - double chi2, - double ndof, - int pdgId = 0, - int status = 0, - bool integerCharge = true); - /// constructor from values - explicit VertexCompositeCandidate(const Candidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} - /// constructor from values - explicit VertexCompositeCandidate(const CompositeCandidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} - /// destructor - ~VertexCompositeCandidate() override; - /// returns a clone of the candidate - VertexCompositeCandidate *clone() const override; - /// chi-squares - double vertexChi2() const override { return chi2_; } - /** Number of degrees of freedom + namespace io_v1 { + class VertexCompositeCandidate : public CompositeCandidate { + public: + VertexCompositeCandidate() : CompositeCandidate() {} + /// constructor from values + VertexCompositeCandidate( + Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) + : CompositeCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0) {} + /// constructor from values + VertexCompositeCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + const CovarianceMatrix &err, + double chi2, + double ndof, + int pdgId = 0, + int status = 0, + bool integerCharge = true); + /// constructor from values + explicit VertexCompositeCandidate(const Candidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} + /// constructor from values + explicit VertexCompositeCandidate(const CompositeCandidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} + /// destructor + ~VertexCompositeCandidate() override; + /// returns a clone of the candidate + VertexCompositeCandidate *clone() const override; + /// chi-squares + double vertexChi2() const override { return chi2_; } + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - double vertexNdof() const override { return ndof_; } - /// chi-squared divided by n.d.o.f. - double vertexNormalizedChi2() const override { return chi2_ / ndof_; } - /// (i, j)-th element of error matrix, i, j = 0, ... 2 - double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } - using reco::LeafCandidate::vertexCovariance; // avoid hiding the - /// fill SMatrix - void fillVertexCovariance(CovarianceMatrix &v) const override; - /// set chi2 and ndof - void setChi2AndNdof(double chi2, double ndof) { - chi2_ = chi2; - ndof_ = ndof; - } - /// set covariance matrix - void setCovariance(const CovarianceMatrix &m); + double vertexNdof() const override { return ndof_; } + /// chi-squared divided by n.d.o.f. + double vertexNormalizedChi2() const override { return chi2_ / ndof_; } + /// (i, j)-th element of error matrix, i, j = 0, ... 2 + double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } + using reco::LeafCandidate::vertexCovariance; // avoid hiding the + /// fill SMatrix + void fillVertexCovariance(CovarianceMatrix &v) const override; + /// set chi2 and ndof + void setChi2AndNdof(double chi2, double ndof) { + chi2_ = chi2; + ndof_ = ndof; + } + /// set covariance matrix + void setCovariance(const CovarianceMatrix &m); - private: - /// chi-sqared - Double32_t chi2_; - /// number of degrees of freedom - Double32_t ndof_; - /// covariance matrix (3x3) as vector - Double32_t covariance_[size]; - /// position index - index idx(index i, index j) const { - int a = (i <= j ? i : j), b = (i <= j ? j : i); - return b * (b + 1) / 2 + a; - } - }; + private: + /// chi-sqared + Double32_t chi2_; + /// number of degrees of freedom + Double32_t ndof_; + /// covariance matrix (3x3) as vector + Double32_t covariance_[size]; + /// position index + index idx(index i, index j) const { + int a = (i <= j ? i : j), b = (i <= j ? j : i); + return b * (b + 1) / 2 + a; + } + }; + } // namespace io_v1 + using VertexCompositeCandidate = io_v1::VertexCompositeCandidate; } // namespace reco #endif diff --git a/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h b/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h index df47f0975725d..9a7716e4a3f06 100644 --- a/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h +++ b/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h @@ -2,10 +2,7 @@ #define DataFormats_Candidate_VertexCompositeCandidateFwd_h #include "DataFormats/Common/interface/OwnVector.h" -namespace reco { - class VertexCompositeCandidate; -} - +#include "DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/RefProd.h" #include "DataFormats/Common/interface/RefVector.h" diff --git a/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h b/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h index 9be4756e0a4fe..05f6551a5b3ca 100644 --- a/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h +++ b/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_Candidate_VertexCompositeCandidateOnlyFwd_h #define DataFormats_Candidate_VertexCompositeCandidateOnlyFwd_h namespace reco { - class VertexCompositeCandidate; -} + namespace io_v1 { + class VertexCompositeCandidate; + } + using VertexCompositeCandidate = io_v1::VertexCompositeCandidate; +} // namespace reco #endif diff --git a/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h b/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h index 71a0348b302a0..cf261f21f786b 100644 --- a/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h +++ b/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h @@ -13,130 +13,134 @@ #include "DataFormats/Candidate/interface/CompositePtrCandidate.h" namespace reco { - class VertexCompositePtrCandidate : public CompositePtrCandidate { - public: - enum { dimension4D = 4 }; - /// covariance error matrix (3x3) - typedef math::Error::type CovarianceMatrix4D; - /// matix size - enum { size4D = dimension4D * (dimension4D + 1) / 2 }; + namespace io_v1 { + class VertexCompositePtrCandidate : public CompositePtrCandidate { + public: + enum { dimension4D = 4 }; + /// covariance error matrix (3x3) + typedef math::Error::type CovarianceMatrix4D; + /// matix size + enum { size4D = dimension4D * (dimension4D + 1) / 2 }; - VertexCompositePtrCandidate() : CompositePtrCandidate(), chi2_(0), ndof_(0), time_(0) {} - /// constructor from values - VertexCompositePtrCandidate( - Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(0) {} - VertexCompositePtrCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - double time, - int pdgId = 0, - int status = 0, - bool integerCharge = true) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(time) {} - /// constructor from values - VertexCompositePtrCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - const CovarianceMatrix &err, - double chi2, - double ndof, - int pdgId = 0, - int status = 0, - bool integerCharge = true); - VertexCompositePtrCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - double time, - const CovarianceMatrix4D &err, - double chi2, - double ndof, - int pdgId = 0, - int status = 0, - bool integerCharge = true); - /// constructor from values - explicit VertexCompositePtrCandidate(const Candidate &p) : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} - /// constructor from values - explicit VertexCompositePtrCandidate(const CompositePtrCandidate &p) - : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} - /// destructor - ~VertexCompositePtrCandidate() override; - /// returns a clone of the candidate - VertexCompositePtrCandidate *clone() const override; + VertexCompositePtrCandidate() : CompositePtrCandidate(), chi2_(0), ndof_(0), time_(0) {} + /// constructor from values + VertexCompositePtrCandidate( + Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(0) {} + VertexCompositePtrCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + double time, + int pdgId = 0, + int status = 0, + bool integerCharge = true) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(time) {} + /// constructor from values + VertexCompositePtrCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + const CovarianceMatrix &err, + double chi2, + double ndof, + int pdgId = 0, + int status = 0, + bool integerCharge = true); + VertexCompositePtrCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + double time, + const CovarianceMatrix4D &err, + double chi2, + double ndof, + int pdgId = 0, + int status = 0, + bool integerCharge = true); + /// constructor from values + explicit VertexCompositePtrCandidate(const Candidate &p) + : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} + /// constructor from values + explicit VertexCompositePtrCandidate(const CompositePtrCandidate &p) + : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} + /// destructor + ~VertexCompositePtrCandidate() override; + /// returns a clone of the candidate + VertexCompositePtrCandidate *clone() const override; - /// chi-squares - double vertexChi2() const override { return chi2_; } - /** Number of degrees of freedom + /// chi-squares + double vertexChi2() const override { return chi2_; } + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - double vertexNdof() const override { return ndof_; } - /// chi-squared divided by n.d.o.f. - double vertexNormalizedChi2() const override { return chi2_ / ndof_; } - /// (i, j)-th element of error matrix, i, j = 0, ... 3 - double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } - using reco::LeafCandidate::vertexCovariance; // avoid hiding the - /// return SMatrix 4D - CovarianceMatrix4D vertexCovariance4D() const { - CovarianceMatrix4D m; - fillVertexCovariance(m); - return m; - } + double vertexNdof() const override { return ndof_; } + /// chi-squared divided by n.d.o.f. + double vertexNormalizedChi2() const override { return chi2_ / ndof_; } + /// (i, j)-th element of error matrix, i, j = 0, ... 3 + double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } + using reco::LeafCandidate::vertexCovariance; // avoid hiding the + /// return SMatrix 4D + CovarianceMatrix4D vertexCovariance4D() const { + CovarianceMatrix4D m; + fillVertexCovariance(m); + return m; + } - /// fill SMatrix - void fillVertexCovariance(CovarianceMatrix &v) const override; - /// 4D version - void fillVertexCovariance(CovarianceMatrix4D &v) const; + /// fill SMatrix + void fillVertexCovariance(CovarianceMatrix &v) const override; + /// 4D version + void fillVertexCovariance(CovarianceMatrix4D &v) const; - /// set chi2 and ndof - void setChi2AndNdof(double chi2, double ndof) { - chi2_ = chi2; - ndof_ = ndof; - } - /// set covariance matrix - void setCovariance(const CovarianceMatrix &m); - /// set covariance matrix - void setCovariance(const CovarianceMatrix4D &m); + /// set chi2 and ndof + void setChi2AndNdof(double chi2, double ndof) { + chi2_ = chi2; + ndof_ = ndof; + } + /// set covariance matrix + void setCovariance(const CovarianceMatrix &m); + /// set covariance matrix + void setCovariance(const CovarianceMatrix4D &m); - // set time - void setTime(double time) { time_ = time; } + // set time + void setTime(double time) { time_ = time; } - /// the following functions are implemented to have a more consistent interface with the one of reco::Vertex - typedef math::Error::type Error; - typedef math::Error::type Error4D; - const Point &position() const { return vertex(); } - double t() const { return time_; } - double tError() const { return std::sqrt(vertexCovariance(3, 3)); } - Error error() const { - Error m; - fillVertexCovariance(m); - return m; - } - /// return SMatrix 4D - Error4D error4D() const { - Error4D m; - fillVertexCovariance(m); - return m; - } + /// the following functions are implemented to have a more consistent interface with the one of reco::Vertex + typedef math::Error::type Error; + typedef math::Error::type Error4D; + const Point &position() const { return vertex(); } + double t() const { return time_; } + double tError() const { return std::sqrt(vertexCovariance(3, 3)); } + Error error() const { + Error m; + fillVertexCovariance(m); + return m; + } + /// return SMatrix 4D + Error4D error4D() const { + Error4D m; + fillVertexCovariance(m); + return m; + } - private: - /// chi-sqared - Double32_t chi2_; - /// number of degrees of freedom - Double32_t ndof_; - /// covariance matrix (4x4) as vector - Double32_t covariance_[size4D]; - /// vertex time - Double32_t time_; - /// position index - index idx(index i, index j) const { - int a = (i <= j ? i : j), b = (i <= j ? j : i); - return b * (b + 1) / 2 + a; - } - }; + private: + /// chi-sqared + Double32_t chi2_; + /// number of degrees of freedom + Double32_t ndof_; + /// covariance matrix (4x4) as vector + Double32_t covariance_[size4D]; + /// vertex time + Double32_t time_; + /// position index + index idx(index i, index j) const { + int a = (i <= j ? i : j), b = (i <= j ? j : i); + return b * (b + 1) / 2 + a; + } + }; + } // namespace io_v1 + using VertexCompositePtrCandidate = io_v1::VertexCompositePtrCandidate; } // namespace reco #endif diff --git a/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h b/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h index dbe7f45239147..081c1ec5fd117 100644 --- a/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h +++ b/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h @@ -3,8 +3,11 @@ #include "DataFormats/Common/interface/OwnVector.h" namespace reco { - class VertexCompositePtrCandidate; -} + namespace io_v1 { + class VertexCompositePtrCandidate; + } + using VertexCompositePtrCandidate = io_v1::VertexCompositePtrCandidate; +} // namespace reco #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/RefProd.h" diff --git a/DataFormats/Candidate/src/classes_def.xml b/DataFormats/Candidate/src/classes_def.xml index 00c9305b243b1..9e7b4e624415f 100644 --- a/DataFormats/Candidate/src/classes_def.xml +++ b/DataFormats/Candidate/src/classes_def.xml @@ -25,95 +25,56 @@ - - + + - - - - - + + - - construct(onfile.qx3_, onfile.pt_,onfile.eta_,onfile.phi_,onfile.mass_,onfile.vertex_, onfile.pdgId_, onfile.status_); - ]]> - - - - - + + + + + + - - - - + + - - - - - - + + - - - - - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - + + - - - - + + @@ -125,83 +86,83 @@ - - - + + + - - - - - - - - - - + + + + + + + + + + - - + + - + - - + + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + @@ -216,53 +177,53 @@ - - + + - - - - - - - - + + + + + + + + - - + + - + - + - + - + - + - + - + - - + + - + - + @@ -270,26 +231,26 @@ - - + + - + - - - + + + - - + + - - + + - + diff --git a/DataFormats/CastorReco/src/classes_def.xml b/DataFormats/CastorReco/src/classes_def.xml index 71a4d04b0ad3a..be450d8a2ecc9 100644 --- a/DataFormats/CastorReco/src/classes_def.xml +++ b/DataFormats/CastorReco/src/classes_def.xml @@ -13,10 +13,8 @@ --> - - - - + + diff --git a/DataFormats/EgammaCandidates/interface/Conversion.h b/DataFormats/EgammaCandidates/interface/Conversion.h index 36f9882aa31d1..968b11f971282 100644 --- a/DataFormats/EgammaCandidates/interface/Conversion.h +++ b/DataFormats/EgammaCandidates/interface/Conversion.h @@ -20,228 +20,232 @@ #include "DataFormats/CaloRecHit/interface/CaloClusterCollection.h" namespace reco { - class Conversion { - public: - enum ConversionAlgorithm { undefined = 0, ecalSeeded = 1, trackerOnly = 2, mixed = 3, pflow = 4, algoSize = 5 }; - - enum ConversionQuality { - generalTracksOnly = 0, - arbitratedEcalSeeded = 1, - arbitratedMerged = 2, - arbitratedMergedEcalGeneral = 3, - gsfTracksOpenOnly = 4, - highPurity = 8, - highEfficiency = 9, - ecalMatched1Track = 10, - ecalMatched2Track = 11 + namespace io_v1 { + class Conversion { + public: + enum ConversionAlgorithm { undefined = 0, ecalSeeded = 1, trackerOnly = 2, mixed = 3, pflow = 4, algoSize = 5 }; + + enum ConversionQuality { + generalTracksOnly = 0, + arbitratedEcalSeeded = 1, + arbitratedMerged = 2, + arbitratedMergedEcalGeneral = 3, + gsfTracksOpenOnly = 4, + highPurity = 8, + highEfficiency = 9, + ecalMatched1Track = 10, + ecalMatched2Track = 11 + }; + + static const std::string algoNames[]; + + // Default constructor + Conversion(); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector >& tr, + const std::vector& trackPositionAtEcal, + const reco::Vertex& convVtx, + const std::vector& matchingBC, + const float DCA, + const std::vector& innPoint, + const std::vector& trackPin, + const std::vector& trackPout, + const std::vector& nHitsBeforeVtx, + const std::vector& dlClosestHitToVtx, + uint8_t nSharedHits, + const float mva, + ConversionAlgorithm = undefined); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector& tr, + const std::vector& trackPositionAtEcal, + const reco::Vertex& convVtx, + const std::vector& matchingBC, + const float DCA, + const std::vector& innPoint, + const std::vector& trackPin, + const std::vector& trackPout, + const float mva, + ConversionAlgorithm = undefined); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector& tr, + const reco::Vertex& convVtx, + ConversionAlgorithm = undefined); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector >& tr, + const reco::Vertex& convVtx, + ConversionAlgorithm = undefined); + + /// returns a clone of the candidate + Conversion* clone() const; + /// Pointer to CaloCluster (foe Egamma Conversions it points to a SuperCluster) + reco::CaloClusterPtrVector caloCluster() const { return caloCluster_; } + /// vector of track to base references + std::vector > const& tracks() const; + /// returns the reco conversion vertex + const reco::Vertex& conversionVertex() const { return theConversionVertex_; } + /// Bool flagging objects having track size >0 + bool isConverted() const; + /// Number of tracks= 0,1,2 + unsigned int nTracks() const { return tracks().size(); } + /// get the value of the TMVA output + double MVAout() const { return theMVAout_; } + /// get the MVS output from PF for one leg conversions + std::vector const oneLegMVA() { return theOneLegMVA_; } + /// if nTracks=2 returns the pair invariant mass. Original tracks are used here + double pairInvariantMass() const; + /// Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used + double pairCotThetaSeparation() const; + /// Conversion tracks momentum from the tracks inner momentum + math::XYZVectorF pairMomentum() const; + /// Conversion track pair 4-momentum from the tracks refitted with vertex constraint + math::XYZTLorentzVectorF refittedPair4Momentum() const; + /// Conversion tracks momentum from the tracks refitted with vertex constraint + math::XYZVectorF refittedPairMomentum() const; + /// Super Cluster energy divided by track pair momentum if Standard seeding method. If a pointer to two (or more clusters) + /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum + /// Track innermost momentum is used here + double EoverP() const; + /// Super Cluster energy divided by track pair momentum if Standard seeing method. If a pointer to two (or more clusters) + /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum + /// Track momentum refitted with vertex constraint is used + double EoverPrefittedTracks() const; + // Dist of minimum approach between tracks + double distOfMinimumApproach() const { return theMinDistOfApproach_; } + // deltaPhi tracks at innermost point + double dPhiTracksAtVtx() const; + // deltaPhi tracks at ECAl + double dPhiTracksAtEcal() const; + // deltaEta tracks at ECAl + double dEtaTracksAtEcal() const; + + //impact parameter and decay length computed with respect to given beamspot or vertex + //computed from refittedPairMomentum + + //transverse impact parameter + double dxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //longitudinal impact parameter + double dz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //transverse decay length + double lxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //longitudinal decay length + double lz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //z position of intersection with beamspot in rz plane (possible tilt of beamspot is neglected) + double zOfPrimaryVertexFromTracks(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const { + return dz(myBeamSpot) + myBeamSpot.z(); + } + + ///// The following are variables provided per each track + /// positions of the track extrapolation at the ECAL front face + const std::vector& ecalImpactPosition() const { return thePositionAtEcal_; } + // pair of BC matching a posteriori the tracks + const std::vector& bcMatchingWithTracks() const { return theMatchingBCs_; } + /// signed transverse impact parameter for each track + std::vector tracksSigned_d0() const; + /// Vector containing the position of the innermost hit of each track + const std::vector& tracksInnerPosition() const { return theTrackInnerPosition_; } + /// Vector of track momentum measured at the outermost hit + const std::vector& tracksPout() const { return theTrackPout_; } + /// Vector of track momentum measured at the innermost hit + const std::vector& tracksPin() const { return theTrackPin_; } + ///Vector of the number of hits before the vertex along each track trajector + const std::vector& nHitsBeforeVtx() const { return nHitsBeforeVtx_; } + ///Vector of signed decay length with uncertainty from nearest hit on track to the conversion vtx positions + const std::vector& dlClosestHitToVtx() const { return dlClosestHitToVtx_; } + ///number of shared hits btw the two track + uint8_t nSharedHits() const { return nSharedHits_; } + + /// set the value of the TMVA output + void setMVAout(const float& mva) { theMVAout_ = mva; } + /// set the MVS output from PF for one leg conversions + void setOneLegMVA(const std::vector& mva) { theOneLegMVA_ = mva; } + // Set the ptr to the Super cluster if not set in the constructor + void setMatchingSuperCluster(const reco::CaloClusterPtrVector& sc) { caloCluster_ = sc; } + /// Conversion Track algorithm/provenance + void setConversionAlgorithm(const ConversionAlgorithm a, bool set = true) { + if (set) + algorithm_ = a; + else + algorithm_ = undefined; + } + ConversionAlgorithm algo() const; + std::string algoName() const; + static std::string algoName(ConversionAlgorithm); + static ConversionAlgorithm algoByName(const std::string& name); + + bool quality(ConversionQuality q) const { return (qualityMask_ & (1 << q)) >> q; } + void setQuality(ConversionQuality q, bool b); + + private: + /// vector pointer to a/multiple seed CaloCluster(s) + reco::CaloClusterPtrVector caloCluster_; + /// vector Track RefToBase + std::vector > trackToBaseRefs_; + /// position at the ECAl surface of the track extrapolation + std::vector thePositionAtEcal_; + /// Fitted Kalman conversion vertex + reco::Vertex theConversionVertex_; + /// Clusters mathing the tracks (these are not the seeds) + std::vector theMatchingBCs_; + /// P_in of tracks + std::vector theTrackInnerPosition_; + /// P_in of tracks + std::vector theTrackPin_; + /// P_out of tracks + std::vector theTrackPout_; + ///number of hits before the vertex on each trackerOnly + std::vector nHitsBeforeVtx_; + ///signed decay length and uncertainty from nearest hit on track to conversion vertex + std::vector dlClosestHitToVtx_; + /// vectors of TMVA outputs from pflow for one leg conversions + std::vector theOneLegMVA_; + /// Distance of min approach of the two tracks + float theMinDistOfApproach_; + /// TMVA output + float theMVAout_; + uint16_t qualityMask_; + ///number of shared hits between tracks + uint8_t nSharedHits_; + /// conversion algorithm/provenance + uint8_t algorithm_; }; - static const std::string algoNames[]; - - // Default constructor - Conversion(); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector >& tr, - const std::vector& trackPositionAtEcal, - const reco::Vertex& convVtx, - const std::vector& matchingBC, - const float DCA, - const std::vector& innPoint, - const std::vector& trackPin, - const std::vector& trackPout, - const std::vector& nHitsBeforeVtx, - const std::vector& dlClosestHitToVtx, - uint8_t nSharedHits, - const float mva, - ConversionAlgorithm = undefined); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector& tr, - const std::vector& trackPositionAtEcal, - const reco::Vertex& convVtx, - const std::vector& matchingBC, - const float DCA, - const std::vector& innPoint, - const std::vector& trackPin, - const std::vector& trackPout, - const float mva, - ConversionAlgorithm = undefined); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector& tr, - const reco::Vertex& convVtx, - ConversionAlgorithm = undefined); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector >& tr, - const reco::Vertex& convVtx, - ConversionAlgorithm = undefined); - - /// returns a clone of the candidate - Conversion* clone() const; - /// Pointer to CaloCluster (foe Egamma Conversions it points to a SuperCluster) - reco::CaloClusterPtrVector caloCluster() const { return caloCluster_; } - /// vector of track to base references - std::vector > const& tracks() const; - /// returns the reco conversion vertex - const reco::Vertex& conversionVertex() const { return theConversionVertex_; } - /// Bool flagging objects having track size >0 - bool isConverted() const; - /// Number of tracks= 0,1,2 - unsigned int nTracks() const { return tracks().size(); } - /// get the value of the TMVA output - double MVAout() const { return theMVAout_; } - /// get the MVS output from PF for one leg conversions - std::vector const oneLegMVA() { return theOneLegMVA_; } - /// if nTracks=2 returns the pair invariant mass. Original tracks are used here - double pairInvariantMass() const; - /// Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used - double pairCotThetaSeparation() const; - /// Conversion tracks momentum from the tracks inner momentum - math::XYZVectorF pairMomentum() const; - /// Conversion track pair 4-momentum from the tracks refitted with vertex constraint - math::XYZTLorentzVectorF refittedPair4Momentum() const; - /// Conversion tracks momentum from the tracks refitted with vertex constraint - math::XYZVectorF refittedPairMomentum() const; - /// Super Cluster energy divided by track pair momentum if Standard seeding method. If a pointer to two (or more clusters) - /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum - /// Track innermost momentum is used here - double EoverP() const; - /// Super Cluster energy divided by track pair momentum if Standard seeing method. If a pointer to two (or more clusters) - /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum - /// Track momentum refitted with vertex constraint is used - double EoverPrefittedTracks() const; - // Dist of minimum approach between tracks - double distOfMinimumApproach() const { return theMinDistOfApproach_; } - // deltaPhi tracks at innermost point - double dPhiTracksAtVtx() const; - // deltaPhi tracks at ECAl - double dPhiTracksAtEcal() const; - // deltaEta tracks at ECAl - double dEtaTracksAtEcal() const; - - //impact parameter and decay length computed with respect to given beamspot or vertex - //computed from refittedPairMomentum - - //transverse impact parameter - double dxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //longitudinal impact parameter - double dz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //transverse decay length - double lxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //longitudinal decay length - double lz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //z position of intersection with beamspot in rz plane (possible tilt of beamspot is neglected) - double zOfPrimaryVertexFromTracks(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const { - return dz(myBeamSpot) + myBeamSpot.z(); + inline Conversion::ConversionAlgorithm Conversion::algo() const { return (ConversionAlgorithm)algorithm_; } + + inline std::string Conversion::algoName() const { + switch (algorithm_) { + case undefined: + return "undefined"; + case ecalSeeded: + return "ecalSeeded"; + case trackerOnly: + return "trackerOnly"; + case mixed: + return "mixed"; + case pflow: + return "pflow"; + } + return "undefined"; } - ///// The following are variables provided per each track - /// positions of the track extrapolation at the ECAL front face - const std::vector& ecalImpactPosition() const { return thePositionAtEcal_; } - // pair of BC matching a posteriori the tracks - const std::vector& bcMatchingWithTracks() const { return theMatchingBCs_; } - /// signed transverse impact parameter for each track - std::vector tracksSigned_d0() const; - /// Vector containing the position of the innermost hit of each track - const std::vector& tracksInnerPosition() const { return theTrackInnerPosition_; } - /// Vector of track momentum measured at the outermost hit - const std::vector& tracksPout() const { return theTrackPout_; } - /// Vector of track momentum measured at the innermost hit - const std::vector& tracksPin() const { return theTrackPin_; } - ///Vector of the number of hits before the vertex along each track trajector - const std::vector& nHitsBeforeVtx() const { return nHitsBeforeVtx_; } - ///Vector of signed decay length with uncertainty from nearest hit on track to the conversion vtx positions - const std::vector& dlClosestHitToVtx() const { return dlClosestHitToVtx_; } - ///number of shared hits btw the two track - uint8_t nSharedHits() const { return nSharedHits_; } - - /// set the value of the TMVA output - void setMVAout(const float& mva) { theMVAout_ = mva; } - /// set the MVS output from PF for one leg conversions - void setOneLegMVA(const std::vector& mva) { theOneLegMVA_ = mva; } - // Set the ptr to the Super cluster if not set in the constructor - void setMatchingSuperCluster(const reco::CaloClusterPtrVector& sc) { caloCluster_ = sc; } - /// Conversion Track algorithm/provenance - void setConversionAlgorithm(const ConversionAlgorithm a, bool set = true) { - if (set) - algorithm_ = a; - else - algorithm_ = undefined; + inline std::string Conversion::algoName(ConversionAlgorithm a) { + if (int(a) < int(algoSize) && int(a) > 0) + return algoNames[int(a)]; + return "undefined"; } - ConversionAlgorithm algo() const; - std::string algoName() const; - static std::string algoName(ConversionAlgorithm); - static ConversionAlgorithm algoByName(const std::string& name); - - bool quality(ConversionQuality q) const { return (qualityMask_ & (1 << q)) >> q; } - void setQuality(ConversionQuality q, bool b); - - private: - /// vector pointer to a/multiple seed CaloCluster(s) - reco::CaloClusterPtrVector caloCluster_; - /// vector Track RefToBase - std::vector > trackToBaseRefs_; - /// position at the ECAl surface of the track extrapolation - std::vector thePositionAtEcal_; - /// Fitted Kalman conversion vertex - reco::Vertex theConversionVertex_; - /// Clusters mathing the tracks (these are not the seeds) - std::vector theMatchingBCs_; - /// P_in of tracks - std::vector theTrackInnerPosition_; - /// P_in of tracks - std::vector theTrackPin_; - /// P_out of tracks - std::vector theTrackPout_; - ///number of hits before the vertex on each trackerOnly - std::vector nHitsBeforeVtx_; - ///signed decay length and uncertainty from nearest hit on track to conversion vertex - std::vector dlClosestHitToVtx_; - /// vectors of TMVA outputs from pflow for one leg conversions - std::vector theOneLegMVA_; - /// Distance of min approach of the two tracks - float theMinDistOfApproach_; - /// TMVA output - float theMVAout_; - uint16_t qualityMask_; - ///number of shared hits between tracks - uint8_t nSharedHits_; - /// conversion algorithm/provenance - uint8_t algorithm_; - }; - - inline Conversion::ConversionAlgorithm Conversion::algo() const { return (ConversionAlgorithm)algorithm_; } - - inline std::string Conversion::algoName() const { - switch (algorithm_) { - case undefined: - return "undefined"; - case ecalSeeded: - return "ecalSeeded"; - case trackerOnly: - return "trackerOnly"; - case mixed: - return "mixed"; - case pflow: - return "pflow"; + + inline void Conversion::setQuality(ConversionQuality q, bool b) { + if (b) //regular OR if setting value to true + qualityMask_ |= (1 << q); + else // doing "half-XOR" if unsetting value + qualityMask_ &= (~(1 << q)); } - return "undefined"; - } - - inline std::string Conversion::algoName(ConversionAlgorithm a) { - if (int(a) < int(algoSize) && int(a) > 0) - return algoNames[int(a)]; - return "undefined"; - } - - inline void Conversion::setQuality(ConversionQuality q, bool b) { - if (b) //regular OR if setting value to true - qualityMask_ |= (1 << q); - else // doing "half-XOR" if unsetting value - qualityMask_ &= (~(1 << q)); - } + + } // namespace io_v1 + using Conversion = io_v1::Conversion; } // namespace reco diff --git a/DataFormats/EgammaCandidates/interface/ConversionFwd.h b/DataFormats/EgammaCandidates/interface/ConversionFwd.h index 7027c229b5201..687e238bdeecc 100644 --- a/DataFormats/EgammaCandidates/interface/ConversionFwd.h +++ b/DataFormats/EgammaCandidates/interface/ConversionFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Conversion; + namespace io_v1 { + class Conversion; + } + using Conversion = io_v1::Conversion; /// collectin of Conversion objects typedef std::vector ConversionCollection; diff --git a/DataFormats/EgammaCandidates/interface/Electron.h b/DataFormats/EgammaCandidates/interface/Electron.h index 647cb074f2867..a300bf5137335 100644 --- a/DataFormats/EgammaCandidates/interface/Electron.h +++ b/DataFormats/EgammaCandidates/interface/Electron.h @@ -12,44 +12,48 @@ #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" namespace reco { + namespace io_v1 { - class Electron : public RecoCandidate { - public: - /// default constructor - Electron() : RecoCandidate() {} - /// constructor from values - Electron(Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0)) - : RecoCandidate(q, p4, vtx, -11 * q) {} - /// destructor - ~Electron() override; - /// returns a clone of the candidate - Electron* clone() const override; - /// reference to a Track - using reco::RecoCandidate::track; // avoid hiding the base - reco::TrackRef track() const override; - /// reference to a SuperCluster - reco::SuperClusterRef superCluster() const override; - /// reference to a GsfTrack - reco::GsfTrackRef gsfTrack() const override; - /// set refrence to Photon component - void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } - /// set refrence to Track component - void setTrack(const reco::TrackRef& r) { track_ = r; } - /// set reference to GsfTrack component - void setGsfTrack(const reco::GsfTrackRef& r) { gsfTrack_ = r; } + class Electron : public RecoCandidate { + public: + /// default constructor + Electron() : RecoCandidate() {} + /// constructor from values + Electron(Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0)) + : RecoCandidate(q, p4, vtx, -11 * q) {} + /// destructor + ~Electron() override; + /// returns a clone of the candidate + Electron* clone() const override; + /// reference to a Track + using reco::RecoCandidate::track; // avoid hiding the base + reco::TrackRef track() const override; + /// reference to a SuperCluster + reco::SuperClusterRef superCluster() const override; + /// reference to a GsfTrack + reco::GsfTrackRef gsfTrack() const override; + /// set refrence to Photon component + void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } + /// set refrence to Track component + void setTrack(const reco::TrackRef& r) { track_ = r; } + /// set reference to GsfTrack component + void setGsfTrack(const reco::GsfTrackRef& r) { gsfTrack_ = r; } - bool isElectron() const override; + bool isElectron() const override; - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to a SuperCluster - reco::SuperClusterRef superCluster_; - /// reference to a Track - reco::TrackRef track_; - /// reference to a GsfTrack; - reco::GsfTrackRef gsfTrack_; - }; + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to a SuperCluster + reco::SuperClusterRef superCluster_; + /// reference to a Track + reco::TrackRef track_; + /// reference to a GsfTrack; + reco::GsfTrackRef gsfTrack_; + }; + + } // namespace io_v1 + using Electron = io_v1::Electron; } // namespace reco diff --git a/DataFormats/EgammaCandidates/interface/ElectronFwd.h b/DataFormats/EgammaCandidates/interface/ElectronFwd.h index f034e039a541f..440c9556ed89c 100644 --- a/DataFormats/EgammaCandidates/interface/ElectronFwd.h +++ b/DataFormats/EgammaCandidates/interface/ElectronFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Electron; + namespace io_v1 { + class Electron; + } + using Electron = io_v1::Electron; /// collectin of Electron objects typedef std::vector ElectronCollection; diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index 51fa837f2ef83..f8f8fc4f842f7 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -20,8 +20,9 @@ #include namespace reco { + namespace io_v1 { - /**************************************************************************** + /**************************************************************************** * \class reco::GsfElectron * * An Electron with a GsfTrack seeded from an ElectronSeed. @@ -33,915 +34,919 @@ namespace reco { * ****************************************************************************/ - class GsfElectron : public RecoCandidate { - //======================================================= - // Constructors - // - // The clone() method with arguments, and the copy - // constructor with edm references is designed for - // someone which want to duplicates all - // collections. - //======================================================= - - public: - // some nested structures defined later on - struct ChargeInfo; - struct TrackClusterMatching; - struct TrackExtrapolations; - struct ClosestCtfTrack; - struct FiducialFlags; - struct ShowerShape; - struct IsolationVariables; - struct ConversionRejection; - struct ClassificationVariables; - struct SaturationInfo; - - GsfElectron(); - GsfElectron(const GsfElectronCoreRef &); - GsfElectron(const GsfElectron &, const GsfElectronCoreRef &); - GsfElectron(const GsfElectron &electron, - const GsfElectronCoreRef &core, - const CaloClusterPtr &electronCluster, - const TrackRef &closestCtfTrack, - const TrackBaseRef &conversionPartner, - const GsfTrackRefVector &ambiguousTracks); - GsfElectron(int charge, - const ChargeInfo &, - const GsfElectronCoreRef &, - const TrackClusterMatching &, - const TrackExtrapolations &, - const ClosestCtfTrack &, - const FiducialFlags &, - const ShowerShape &, - const ConversionRejection &); - GsfElectron(int charge, - const ChargeInfo &, - const GsfElectronCoreRef &, - const TrackClusterMatching &, - const TrackExtrapolations &, - const ClosestCtfTrack &, - const FiducialFlags &, - const ShowerShape &, - const ShowerShape &, - const ConversionRejection &, - const SaturationInfo &); - GsfElectron *clone() const override; - GsfElectron *clone(const GsfElectronCoreRef &core, - const CaloClusterPtr &electronCluster, - const TrackRef &closestCtfTrack, - const TrackBaseRef &conversionPartner, - const GsfTrackRefVector &ambiguousTracks) const; - ~GsfElectron() override {} - - private: - void init(); - - //======================================================= - // Candidate methods and complementary information - // - // The gsf electron producer has tried to best evaluate - // the four momentum and charge and given those values to - // the GsfElectron constructor, which forwarded them to - // the Candidate constructor. Those values can be retreived - // with getters inherited from Candidate : p4() and charge(). - //======================================================= - - public: - // Inherited from Candidate - // const LorentzVector & charge() const ; - // const LorentzVector & p4() const ; - - // Complementary struct - struct ChargeInfo { - int scPixCharge; - bool isGsfCtfScPixConsistent; - bool isGsfScPixConsistent; - bool isGsfCtfConsistent; - ChargeInfo() - : scPixCharge(0), isGsfCtfScPixConsistent(false), isGsfScPixConsistent(false), isGsfCtfConsistent(false) {} - }; - - // Charge info accessors - // to get gsf track charge: gsfTrack()->charge() - // to get ctf track charge, if closestCtfTrackRef().isNonnull(): closestCtfTrackRef()->charge() - int scPixCharge() const { return chargeInfo_.scPixCharge; } - bool isGsfCtfScPixChargeConsistent() const { return chargeInfo_.isGsfCtfScPixConsistent; } - bool isGsfScPixChargeConsistent() const { return chargeInfo_.isGsfScPixConsistent; } - bool isGsfCtfChargeConsistent() const { return chargeInfo_.isGsfCtfConsistent; } - const ChargeInfo &chargeInfo() const { return chargeInfo_; } - - // Candidate redefined methods - bool isElectron() const override { return true; } - bool overlap(const Candidate &) const override; - - private: - // Complementary attributes - ChargeInfo chargeInfo_; - - //======================================================= - // Core Attributes - // - // They all have been computed before, when building the - // collection of GsfElectronCore instances. Each GsfElectron - // has a reference toward a GsfElectronCore. - //======================================================= - - public: - // accessors - virtual GsfElectronCoreRef core() const; - void setCore(const reco::GsfElectronCoreRef &core) { core_ = core; } - - // forward core methods - SuperClusterRef superCluster() const override { return core()->superCluster(); } - GsfTrackRef gsfTrack() const override { return core()->gsfTrack(); } - float ctfGsfOverlap() const { return core()->ctfGsfOverlap(); } - bool ecalDrivenSeed() const { return core()->ecalDrivenSeed(); } - bool trackerDrivenSeed() const { return core()->trackerDrivenSeed(); } - virtual SuperClusterRef parentSuperCluster() const { return core()->parentSuperCluster(); } - bool closestCtfTrackRefValid() const { - return closestCtfTrackRef().isAvailable() && closestCtfTrackRef().isNonnull(); - } - //methods used for MVA variables - float closestCtfTrackNormChi2() const { - return closestCtfTrackRefValid() ? closestCtfTrackRef()->normalizedChi2() : 0; - } - int closestCtfTrackNLayers() const { - return closestCtfTrackRefValid() ? closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement() : -1; - } - - // backward compatibility - struct ClosestCtfTrack { - TrackRef ctfTrack; // best matching ctf track - float shFracInnerHits; // fraction of common hits between the ctf and gsf tracks - ClosestCtfTrack() : shFracInnerHits(0.) {} - ClosestCtfTrack(TrackRef track, float sh) : ctfTrack(track), shFracInnerHits(sh) {} - }; - float shFracInnerHits() const { return core()->ctfGsfOverlap(); } - virtual TrackRef closestCtfTrackRef() const { return core()->ctfTrack(); } - virtual ClosestCtfTrack closestCtfTrack() const { - return ClosestCtfTrack(core()->ctfTrack(), core()->ctfGsfOverlap()); - } - - private: - // attributes - GsfElectronCoreRef core_; - - //======================================================= - // Track-Cluster Matching Attributes - //======================================================= - - public: - struct TrackClusterMatching { - CaloClusterPtr electronCluster; // basic cluster best matching gsf track - float eSuperClusterOverP; // the supercluster energy / track momentum at the PCA to the beam spot - float eSeedClusterOverP; // the seed cluster energy / track momentum at the PCA to the beam spot - float eSeedClusterOverPout; // the seed cluster energy / track momentum at calo extrapolated from the outermost track state - float eEleClusterOverPout; // the electron cluster energy / track momentum at calo extrapolated from the outermost track state - float deltaEtaSuperClusterAtVtx; // the supercluster eta - track eta position at calo extrapolated from innermost track state - float deltaEtaSeedClusterAtCalo; // the seed cluster eta - track eta position at calo extrapolated from the outermost track state - float deltaEtaEleClusterAtCalo; // the electron cluster eta - track eta position at calo extrapolated from the outermost state - float deltaPhiEleClusterAtCalo; // the electron cluster phi - track phi position at calo extrapolated from the outermost track state - float deltaPhiSuperClusterAtVtx; // the supercluster phi - track phi position at calo extrapolated from the innermost track state - float deltaPhiSeedClusterAtCalo; // the seed cluster phi - track phi position at calo extrapolated from the outermost track state - TrackClusterMatching() - : eSuperClusterOverP(0.), - eSeedClusterOverP(0.), - eSeedClusterOverPout(0.), - eEleClusterOverPout(0.), - deltaEtaSuperClusterAtVtx(std::numeric_limits::max()), - deltaEtaSeedClusterAtCalo(std::numeric_limits::max()), - deltaEtaEleClusterAtCalo(std::numeric_limits::max()), - deltaPhiEleClusterAtCalo(std::numeric_limits::max()), - deltaPhiSuperClusterAtVtx(std::numeric_limits::max()), - deltaPhiSeedClusterAtCalo(std::numeric_limits::max()) {} - }; - - // accessors - CaloClusterPtr electronCluster() const { return trackClusterMatching_.electronCluster; } - float eSuperClusterOverP() const { return trackClusterMatching_.eSuperClusterOverP; } - float eSeedClusterOverP() const { return trackClusterMatching_.eSeedClusterOverP; } - float eSeedClusterOverPout() const { return trackClusterMatching_.eSeedClusterOverPout; } - float eEleClusterOverPout() const { return trackClusterMatching_.eEleClusterOverPout; } - float deltaEtaSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaEtaSuperClusterAtVtx; } - float deltaEtaSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaSeedClusterAtCalo; } - float deltaEtaEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaEleClusterAtCalo; } - float deltaPhiSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaPhiSuperClusterAtVtx; } - float deltaPhiSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiSeedClusterAtCalo; } - float deltaPhiEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiEleClusterAtCalo; } - float deltaEtaSeedClusterTrackAtVtx() const { - return superCluster().isNonnull() && superCluster()->seed().isNonnull() - ? trackClusterMatching_.deltaEtaSuperClusterAtVtx - superCluster()->eta() + - superCluster()->seed()->eta() - : std::numeric_limits::max(); - } - const TrackClusterMatching &trackClusterMatching() const { return trackClusterMatching_; } - - // for backward compatibility, usefull ? - void setDeltaEtaSuperClusterAtVtx(float de) { trackClusterMatching_.deltaEtaSuperClusterAtVtx = de; } - void setDeltaPhiSuperClusterAtVtx(float dphi) { trackClusterMatching_.deltaPhiSuperClusterAtVtx = dphi; } - - private: - // attributes - TrackClusterMatching trackClusterMatching_; - - //======================================================= - // Track extrapolations - //======================================================= - - public: - struct TrackExtrapolations { - math::XYZPointF positionAtVtx; // the track PCA to the beam spot - math::XYZPointF positionAtCalo; // the track PCA to the supercluster position - math::XYZVectorF momentumAtVtx; // the track momentum at the PCA to the beam spot - // the track momentum extrapolated at the supercluster position from the innermost track state - math::XYZVectorF momentumAtCalo; - // the track momentum extrapolated at the seed cluster position from the outermost track state - math::XYZVectorF momentumOut; - // the track momentum extrapolated at the ele cluster position from the outermost track state - math::XYZVectorF momentumAtEleClus; - math::XYZVectorF momentumAtVtxWithConstraint; // the track momentum at the PCA to the beam spot using bs constraint - }; - - // accessors - math::XYZPointF trackPositionAtVtx() const { return trackExtrapolations_.positionAtVtx; } - math::XYZPointF trackPositionAtCalo() const { return trackExtrapolations_.positionAtCalo; } - math::XYZVectorF trackMomentumAtVtx() const { return trackExtrapolations_.momentumAtVtx; } - math::XYZVectorF trackMomentumAtCalo() const { return trackExtrapolations_.momentumAtCalo; } - math::XYZVectorF trackMomentumOut() const { return trackExtrapolations_.momentumOut; } - math::XYZVectorF trackMomentumAtEleClus() const { return trackExtrapolations_.momentumAtEleClus; } - math::XYZVectorF trackMomentumAtVtxWithConstraint() const { - return trackExtrapolations_.momentumAtVtxWithConstraint; - } - const TrackExtrapolations &trackExtrapolations() const { return trackExtrapolations_; } - - // setter (if you know what you're doing) - void setTrackExtrapolations(const TrackExtrapolations &te) { trackExtrapolations_ = te; } - - // for backward compatibility - math::XYZPointF TrackPositionAtVtx() const { return trackPositionAtVtx(); } - math::XYZPointF TrackPositionAtCalo() const { return trackPositionAtCalo(); } - - private: - // attributes - TrackExtrapolations trackExtrapolations_; - - //======================================================= - // SuperCluster direct access - //======================================================= - - public: - // direct accessors - math::XYZPoint superClusterPosition() const { return superCluster()->position(); } // the super cluster position - int basicClustersSize() const { - return superCluster()->clustersSize(); - } // number of basic clusters inside the supercluster - CaloCluster_iterator basicClustersBegin() const { return superCluster()->clustersBegin(); } - CaloCluster_iterator basicClustersEnd() const { return superCluster()->clustersEnd(); } - - // for backward compatibility - math::XYZPoint caloPosition() const { return superCluster()->position(); } - - //======================================================= - // Fiducial Flags - //======================================================= - - public: - struct FiducialFlags { - bool isEB; // true if particle is in ECAL Barrel - bool isEE; // true if particle is in ECAL Endcaps - bool isEBEEGap; // true if particle is in the crack between EB and EE - bool isEBEtaGap; // true if particle is in EB, and inside the eta gaps between modules - bool isEBPhiGap; // true if particle is in EB, and inside the phi gaps between modules - bool isEEDeeGap; // true if particle is in EE, and inside the gaps between dees - bool isEERingGap; // true if particle is in EE, and inside the gaps between rings - FiducialFlags() - : isEB(false), - isEE(false), - isEBEEGap(false), - isEBEtaGap(false), - isEBPhiGap(false), - isEEDeeGap(false), - isEERingGap(false) {} - }; - - // accessors - bool isEB() const { return fiducialFlags_.isEB; } - bool isEE() const { return fiducialFlags_.isEE; } - bool isGap() const { return ((isEBEEGap()) || (isEBGap()) || (isEEGap())); } - bool isEBEEGap() const { return fiducialFlags_.isEBEEGap; } - bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } - bool isEBEtaGap() const { return fiducialFlags_.isEBEtaGap; } - bool isEBPhiGap() const { return fiducialFlags_.isEBPhiGap; } - bool isEEGap() const { return (isEEDeeGap() || isEERingGap()); } - bool isEEDeeGap() const { return fiducialFlags_.isEEDeeGap; } - bool isEERingGap() const { return fiducialFlags_.isEERingGap; } - const FiducialFlags &fiducialFlags() const { return fiducialFlags_; } - // setters... not necessary in regular situations - // but handy for late stage modifications of electron objects - void setFFlagIsEB(const bool b) { fiducialFlags_.isEB = b; } - void setFFlagIsEE(const bool b) { fiducialFlags_.isEE = b; } - void setFFlagIsEBEEGap(const bool b) { fiducialFlags_.isEBEEGap = b; } - void setFFlagIsEBEtaGap(const bool b) { fiducialFlags_.isEBEtaGap = b; } - void setFFlagIsEBPhiGap(const bool b) { fiducialFlags_.isEBPhiGap = b; } - void setFFlagIsEEDeeGap(const bool b) { fiducialFlags_.isEEDeeGap = b; } - void setFFlagIsEERingGap(const bool b) { fiducialFlags_.isEERingGap = b; } - - private: - // attributes - FiducialFlags fiducialFlags_; - - //======================================================= - // Shower Shape Variables - //======================================================= - - public: - struct ShowerShape { - float sigmaEtaEta; // weighted cluster rms along eta and inside 5x5 (absolute eta) - float sigmaIetaIeta; // weighted cluster rms along eta and inside 5x5 (Xtal eta) - float sigmaIphiIphi; // weighted cluster rms along phi and inside 5x5 (Xtal phi) - float e1x5; // energy inside 1x5 in etaxphi around the seed Xtal - float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) - float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal - float r9; // ratio of the 3x3 energy and supercluster energy - float hcalDepth1OverEcal; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers within a cone) - float hcalDepth2OverEcal; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers within a cone) - float hcalDepth1OverEcalBc; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers behind clusters) - float hcalDepth2OverEcalBc; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers behind clusters) - std::array - hcalOverEcal; // run3 hcal over ecal seed cluster energy per depth (using rechits within a cone) - std::array - hcalOverEcalBc; // run3 hcal over ecal seed cluster energy per depth (using rechits behind clusters) - std::vector hcalTowersBehindClusters; - bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - float sigmaIetaIphi; - float eMax; - float e2nd; - float eTop; - float eLeft; - float eRight; - float eBottom; - float e2x5Top; - float e2x5Left; - float e2x5Right; - float e2x5Bottom; - ShowerShape() - : sigmaEtaEta(std::numeric_limits::max()), - sigmaIetaIeta(std::numeric_limits::max()), - sigmaIphiIphi(std::numeric_limits::max()), - e1x5(0.f), - e2x5Max(0.f), - e5x5(0.f), - r9(-std::numeric_limits::max()), - hcalDepth1OverEcal(0.f), - hcalDepth2OverEcal(0.f), - hcalDepth1OverEcalBc(0.f), - hcalDepth2OverEcalBc(0.f), - hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - invalidHcal(false), - pre7DepthHcal(true), - sigmaIetaIphi(0.f), - eMax(0.f), - e2nd(0.f), - eTop(0.f), - eLeft(0.f), - eRight(0.f), - eBottom(0.f), - e2x5Top(0.f), - e2x5Left(0.f), - e2x5Right(0.f), - e2x5Bottom(0.f) {} - }; - - // accessors - float sigmaEtaEta() const { return showerShape_.sigmaEtaEta; } - float sigmaIetaIeta() const { return showerShape_.sigmaIetaIeta; } - float sigmaIphiIphi() const { return showerShape_.sigmaIphiIphi; } - float e1x5() const { return showerShape_.e1x5; } - float e2x5Max() const { return showerShape_.e2x5Max; } - float e5x5() const { return showerShape_.e5x5; } - float r9() const { return showerShape_.r9; } - float hcalOverEcal(const ShowerShape &ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; - else if (depth == 1) - return ss.hcalDepth1OverEcal; - else if (depth == 2) - return ss.hcalDepth2OverEcal; - - return 0.f; - } else { - const auto &hovere = ss.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + class GsfElectron : public RecoCandidate { + //======================================================= + // Constructors + // + // The clone() method with arguments, and the copy + // constructor with edm references is designed for + // someone which want to duplicates all + // collections. + //======================================================= + + public: + // some nested structures defined later on + struct ChargeInfo; + struct TrackClusterMatching; + struct TrackExtrapolations; + struct ClosestCtfTrack; + struct FiducialFlags; + struct ShowerShape; + struct IsolationVariables; + struct ConversionRejection; + struct ClassificationVariables; + struct SaturationInfo; + + GsfElectron(); + GsfElectron(const GsfElectronCoreRef &); + GsfElectron(const GsfElectron &, const GsfElectronCoreRef &); + GsfElectron(const GsfElectron &electron, + const GsfElectronCoreRef &core, + const CaloClusterPtr &electronCluster, + const TrackRef &closestCtfTrack, + const TrackBaseRef &conversionPartner, + const GsfTrackRefVector &ambiguousTracks); + GsfElectron(int charge, + const ChargeInfo &, + const GsfElectronCoreRef &, + const TrackClusterMatching &, + const TrackExtrapolations &, + const ClosestCtfTrack &, + const FiducialFlags &, + const ShowerShape &, + const ConversionRejection &); + GsfElectron(int charge, + const ChargeInfo &, + const GsfElectronCoreRef &, + const TrackClusterMatching &, + const TrackExtrapolations &, + const ClosestCtfTrack &, + const FiducialFlags &, + const ShowerShape &, + const ShowerShape &, + const ConversionRejection &, + const SaturationInfo &); + GsfElectron *clone() const override; + GsfElectron *clone(const GsfElectronCoreRef &core, + const CaloClusterPtr &electronCluster, + const TrackRef &closestCtfTrack, + const TrackBaseRef &conversionPartner, + const GsfTrackRefVector &ambiguousTracks) const; + ~GsfElectron() override {} + + private: + void init(); + + //======================================================= + // Candidate methods and complementary information + // + // The gsf electron producer has tried to best evaluate + // the four momentum and charge and given those values to + // the GsfElectron constructor, which forwarded them to + // the Candidate constructor. Those values can be retreived + // with getters inherited from Candidate : p4() and charge(). + //======================================================= + + public: + // Inherited from Candidate + // const LorentzVector & charge() const ; + // const LorentzVector & p4() const ; + + // Complementary struct + struct ChargeInfo { + int scPixCharge; + bool isGsfCtfScPixConsistent; + bool isGsfScPixConsistent; + bool isGsfCtfConsistent; + ChargeInfo() + : scPixCharge(0), isGsfCtfScPixConsistent(false), isGsfScPixConsistent(false), isGsfCtfConsistent(false) {} + }; + + // Charge info accessors + // to get gsf track charge: gsfTrack()->charge() + // to get ctf track charge, if closestCtfTrackRef().isNonnull(): closestCtfTrackRef()->charge() + int scPixCharge() const { return chargeInfo_.scPixCharge; } + bool isGsfCtfScPixChargeConsistent() const { return chargeInfo_.isGsfCtfScPixConsistent; } + bool isGsfScPixChargeConsistent() const { return chargeInfo_.isGsfScPixConsistent; } + bool isGsfCtfChargeConsistent() const { return chargeInfo_.isGsfCtfConsistent; } + const ChargeInfo &chargeInfo() const { return chargeInfo_; } + + // Candidate redefined methods + bool isElectron() const override { return true; } + bool overlap(const Candidate &) const override; + + private: + // Complementary attributes + ChargeInfo chargeInfo_; + + //======================================================= + // Core Attributes + // + // They all have been computed before, when building the + // collection of GsfElectronCore instances. Each GsfElectron + // has a reference toward a GsfElectronCore. + //======================================================= + + public: + // accessors + virtual GsfElectronCoreRef core() const; + void setCore(const reco::GsfElectronCoreRef &core) { core_ = core; } + + // forward core methods + SuperClusterRef superCluster() const override { return core()->superCluster(); } + GsfTrackRef gsfTrack() const override { return core()->gsfTrack(); } + float ctfGsfOverlap() const { return core()->ctfGsfOverlap(); } + bool ecalDrivenSeed() const { return core()->ecalDrivenSeed(); } + bool trackerDrivenSeed() const { return core()->trackerDrivenSeed(); } + virtual SuperClusterRef parentSuperCluster() const { return core()->parentSuperCluster(); } + bool closestCtfTrackRefValid() const { + return closestCtfTrackRef().isAvailable() && closestCtfTrackRef().isNonnull(); } - } - float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShape_, depth); } - float hcalOverEcalBc(const ShowerShape &ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; - else if (depth == 1) - return ss.hcalDepth1OverEcalBc; - else if (depth == 2) - return ss.hcalDepth2OverEcalBc; - - return 0.f; - } else { - const auto &hovere = ss.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + //methods used for MVA variables + float closestCtfTrackNormChi2() const { + return closestCtfTrackRefValid() ? closestCtfTrackRef()->normalizedChi2() : 0; + } + int closestCtfTrackNLayers() const { + return closestCtfTrackRefValid() ? closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement() : -1; } - } - float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShape_, depth); } - const std::vector &hcalTowersBehindClusters() const { - return showerShape_.hcalTowersBehindClusters; - } - bool hcalOverEcalValid() const { return !showerShape_.invalidHcal; } - float eLeft() const { return showerShape_.eLeft; } - float eRight() const { return showerShape_.eRight; } - float eTop() const { return showerShape_.eTop; } - float eBottom() const { return showerShape_.eBottom; } - const ShowerShape &showerShape() const { return showerShape_; } - // non-zero-suppressed and no-fractions shower shapes - // ecal energy is always that from the full 5x5 - float full5x5_sigmaEtaEta() const { return full5x5_showerShape_.sigmaEtaEta; } - float full5x5_sigmaIetaIeta() const { return full5x5_showerShape_.sigmaIetaIeta; } - float full5x5_sigmaIphiIphi() const { return full5x5_showerShape_.sigmaIphiIphi; } - float full5x5_e1x5() const { return full5x5_showerShape_.e1x5; } - float full5x5_e2x5Max() const { return full5x5_showerShape_.e2x5Max; } - float full5x5_e5x5() const { return full5x5_showerShape_.e5x5; } - float full5x5_r9() const { return full5x5_showerShape_.r9; } - float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShape_, depth); } - float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShape_, depth); } - bool full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } - float full5x5_e2x5Left() const { return full5x5_showerShape_.e2x5Left; } - float full5x5_e2x5Right() const { return full5x5_showerShape_.e2x5Right; } - float full5x5_e2x5Top() const { return full5x5_showerShape_.e2x5Top; } - float full5x5_e2x5Bottom() const { return full5x5_showerShape_.e2x5Bottom; } - float full5x5_eLeft() const { return full5x5_showerShape_.eLeft; } - float full5x5_eRight() const { return full5x5_showerShape_.eRight; } - float full5x5_eTop() const { return full5x5_showerShape_.eTop; } - float full5x5_eBottom() const { return full5x5_showerShape_.eBottom; } - const ShowerShape &full5x5_showerShape() const { return full5x5_showerShape_; } - - // setters (if you know what you're doing) - void setShowerShape(const ShowerShape &s) { showerShape_ = s; } - void full5x5_setShowerShape(const ShowerShape &s) { full5x5_showerShape_ = s; } - - // for backward compatibility (this will only ever be the ZS shapes!) - float scSigmaEtaEta() const { return sigmaEtaEta(); } - float scSigmaIEtaIEta() const { return sigmaIetaIeta(); } - float scE1x5() const { return e1x5(); } - float scE2x5Max() const { return e2x5Max(); } - float scE5x5() const { return e5x5(); } - float hadronicOverEm() const { return hcalOverEcal(); } - - private: - // attributes - ShowerShape showerShape_; - ShowerShape full5x5_showerShape_; - - //======================================================= - // SaturationInfo - //======================================================= - - public: - struct SaturationInfo { - int nSaturatedXtals; - bool isSeedSaturated; - SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} - }; - // accessors - float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } - float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } - const SaturationInfo &saturationInfo() const { return saturationInfo_; } - void setSaturationInfo(const SaturationInfo &s) { saturationInfo_ = s; } - - private: - SaturationInfo saturationInfo_; - - //======================================================= - // Isolation Variables - //======================================================= - - public: - struct IsolationVariables { - float tkSumPt; // track iso with electron footprint removed - float tkSumPtHEEP; // track iso used for the HEEP ID - float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed - float hcalDepth1TowerSumEt; // hcal depth 1 iso deposit with electron footprint removed - float hcalDepth2TowerSumEt; // hcal depth 2 iso deposit with electron footprint removed - float hcalDepth1TowerSumEtBc; // hcal depth 1 iso deposit without towers behind clusters - float hcalDepth2TowerSumEtBc; // hcal depth 2 iso deposit without towers behind clusters - std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed - std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - IsolationVariables() - : tkSumPt(0.), - tkSumPtHEEP(0.), - ecalRecHitSumEt(0.), - hcalDepth1TowerSumEt(0.f), - hcalDepth2TowerSumEt(0.f), - hcalDepth1TowerSumEtBc(0.f), - hcalDepth2TowerSumEtBc(0.f), - hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - pre7DepthHcal(true) {} - }; + // backward compatibility + struct ClosestCtfTrack { + TrackRef ctfTrack; // best matching ctf track + float shFracInnerHits; // fraction of common hits between the ctf and gsf tracks + ClosestCtfTrack() : shFracInnerHits(0.) {} + ClosestCtfTrack(TrackRef track, float sh) : ctfTrack(track), shFracInnerHits(sh) {} + }; + float shFracInnerHits() const { return core()->ctfGsfOverlap(); } + virtual TrackRef closestCtfTrackRef() const { return core()->ctfTrack(); } + virtual ClosestCtfTrack closestCtfTrack() const { + return ClosestCtfTrack(core()->ctfTrack(), core()->ctfGsfOverlap()); + } - // 03 accessors - float dr03TkSumPt() const { return dr03_.tkSumPt; } - float dr03TkSumPtHEEP() const { return dr03_.tkSumPtHEEP; } - float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt; } - float hcalTowerSumEt(const IsolationVariables &iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalDepth1TowerSumEt + iv.hcalDepth2TowerSumEt; - else if (depth == 1) - return iv.hcalDepth1TowerSumEt; - else if (depth == 2) - return iv.hcalDepth2TowerSumEt; - - return 0.f; - } else { - const auto &hcaliso = iv.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + private: + // attributes + GsfElectronCoreRef core_; + + //======================================================= + // Track-Cluster Matching Attributes + //======================================================= + + public: + struct TrackClusterMatching { + CaloClusterPtr electronCluster; // basic cluster best matching gsf track + float eSuperClusterOverP; // the supercluster energy / track momentum at the PCA to the beam spot + float eSeedClusterOverP; // the seed cluster energy / track momentum at the PCA to the beam spot + float eSeedClusterOverPout; // the seed cluster energy / track momentum at calo extrapolated from the outermost track state + float eEleClusterOverPout; // the electron cluster energy / track momentum at calo extrapolated from the outermost track state + float deltaEtaSuperClusterAtVtx; // the supercluster eta - track eta position at calo extrapolated from innermost track state + float deltaEtaSeedClusterAtCalo; // the seed cluster eta - track eta position at calo extrapolated from the outermost track state + float deltaEtaEleClusterAtCalo; // the electron cluster eta - track eta position at calo extrapolated from the outermost state + float deltaPhiEleClusterAtCalo; // the electron cluster phi - track phi position at calo extrapolated from the outermost track state + float deltaPhiSuperClusterAtVtx; // the supercluster phi - track phi position at calo extrapolated from the innermost track state + float deltaPhiSeedClusterAtCalo; // the seed cluster phi - track phi position at calo extrapolated from the outermost track state + TrackClusterMatching() + : eSuperClusterOverP(0.), + eSeedClusterOverP(0.), + eSeedClusterOverPout(0.), + eEleClusterOverPout(0.), + deltaEtaSuperClusterAtVtx(std::numeric_limits::max()), + deltaEtaSeedClusterAtCalo(std::numeric_limits::max()), + deltaEtaEleClusterAtCalo(std::numeric_limits::max()), + deltaPhiEleClusterAtCalo(std::numeric_limits::max()), + deltaPhiSuperClusterAtVtx(std::numeric_limits::max()), + deltaPhiSeedClusterAtCalo(std::numeric_limits::max()) {} + }; + + // accessors + CaloClusterPtr electronCluster() const { return trackClusterMatching_.electronCluster; } + float eSuperClusterOverP() const { return trackClusterMatching_.eSuperClusterOverP; } + float eSeedClusterOverP() const { return trackClusterMatching_.eSeedClusterOverP; } + float eSeedClusterOverPout() const { return trackClusterMatching_.eSeedClusterOverPout; } + float eEleClusterOverPout() const { return trackClusterMatching_.eEleClusterOverPout; } + float deltaEtaSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaEtaSuperClusterAtVtx; } + float deltaEtaSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaSeedClusterAtCalo; } + float deltaEtaEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaEleClusterAtCalo; } + float deltaPhiSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaPhiSuperClusterAtVtx; } + float deltaPhiSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiSeedClusterAtCalo; } + float deltaPhiEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiEleClusterAtCalo; } + float deltaEtaSeedClusterTrackAtVtx() const { + return superCluster().isNonnull() && superCluster()->seed().isNonnull() + ? trackClusterMatching_.deltaEtaSuperClusterAtVtx - superCluster()->eta() + + superCluster()->seed()->eta() + : std::numeric_limits::max(); } - } - float dr03HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr03_, depth); } - float hcalTowerSumEtBc(const IsolationVariables &iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalDepth1TowerSumEtBc + iv.hcalDepth2TowerSumEtBc; - else if (depth == 1) - return iv.hcalDepth1TowerSumEtBc; - else if (depth == 2) - return iv.hcalDepth2TowerSumEtBc; - - return 0.f; - } else { - const auto &hcaliso = iv.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + const TrackClusterMatching &trackClusterMatching() const { return trackClusterMatching_; } + + // for backward compatibility, usefull ? + void setDeltaEtaSuperClusterAtVtx(float de) { trackClusterMatching_.deltaEtaSuperClusterAtVtx = de; } + void setDeltaPhiSuperClusterAtVtx(float dphi) { trackClusterMatching_.deltaPhiSuperClusterAtVtx = dphi; } + + private: + // attributes + TrackClusterMatching trackClusterMatching_; + + //======================================================= + // Track extrapolations + //======================================================= + + public: + struct TrackExtrapolations { + math::XYZPointF positionAtVtx; // the track PCA to the beam spot + math::XYZPointF positionAtCalo; // the track PCA to the supercluster position + math::XYZVectorF momentumAtVtx; // the track momentum at the PCA to the beam spot + // the track momentum extrapolated at the supercluster position from the innermost track state + math::XYZVectorF momentumAtCalo; + // the track momentum extrapolated at the seed cluster position from the outermost track state + math::XYZVectorF momentumOut; + // the track momentum extrapolated at the ele cluster position from the outermost track state + math::XYZVectorF momentumAtEleClus; + math::XYZVectorF + momentumAtVtxWithConstraint; // the track momentum at the PCA to the beam spot using bs constraint + }; + + // accessors + math::XYZPointF trackPositionAtVtx() const { return trackExtrapolations_.positionAtVtx; } + math::XYZPointF trackPositionAtCalo() const { return trackExtrapolations_.positionAtCalo; } + math::XYZVectorF trackMomentumAtVtx() const { return trackExtrapolations_.momentumAtVtx; } + math::XYZVectorF trackMomentumAtCalo() const { return trackExtrapolations_.momentumAtCalo; } + math::XYZVectorF trackMomentumOut() const { return trackExtrapolations_.momentumOut; } + math::XYZVectorF trackMomentumAtEleClus() const { return trackExtrapolations_.momentumAtEleClus; } + math::XYZVectorF trackMomentumAtVtxWithConstraint() const { + return trackExtrapolations_.momentumAtVtxWithConstraint; } - } - float dr03HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr03_, depth); } - const IsolationVariables &dr03IsolationVariables() const { return dr03_; } - - // 04 accessors - float dr04TkSumPt() const { return dr04_.tkSumPt; } - float dr04TkSumPtHEEP() const { return dr04_.tkSumPtHEEP; } - float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt; } - float dr04HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr04_, depth); } - float dr04HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr04_, depth); } - const IsolationVariables &dr04IsolationVariables() const { return dr04_; } - - // setters ?!? - void setDr03Isolation(const IsolationVariables &dr03) { dr03_ = dr03; } - void setDr04Isolation(const IsolationVariables &dr04) { dr04_ = dr04; } - - // for backward compatibility - void setIsolation03(const IsolationVariables &dr03) { dr03_ = dr03; } - void setIsolation04(const IsolationVariables &dr04) { dr04_ = dr04; } - const IsolationVariables &isolationVariables03() const { return dr03_; } - const IsolationVariables &isolationVariables04() const { return dr04_; } - - // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest - void hcalToRun2EffDepth(); - - private: - // attributes - IsolationVariables dr03_; - IsolationVariables dr04_; - - //======================================================= - // Conversion Rejection Information - //======================================================= - - public: - struct ConversionRejection { - int flags; // -max:not-computed, other: as computed by Puneeth conversion code - TrackBaseRef partner; // conversion partner - float dist; // distance to the conversion partner - float dcot; // difference of cot(angle) with the conversion partner track - float radius; // signed conversion radius - float vtxFitProb; //fit probablity (chi2/ndof) of the matched conversion vtx - ConversionRejection() - : flags(-1), - dist(std::numeric_limits::max()), - dcot(std::numeric_limits::max()), - radius(std::numeric_limits::max()), - vtxFitProb(std::numeric_limits::max()) {} - }; - - // accessors - int convFlags() const { return conversionRejection_.flags; } - TrackBaseRef convPartner() const { return conversionRejection_.partner; } - float convDist() const { return conversionRejection_.dist; } - float convDcot() const { return conversionRejection_.dcot; } - float convRadius() const { return conversionRejection_.radius; } - float convVtxFitProb() const { return conversionRejection_.vtxFitProb; } - const ConversionRejection &conversionRejectionVariables() const { return conversionRejection_; } - void setConversionRejectionVariables(const ConversionRejection &convRej) { conversionRejection_ = convRej; } - - private: - // attributes - ConversionRejection conversionRejection_; - - //======================================================= - // Pflow Information - //======================================================= - - public: - struct PflowIsolationVariables { - //first three data members that changed names, according to DataFormats/MuonReco/interface/MuonPFIsolation.h - float sumChargedHadronPt; //!< sum-pt of charged Hadron // old float chargedHadronIso ; - float sumNeutralHadronEt; //!< sum pt of neutral hadrons // old float neutralHadronIso ; - float sumPhotonEt; //!< sum pt of PF photons // old float photonIso ; - //then four new data members, corresponding to DataFormats/MuonReco/interface/MuonPFIsolation.h - float sumChargedParticlePt; //!< sum-pt of charged Particles(inludes e/mu) - float sumNeutralHadronEtHighThreshold; //!< sum pt of neutral hadrons with a higher threshold - float sumPhotonEtHighThreshold; //!< sum pt of PF photons with a higher threshold - float sumPUPt; //!< sum pt of charged Particles not from PV (for Pu corrections) - //new pf cluster based isolation values - float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of electron - float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of electron - PflowIsolationVariables() - : sumChargedHadronPt(0), - sumNeutralHadronEt(0), - sumPhotonEt(0), - sumChargedParticlePt(0), - sumNeutralHadronEtHighThreshold(0), - sumPhotonEtHighThreshold(0), - sumPUPt(0), - sumEcalClusterEt(0), - sumHcalClusterEt(0) {} - }; - - struct MvaInput { - int earlyBrem; // Early Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) - int lateBrem; // Late Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) - float sigmaEtaEta; // Sigma-eta-eta with the PF cluster - float hadEnergy; // Associated PF Had Cluster energy - float deltaEta; // PF-cluster GSF track delta-eta - int nClusterOutsideMustache; // -2 => unknown, -1 =>could not be evaluated, 0 and more => number of clusters - float etOutsideMustache; - MvaInput() - : earlyBrem(-2), - lateBrem(-2), - sigmaEtaEta(std::numeric_limits::max()), - hadEnergy(0.), - deltaEta(std::numeric_limits::max()), - nClusterOutsideMustache(-2), - etOutsideMustache(-std::numeric_limits::max()) {} - }; - - static constexpr float mvaPlaceholder = -999999999.; - - struct MvaOutput { - int status; // see PFCandidateElectronExtra::StatusFlag - float mva_Isolated; - float mva_e_pi; - float mvaByPassForIsolated; // complementary MVA used in preselection - float dnn_e_sigIsolated; - float dnn_e_sigNonIsolated; - float dnn_e_bkgNonIsolated; - float dnn_e_bkgTau; - float dnn_e_bkgPhoton; - MvaOutput() - : status(-1), - mva_Isolated(mvaPlaceholder), - mva_e_pi(mvaPlaceholder), - mvaByPassForIsolated(mvaPlaceholder), - dnn_e_sigIsolated(mvaPlaceholder), - dnn_e_sigNonIsolated(mvaPlaceholder), - dnn_e_bkgNonIsolated(mvaPlaceholder), - dnn_e_bkgTau(mvaPlaceholder), - dnn_e_bkgPhoton(mvaPlaceholder) {} - }; - - // accessors - const PflowIsolationVariables &pfIsolationVariables() const { return pfIso_; } - //backwards compat functions for pat::Electron - float ecalPFClusterIso() const { return pfIso_.sumEcalClusterEt; }; - float hcalPFClusterIso() const { return pfIso_.sumHcalClusterEt; }; - - const MvaInput &mvaInput() const { return mvaInput_; } - const MvaOutput &mvaOutput() const { return mvaOutput_; } - - // setters - void setPfIsolationVariables(const PflowIsolationVariables &iso) { pfIso_ = iso; } - void setMvaInput(const MvaInput &mi) { mvaInput_ = mi; } - void setMvaOutput(const MvaOutput &mo) { mvaOutput_ = mo; } - - // for backward compatibility - float mva_Isolated() const { return mvaOutput_.mva_Isolated; } - float mva_e_pi() const { return mvaOutput_.mva_e_pi; } - float dnn_signal_Isolated() const { return mvaOutput_.dnn_e_sigIsolated; } - float dnn_signal_nonIsolated() const { return mvaOutput_.dnn_e_sigNonIsolated; } - float dnn_bkg_nonIsolated() const { return mvaOutput_.dnn_e_bkgNonIsolated; } - float dnn_bkg_Tau() const { return mvaOutput_.dnn_e_bkgTau; } - float dnn_bkg_Photon() const { return mvaOutput_.dnn_e_bkgPhoton; } - - private: - PflowIsolationVariables pfIso_; - MvaInput mvaInput_; - MvaOutput mvaOutput_; - - //======================================================= - // Preselection and Ambiguity - //======================================================= - - public: - // accessors - bool ecalDriven() const; // return true if ecalDrivenSeed() and passingCutBasedPreselection() - bool passingCutBasedPreselection() const { return passCutBasedPreselection_; } - bool passingPflowPreselection() const { return passPflowPreselection_; } - bool ambiguous() const { return ambiguous_; } - GsfTrackRefVector::size_type ambiguousGsfTracksSize() const { return ambiguousGsfTracks_.size(); } - auto const &ambiguousGsfTracks() const { return ambiguousGsfTracks_; } - - // setters - void setPassCutBasedPreselection(bool flag) { passCutBasedPreselection_ = flag; } - void setPassPflowPreselection(bool flag) { passPflowPreselection_ = flag; } - void setAmbiguous(bool flag) { ambiguous_ = flag; } - void clearAmbiguousGsfTracks() { ambiguousGsfTracks_.clear(); } - void addAmbiguousGsfTrack(const reco::GsfTrackRef &t) { ambiguousGsfTracks_.push_back(t); } - - // backward compatibility - void setPassMvaPreselection(bool flag) { passMvaPreslection_ = flag; } - bool passingMvaPreselection() const { return passMvaPreslection_; } - - private: - // attributes - bool passCutBasedPreselection_; - bool passPflowPreselection_; - bool passMvaPreslection_; // to be removed : passPflowPreslection_ - bool ambiguous_; - GsfTrackRefVector ambiguousGsfTracks_; // ambiguous gsf tracks - - //======================================================= - // Brem Fractions and Classification - //======================================================= - - public: - struct ClassificationVariables { - float trackFbrem; // the brem fraction from gsf fit: (track momentum in - track momentum out) / track momentum in - float superClusterFbrem; // the brem fraction from supercluster: (supercluster energy - electron cluster energy) / supercluster energy - constexpr static float kDefaultValue = -1.e30; - ClassificationVariables() : trackFbrem(kDefaultValue), superClusterFbrem(kDefaultValue) {} - }; - enum Classification { UNKNOWN = -1, GOLDEN = 0, BIGBREM = 1, BADTRACK = 2, SHOWERING = 3, GAP = 4 }; - - // accessors - float trackFbrem() const { return classVariables_.trackFbrem; } - float superClusterFbrem() const { return classVariables_.superClusterFbrem; } - const ClassificationVariables &classificationVariables() const { return classVariables_; } - Classification classification() const { return class_; } - - // utilities - int numberOfBrems() const { return basicClustersSize() - 1; } - float fbrem() const { return trackFbrem(); } - - // setters - void setTrackFbrem(float fbrem) { classVariables_.trackFbrem = fbrem; } - void setSuperClusterFbrem(float fbrem) { classVariables_.superClusterFbrem = fbrem; } - void setClassificationVariables(const ClassificationVariables &cv) { classVariables_ = cv; } - void setClassification(Classification myclass) { class_ = myclass; } - - private: - // attributes - ClassificationVariables classVariables_; - Classification class_; // fbrem and number of clusters based electron classification - - //======================================================= - // Corrections - // - // The only methods, with classification, which modify - // the electrons after they have been constructed. - // They change a given characteristic, such as the super-cluster - // energy, and propagate the change consistently - // to all the depending attributes. - // We expect the methods to be called in a given order - // and so to store specific kind of corrections - // 1) classify() - // 2) correctEcalEnergy() : depending on classification and eta - // 3) correctMomemtum() : depending on classification and ecal energy and tracker momentum errors - // - // Beware that correctEcalEnergy() is modifying few attributes which - // were potentially used for preselection, whose value used in - // preselection will not be available any more : - // hcalOverEcal, eSuperClusterOverP, - // eSeedClusterOverP, eEleClusterOverPout. - //======================================================= - - public: - enum P4Kind { P4_UNKNOWN = -1, P4_FROM_SUPER_CLUSTER = 0, P4_COMBINATION = 1, P4_PFLOW_COMBINATION = 2 }; - - struct Corrections { - bool isEcalEnergyCorrected; // true if ecal energy has been corrected - float correctedEcalEnergy; // corrected energy (if !isEcalEnergyCorrected this value is identical to the supercluster energy) - float correctedEcalEnergyError; // error on energy - //bool isMomentumCorrected ; // DEPRECATED - float trackMomentumError; // track momentum error from gsf fit + const TrackExtrapolations &trackExtrapolations() const { return trackExtrapolations_; } + + // setter (if you know what you're doing) + void setTrackExtrapolations(const TrackExtrapolations &te) { trackExtrapolations_ = te; } + + // for backward compatibility + math::XYZPointF TrackPositionAtVtx() const { return trackPositionAtVtx(); } + math::XYZPointF TrackPositionAtCalo() const { return trackPositionAtCalo(); } + + private: + // attributes + TrackExtrapolations trackExtrapolations_; + + //======================================================= + // SuperCluster direct access + //======================================================= + + public: + // direct accessors + math::XYZPoint superClusterPosition() const { return superCluster()->position(); } // the super cluster position + int basicClustersSize() const { + return superCluster()->clustersSize(); + } // number of basic clusters inside the supercluster + CaloCluster_iterator basicClustersBegin() const { return superCluster()->clustersBegin(); } + CaloCluster_iterator basicClustersEnd() const { return superCluster()->clustersEnd(); } + + // for backward compatibility + math::XYZPoint caloPosition() const { return superCluster()->position(); } + + //======================================================= + // Fiducial Flags + //======================================================= + + public: + struct FiducialFlags { + bool isEB; // true if particle is in ECAL Barrel + bool isEE; // true if particle is in ECAL Endcaps + bool isEBEEGap; // true if particle is in the crack between EB and EE + bool isEBEtaGap; // true if particle is in EB, and inside the eta gaps between modules + bool isEBPhiGap; // true if particle is in EB, and inside the phi gaps between modules + bool isEEDeeGap; // true if particle is in EE, and inside the gaps between dees + bool isEERingGap; // true if particle is in EE, and inside the gaps between rings + FiducialFlags() + : isEB(false), + isEE(false), + isEBEEGap(false), + isEBEtaGap(false), + isEBPhiGap(false), + isEEDeeGap(false), + isEERingGap(false) {} + }; + + // accessors + bool isEB() const { return fiducialFlags_.isEB; } + bool isEE() const { return fiducialFlags_.isEE; } + bool isGap() const { return ((isEBEEGap()) || (isEBGap()) || (isEEGap())); } + bool isEBEEGap() const { return fiducialFlags_.isEBEEGap; } + bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } + bool isEBEtaGap() const { return fiducialFlags_.isEBEtaGap; } + bool isEBPhiGap() const { return fiducialFlags_.isEBPhiGap; } + bool isEEGap() const { return (isEEDeeGap() || isEERingGap()); } + bool isEEDeeGap() const { return fiducialFlags_.isEEDeeGap; } + bool isEERingGap() const { return fiducialFlags_.isEERingGap; } + const FiducialFlags &fiducialFlags() const { return fiducialFlags_; } + // setters... not necessary in regular situations + // but handy for late stage modifications of electron objects + void setFFlagIsEB(const bool b) { fiducialFlags_.isEB = b; } + void setFFlagIsEE(const bool b) { fiducialFlags_.isEE = b; } + void setFFlagIsEBEEGap(const bool b) { fiducialFlags_.isEBEEGap = b; } + void setFFlagIsEBEtaGap(const bool b) { fiducialFlags_.isEBEtaGap = b; } + void setFFlagIsEBPhiGap(const bool b) { fiducialFlags_.isEBPhiGap = b; } + void setFFlagIsEEDeeGap(const bool b) { fiducialFlags_.isEEDeeGap = b; } + void setFFlagIsEERingGap(const bool b) { fiducialFlags_.isEERingGap = b; } + + private: + // attributes + FiducialFlags fiducialFlags_; + + //======================================================= + // Shower Shape Variables + //======================================================= + + public: + struct ShowerShape { + float sigmaEtaEta; // weighted cluster rms along eta and inside 5x5 (absolute eta) + float sigmaIetaIeta; // weighted cluster rms along eta and inside 5x5 (Xtal eta) + float sigmaIphiIphi; // weighted cluster rms along phi and inside 5x5 (Xtal phi) + float e1x5; // energy inside 1x5 in etaxphi around the seed Xtal + float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) + float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal + float r9; // ratio of the 3x3 energy and supercluster energy + float hcalDepth1OverEcal; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers within a cone) + float hcalDepth2OverEcal; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers within a cone) + float hcalDepth1OverEcalBc; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers behind clusters) + float hcalDepth2OverEcalBc; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers behind clusters) + std::array + hcalOverEcal; // run3 hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array + hcalOverEcalBc; // run3 hcal over ecal seed cluster energy per depth (using rechits behind clusters) + std::vector hcalTowersBehindClusters; + bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + float sigmaIetaIphi; + float eMax; + float e2nd; + float eTop; + float eLeft; + float eRight; + float eBottom; + float e2x5Top; + float e2x5Left; + float e2x5Right; + float e2x5Bottom; + ShowerShape() + : sigmaEtaEta(std::numeric_limits::max()), + sigmaIetaIeta(std::numeric_limits::max()), + sigmaIphiIphi(std::numeric_limits::max()), + e1x5(0.f), + e2x5Max(0.f), + e5x5(0.f), + r9(-std::numeric_limits::max()), + hcalDepth1OverEcal(0.f), + hcalDepth2OverEcal(0.f), + hcalDepth1OverEcalBc(0.f), + hcalDepth2OverEcalBc(0.f), + hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + invalidHcal(false), + pre7DepthHcal(true), + sigmaIetaIphi(0.f), + eMax(0.f), + e2nd(0.f), + eTop(0.f), + eLeft(0.f), + eRight(0.f), + eBottom(0.f), + e2x5Top(0.f), + e2x5Left(0.f), + e2x5Right(0.f), + e2x5Bottom(0.f) {} + }; + + // accessors + float sigmaEtaEta() const { return showerShape_.sigmaEtaEta; } + float sigmaIetaIeta() const { return showerShape_.sigmaIetaIeta; } + float sigmaIphiIphi() const { return showerShape_.sigmaIphiIphi; } + float e1x5() const { return showerShape_.e1x5; } + float e2x5Max() const { return showerShape_.e2x5Max; } + float e5x5() const { return showerShape_.e5x5; } + float r9() const { return showerShape_.r9; } + float hcalOverEcal(const ShowerShape &ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; + else if (depth == 1) + return ss.hcalDepth1OverEcal; + else if (depth == 2) + return ss.hcalDepth2OverEcal; + + return 0.f; + } else { + const auto &hovere = ss.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } + } + float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShape_, depth); } + float hcalOverEcalBc(const ShowerShape &ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; + else if (depth == 1) + return ss.hcalDepth1OverEcalBc; + else if (depth == 2) + return ss.hcalDepth2OverEcalBc; + + return 0.f; + } else { + const auto &hovere = ss.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } + } + float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShape_, depth); } + const std::vector &hcalTowersBehindClusters() const { + return showerShape_.hcalTowersBehindClusters; + } + bool hcalOverEcalValid() const { return !showerShape_.invalidHcal; } + float eLeft() const { return showerShape_.eLeft; } + float eRight() const { return showerShape_.eRight; } + float eTop() const { return showerShape_.eTop; } + float eBottom() const { return showerShape_.eBottom; } + const ShowerShape &showerShape() const { return showerShape_; } + // non-zero-suppressed and no-fractions shower shapes + // ecal energy is always that from the full 5x5 + float full5x5_sigmaEtaEta() const { return full5x5_showerShape_.sigmaEtaEta; } + float full5x5_sigmaIetaIeta() const { return full5x5_showerShape_.sigmaIetaIeta; } + float full5x5_sigmaIphiIphi() const { return full5x5_showerShape_.sigmaIphiIphi; } + float full5x5_e1x5() const { return full5x5_showerShape_.e1x5; } + float full5x5_e2x5Max() const { return full5x5_showerShape_.e2x5Max; } + float full5x5_e5x5() const { return full5x5_showerShape_.e5x5; } + float full5x5_r9() const { return full5x5_showerShape_.r9; } + float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShape_, depth); } + float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShape_, depth); } + bool full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } + float full5x5_e2x5Left() const { return full5x5_showerShape_.e2x5Left; } + float full5x5_e2x5Right() const { return full5x5_showerShape_.e2x5Right; } + float full5x5_e2x5Top() const { return full5x5_showerShape_.e2x5Top; } + float full5x5_e2x5Bottom() const { return full5x5_showerShape_.e2x5Bottom; } + float full5x5_eLeft() const { return full5x5_showerShape_.eLeft; } + float full5x5_eRight() const { return full5x5_showerShape_.eRight; } + float full5x5_eTop() const { return full5x5_showerShape_.eTop; } + float full5x5_eBottom() const { return full5x5_showerShape_.eBottom; } + const ShowerShape &full5x5_showerShape() const { return full5x5_showerShape_; } + + // setters (if you know what you're doing) + void setShowerShape(const ShowerShape &s) { showerShape_ = s; } + void full5x5_setShowerShape(const ShowerShape &s) { full5x5_showerShape_ = s; } + + // for backward compatibility (this will only ever be the ZS shapes!) + float scSigmaEtaEta() const { return sigmaEtaEta(); } + float scSigmaIEtaIEta() const { return sigmaIetaIeta(); } + float scE1x5() const { return e1x5(); } + float scE2x5Max() const { return e2x5Max(); } + float scE5x5() const { return e5x5(); } + float hadronicOverEm() const { return hcalOverEcal(); } + + private: + // attributes + ShowerShape showerShape_; + ShowerShape full5x5_showerShape_; + + //======================================================= + // SaturationInfo + //======================================================= + + public: + struct SaturationInfo { + int nSaturatedXtals; + bool isSeedSaturated; + SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} + }; + + // accessors + float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } + float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } + const SaturationInfo &saturationInfo() const { return saturationInfo_; } + void setSaturationInfo(const SaturationInfo &s) { saturationInfo_ = s; } + + private: + SaturationInfo saturationInfo_; + + //======================================================= + // Isolation Variables + //======================================================= + + public: + struct IsolationVariables { + float tkSumPt; // track iso with electron footprint removed + float tkSumPtHEEP; // track iso used for the HEEP ID + float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed + float hcalDepth1TowerSumEt; // hcal depth 1 iso deposit with electron footprint removed + float hcalDepth2TowerSumEt; // hcal depth 2 iso deposit with electron footprint removed + float hcalDepth1TowerSumEtBc; // hcal depth 1 iso deposit without towers behind clusters + float hcalDepth2TowerSumEtBc; // hcal depth 2 iso deposit without towers behind clusters + std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + IsolationVariables() + : tkSumPt(0.), + tkSumPtHEEP(0.), + ecalRecHitSumEt(0.), + hcalDepth1TowerSumEt(0.f), + hcalDepth2TowerSumEt(0.f), + hcalDepth1TowerSumEtBc(0.f), + hcalDepth2TowerSumEtBc(0.f), + hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + pre7DepthHcal(true) {} + }; + + // 03 accessors + float dr03TkSumPt() const { return dr03_.tkSumPt; } + float dr03TkSumPtHEEP() const { return dr03_.tkSumPtHEEP; } + float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt; } + float hcalTowerSumEt(const IsolationVariables &iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalDepth1TowerSumEt + iv.hcalDepth2TowerSumEt; + else if (depth == 1) + return iv.hcalDepth1TowerSumEt; + else if (depth == 2) + return iv.hcalDepth2TowerSumEt; + + return 0.f; + } else { + const auto &hcaliso = iv.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float dr03HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr03_, depth); } + float hcalTowerSumEtBc(const IsolationVariables &iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalDepth1TowerSumEtBc + iv.hcalDepth2TowerSumEtBc; + else if (depth == 1) + return iv.hcalDepth1TowerSumEtBc; + else if (depth == 2) + return iv.hcalDepth2TowerSumEtBc; + + return 0.f; + } else { + const auto &hcaliso = iv.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float dr03HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr03_, depth); } + const IsolationVariables &dr03IsolationVariables() const { return dr03_; } + + // 04 accessors + float dr04TkSumPt() const { return dr04_.tkSumPt; } + float dr04TkSumPtHEEP() const { return dr04_.tkSumPtHEEP; } + float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt; } + float dr04HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr04_, depth); } + float dr04HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr04_, depth); } + const IsolationVariables &dr04IsolationVariables() const { return dr04_; } + + // setters ?!? + void setDr03Isolation(const IsolationVariables &dr03) { dr03_ = dr03; } + void setDr04Isolation(const IsolationVariables &dr04) { dr04_ = dr04; } + + // for backward compatibility + void setIsolation03(const IsolationVariables &dr03) { dr03_ = dr03; } + void setIsolation04(const IsolationVariables &dr04) { dr04_ = dr04; } + const IsolationVariables &isolationVariables03() const { return dr03_; } + const IsolationVariables &isolationVariables04() const { return dr04_; } + + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + void hcalToRun2EffDepth(); + + private: + // attributes + IsolationVariables dr03_; + IsolationVariables dr04_; + + //======================================================= + // Conversion Rejection Information + //======================================================= + + public: + struct ConversionRejection { + int flags; // -max:not-computed, other: as computed by Puneeth conversion code + TrackBaseRef partner; // conversion partner + float dist; // distance to the conversion partner + float dcot; // difference of cot(angle) with the conversion partner track + float radius; // signed conversion radius + float vtxFitProb; //fit probablity (chi2/ndof) of the matched conversion vtx + ConversionRejection() + : flags(-1), + dist(std::numeric_limits::max()), + dcot(std::numeric_limits::max()), + radius(std::numeric_limits::max()), + vtxFitProb(std::numeric_limits::max()) {} + }; + + // accessors + int convFlags() const { return conversionRejection_.flags; } + TrackBaseRef convPartner() const { return conversionRejection_.partner; } + float convDist() const { return conversionRejection_.dist; } + float convDcot() const { return conversionRejection_.dcot; } + float convRadius() const { return conversionRejection_.radius; } + float convVtxFitProb() const { return conversionRejection_.vtxFitProb; } + const ConversionRejection &conversionRejectionVariables() const { return conversionRejection_; } + void setConversionRejectionVariables(const ConversionRejection &convRej) { conversionRejection_ = convRej; } + + private: + // attributes + ConversionRejection conversionRejection_; + + //======================================================= + // Pflow Information + //======================================================= + + public: + struct PflowIsolationVariables { + //first three data members that changed names, according to DataFormats/MuonReco/interface/MuonPFIsolation.h + float sumChargedHadronPt; //!< sum-pt of charged Hadron // old float chargedHadronIso ; + float sumNeutralHadronEt; //!< sum pt of neutral hadrons // old float neutralHadronIso ; + float sumPhotonEt; //!< sum pt of PF photons // old float photonIso ; + //then four new data members, corresponding to DataFormats/MuonReco/interface/MuonPFIsolation.h + float sumChargedParticlePt; //!< sum-pt of charged Particles(inludes e/mu) + float sumNeutralHadronEtHighThreshold; //!< sum pt of neutral hadrons with a higher threshold + float sumPhotonEtHighThreshold; //!< sum pt of PF photons with a higher threshold + float sumPUPt; //!< sum pt of charged Particles not from PV (for Pu corrections) + //new pf cluster based isolation values + float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of electron + float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of electron + PflowIsolationVariables() + : sumChargedHadronPt(0), + sumNeutralHadronEt(0), + sumPhotonEt(0), + sumChargedParticlePt(0), + sumNeutralHadronEtHighThreshold(0), + sumPhotonEtHighThreshold(0), + sumPUPt(0), + sumEcalClusterEt(0), + sumHcalClusterEt(0) {} + }; + + struct MvaInput { + int earlyBrem; // Early Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) + int lateBrem; // Late Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) + float sigmaEtaEta; // Sigma-eta-eta with the PF cluster + float hadEnergy; // Associated PF Had Cluster energy + float deltaEta; // PF-cluster GSF track delta-eta + int nClusterOutsideMustache; // -2 => unknown, -1 =>could not be evaluated, 0 and more => number of clusters + float etOutsideMustache; + MvaInput() + : earlyBrem(-2), + lateBrem(-2), + sigmaEtaEta(std::numeric_limits::max()), + hadEnergy(0.), + deltaEta(std::numeric_limits::max()), + nClusterOutsideMustache(-2), + etOutsideMustache(-std::numeric_limits::max()) {} + }; + + static constexpr float mvaPlaceholder = -999999999.; + + struct MvaOutput { + int status; // see PFCandidateElectronExtra::StatusFlag + float mva_Isolated; + float mva_e_pi; + float mvaByPassForIsolated; // complementary MVA used in preselection + float dnn_e_sigIsolated; + float dnn_e_sigNonIsolated; + float dnn_e_bkgNonIsolated; + float dnn_e_bkgTau; + float dnn_e_bkgPhoton; + MvaOutput() + : status(-1), + mva_Isolated(mvaPlaceholder), + mva_e_pi(mvaPlaceholder), + mvaByPassForIsolated(mvaPlaceholder), + dnn_e_sigIsolated(mvaPlaceholder), + dnn_e_sigNonIsolated(mvaPlaceholder), + dnn_e_bkgNonIsolated(mvaPlaceholder), + dnn_e_bkgTau(mvaPlaceholder), + dnn_e_bkgPhoton(mvaPlaceholder) {} + }; + + // accessors + const PflowIsolationVariables &pfIsolationVariables() const { return pfIso_; } + //backwards compat functions for pat::Electron + float ecalPFClusterIso() const { return pfIso_.sumEcalClusterEt; }; + float hcalPFClusterIso() const { return pfIso_.sumHcalClusterEt; }; + + const MvaInput &mvaInput() const { return mvaInput_; } + const MvaOutput &mvaOutput() const { return mvaOutput_; } + + // setters + void setPfIsolationVariables(const PflowIsolationVariables &iso) { pfIso_ = iso; } + void setMvaInput(const MvaInput &mi) { mvaInput_ = mi; } + void setMvaOutput(const MvaOutput &mo) { mvaOutput_ = mo; } + + // for backward compatibility + float mva_Isolated() const { return mvaOutput_.mva_Isolated; } + float mva_e_pi() const { return mvaOutput_.mva_e_pi; } + float dnn_signal_Isolated() const { return mvaOutput_.dnn_e_sigIsolated; } + float dnn_signal_nonIsolated() const { return mvaOutput_.dnn_e_sigNonIsolated; } + float dnn_bkg_nonIsolated() const { return mvaOutput_.dnn_e_bkgNonIsolated; } + float dnn_bkg_Tau() const { return mvaOutput_.dnn_e_bkgTau; } + float dnn_bkg_Photon() const { return mvaOutput_.dnn_e_bkgPhoton; } + + private: + PflowIsolationVariables pfIso_; + MvaInput mvaInput_; + MvaOutput mvaOutput_; + + //======================================================= + // Preselection and Ambiguity + //======================================================= + + public: + // accessors + bool ecalDriven() const; // return true if ecalDrivenSeed() and passingCutBasedPreselection() + bool passingCutBasedPreselection() const { return passCutBasedPreselection_; } + bool passingPflowPreselection() const { return passPflowPreselection_; } + bool ambiguous() const { return ambiguous_; } + GsfTrackRefVector::size_type ambiguousGsfTracksSize() const { return ambiguousGsfTracks_.size(); } + auto const &ambiguousGsfTracks() const { return ambiguousGsfTracks_; } + + // setters + void setPassCutBasedPreselection(bool flag) { passCutBasedPreselection_ = flag; } + void setPassPflowPreselection(bool flag) { passPflowPreselection_ = flag; } + void setAmbiguous(bool flag) { ambiguous_ = flag; } + void clearAmbiguousGsfTracks() { ambiguousGsfTracks_.clear(); } + void addAmbiguousGsfTrack(const reco::GsfTrackRef &t) { ambiguousGsfTracks_.push_back(t); } + + // backward compatibility + void setPassMvaPreselection(bool flag) { passMvaPreslection_ = flag; } + bool passingMvaPreselection() const { return passMvaPreslection_; } + + private: + // attributes + bool passCutBasedPreselection_; + bool passPflowPreselection_; + bool passMvaPreslection_; // to be removed : passPflowPreslection_ + bool ambiguous_; + GsfTrackRefVector ambiguousGsfTracks_; // ambiguous gsf tracks + + //======================================================= + // Brem Fractions and Classification + //======================================================= + + public: + struct ClassificationVariables { + float trackFbrem; // the brem fraction from gsf fit: (track momentum in - track momentum out) / track momentum in + float superClusterFbrem; // the brem fraction from supercluster: (supercluster energy - electron cluster energy) / supercluster energy + constexpr static float kDefaultValue = -1.e30; + ClassificationVariables() : trackFbrem(kDefaultValue), superClusterFbrem(kDefaultValue) {} + }; + enum Classification { UNKNOWN = -1, GOLDEN = 0, BIGBREM = 1, BADTRACK = 2, SHOWERING = 3, GAP = 4 }; + + // accessors + float trackFbrem() const { return classVariables_.trackFbrem; } + float superClusterFbrem() const { return classVariables_.superClusterFbrem; } + const ClassificationVariables &classificationVariables() const { return classVariables_; } + Classification classification() const { return class_; } + + // utilities + int numberOfBrems() const { return basicClustersSize() - 1; } + float fbrem() const { return trackFbrem(); } + + // setters + void setTrackFbrem(float fbrem) { classVariables_.trackFbrem = fbrem; } + void setSuperClusterFbrem(float fbrem) { classVariables_.superClusterFbrem = fbrem; } + void setClassificationVariables(const ClassificationVariables &cv) { classVariables_ = cv; } + void setClassification(Classification myclass) { class_ = myclass; } + + private: + // attributes + ClassificationVariables classVariables_; + Classification class_; // fbrem and number of clusters based electron classification + + //======================================================= + // Corrections // - LorentzVector fromSuperClusterP4; // for P4_FROM_SUPER_CLUSTER - float fromSuperClusterP4Error; // for P4_FROM_SUPER_CLUSTER - LorentzVector combinedP4; // for P4_COMBINATION - float combinedP4Error; // for P4_COMBINATION - LorentzVector pflowP4; // for P4_PFLOW_COMBINATION - float pflowP4Error; // for P4_PFLOW_COMBINATION - P4Kind candidateP4Kind; // say which momentum has been stored in reco::Candidate + // The only methods, with classification, which modify + // the electrons after they have been constructed. + // They change a given characteristic, such as the super-cluster + // energy, and propagate the change consistently + // to all the depending attributes. + // We expect the methods to be called in a given order + // and so to store specific kind of corrections + // 1) classify() + // 2) correctEcalEnergy() : depending on classification and eta + // 3) correctMomemtum() : depending on classification and ecal energy and tracker momentum errors // - Corrections() - : isEcalEnergyCorrected(false), - correctedEcalEnergy(0.), - correctedEcalEnergyError(999.), - /*isMomentumCorrected(false),*/ trackMomentumError(999.), - fromSuperClusterP4Error(999.), - combinedP4Error(999.), - pflowP4Error(999.), - candidateP4Kind(P4_UNKNOWN) {} - }; + // Beware that correctEcalEnergy() is modifying few attributes which + // were potentially used for preselection, whose value used in + // preselection will not be available any more : + // hcalOverEcal, eSuperClusterOverP, + // eSeedClusterOverP, eEleClusterOverPout. + //======================================================= + + public: + enum P4Kind { P4_UNKNOWN = -1, P4_FROM_SUPER_CLUSTER = 0, P4_COMBINATION = 1, P4_PFLOW_COMBINATION = 2 }; + + struct Corrections { + bool isEcalEnergyCorrected; // true if ecal energy has been corrected + float correctedEcalEnergy; // corrected energy (if !isEcalEnergyCorrected this value is identical to the supercluster energy) + float correctedEcalEnergyError; // error on energy + //bool isMomentumCorrected ; // DEPRECATED + float trackMomentumError; // track momentum error from gsf fit + // + LorentzVector fromSuperClusterP4; // for P4_FROM_SUPER_CLUSTER + float fromSuperClusterP4Error; // for P4_FROM_SUPER_CLUSTER + LorentzVector combinedP4; // for P4_COMBINATION + float combinedP4Error; // for P4_COMBINATION + LorentzVector pflowP4; // for P4_PFLOW_COMBINATION + float pflowP4Error; // for P4_PFLOW_COMBINATION + P4Kind candidateP4Kind; // say which momentum has been stored in reco::Candidate + // + Corrections() + : isEcalEnergyCorrected(false), + correctedEcalEnergy(0.), + correctedEcalEnergyError(999.), + /*isMomentumCorrected(false),*/ trackMomentumError(999.), + fromSuperClusterP4Error(999.), + combinedP4Error(999.), + pflowP4Error(999.), + candidateP4Kind(P4_UNKNOWN) {} + }; + + // setters + void setCorrectedEcalEnergyError(float newEnergyError); + void setCorrectedEcalEnergy(float newEnergy); + void setCorrectedEcalEnergy(float newEnergy, bool rescaleDependentValues); + void setTrackMomentumError(float trackMomentumError); + void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate); + using RecoCandidate::setP4; + + // accessors + bool isEcalEnergyCorrected() const { return corrections_.isEcalEnergyCorrected; } + float correctedEcalEnergy() const { return corrections_.correctedEcalEnergy; } + float correctedEcalEnergyError() const { return corrections_.correctedEcalEnergyError; } + float trackMomentumError() const { return corrections_.trackMomentumError; } + const LorentzVector &p4(P4Kind kind) const; + using RecoCandidate::p4; + float p4Error(P4Kind kind) const; + P4Kind candidateP4Kind() const { return corrections_.candidateP4Kind; } + const Corrections &corrections() const { return corrections_; } + + // bare setter (if you know what you're doing) + void setCorrections(const Corrections &c) { corrections_ = c; } + + // for backward compatibility + void setEcalEnergyError(float energyError) { setCorrectedEcalEnergyError(energyError); } + float ecalEnergy() const { return correctedEcalEnergy(); } + float ecalEnergyError() const { return correctedEcalEnergyError(); } + //bool isMomentumCorrected() const { return corrections_.isMomentumCorrected ; } + float caloEnergy() const { return correctedEcalEnergy(); } + bool isEnergyScaleCorrected() const { return isEcalEnergyCorrected(); } + void correctEcalEnergy(float newEnergy, float newEnergyError, bool corrEovP = true) { + setCorrectedEcalEnergy(newEnergy, corrEovP); + setEcalEnergyError(newEnergyError); + } + void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error) { + setTrackMomentumError(trackMomentumError); + setP4(P4_COMBINATION, p4, p4Error, true); + } - // setters - void setCorrectedEcalEnergyError(float newEnergyError); - void setCorrectedEcalEnergy(float newEnergy); - void setCorrectedEcalEnergy(float newEnergy, bool rescaleDependentValues); - void setTrackMomentumError(float trackMomentumError); - void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate); - using RecoCandidate::setP4; - - // accessors - bool isEcalEnergyCorrected() const { return corrections_.isEcalEnergyCorrected; } - float correctedEcalEnergy() const { return corrections_.correctedEcalEnergy; } - float correctedEcalEnergyError() const { return corrections_.correctedEcalEnergyError; } - float trackMomentumError() const { return corrections_.trackMomentumError; } - const LorentzVector &p4(P4Kind kind) const; - using RecoCandidate::p4; - float p4Error(P4Kind kind) const; - P4Kind candidateP4Kind() const { return corrections_.candidateP4Kind; } - const Corrections &corrections() const { return corrections_; } - - // bare setter (if you know what you're doing) - void setCorrections(const Corrections &c) { corrections_ = c; } - - // for backward compatibility - void setEcalEnergyError(float energyError) { setCorrectedEcalEnergyError(energyError); } - float ecalEnergy() const { return correctedEcalEnergy(); } - float ecalEnergyError() const { return correctedEcalEnergyError(); } - //bool isMomentumCorrected() const { return corrections_.isMomentumCorrected ; } - float caloEnergy() const { return correctedEcalEnergy(); } - bool isEnergyScaleCorrected() const { return isEcalEnergyCorrected(); } - void correctEcalEnergy(float newEnergy, float newEnergyError, bool corrEovP = true) { - setCorrectedEcalEnergy(newEnergy, corrEovP); - setEcalEnergyError(newEnergyError); - } - void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error) { - setTrackMomentumError(trackMomentumError); - setP4(P4_COMBINATION, p4, p4Error, true); - } - - private: - // attributes - Corrections corrections_; - - public: - struct PixelMatchVariables { - //! Pixel match variable: deltaPhi for innermost hit - float dPhi1; - //! Pixel match variable: deltaPhi for second hit - float dPhi2; - //! Pixel match variable: deltaRz for innermost hit - float dRz1; - //! Pixel match variable: deltaRz for second hit - float dRz2; - //! Subdetectors for first and second pixel hit - unsigned char subdetectors; - PixelMatchVariables() : dPhi1(-999), dPhi2(-999), dRz1(-999), dRz2(-999), subdetectors(0) {} - ~PixelMatchVariables() {} + private: + // attributes + Corrections corrections_; + + public: + struct PixelMatchVariables { + //! Pixel match variable: deltaPhi for innermost hit + float dPhi1; + //! Pixel match variable: deltaPhi for second hit + float dPhi2; + //! Pixel match variable: deltaRz for innermost hit + float dRz1; + //! Pixel match variable: deltaRz for second hit + float dRz2; + //! Subdetectors for first and second pixel hit + unsigned char subdetectors; + PixelMatchVariables() : dPhi1(-999), dPhi2(-999), dRz1(-999), dRz2(-999), subdetectors(0) {} + ~PixelMatchVariables() {} + }; + void setPixelMatchSubdetectors(int sd1, int sd2) { pixelMatchVariables_.subdetectors = 10 * sd1 + sd2; } + void setPixelMatchDPhi1(float dPhi1) { pixelMatchVariables_.dPhi1 = dPhi1; } + void setPixelMatchDPhi2(float dPhi2) { pixelMatchVariables_.dPhi2 = dPhi2; } + void setPixelMatchDRz1(float dRz1) { pixelMatchVariables_.dRz1 = dRz1; } + void setPixelMatchDRz2(float dRz2) { pixelMatchVariables_.dRz2 = dRz2; } + + int pixelMatchSubdetector1() const { return pixelMatchVariables_.subdetectors / 10; } + int pixelMatchSubdetector2() const { return pixelMatchVariables_.subdetectors % 10; } + float pixelMatchDPhi1() const { return pixelMatchVariables_.dPhi1; } + float pixelMatchDPhi2() const { return pixelMatchVariables_.dPhi2; } + float pixelMatchDRz1() const { return pixelMatchVariables_.dRz1; } + float pixelMatchDRz2() const { return pixelMatchVariables_.dRz2; } + + private: + PixelMatchVariables pixelMatchVariables_; }; - void setPixelMatchSubdetectors(int sd1, int sd2) { pixelMatchVariables_.subdetectors = 10 * sd1 + sd2; } - void setPixelMatchDPhi1(float dPhi1) { pixelMatchVariables_.dPhi1 = dPhi1; } - void setPixelMatchDPhi2(float dPhi2) { pixelMatchVariables_.dPhi2 = dPhi2; } - void setPixelMatchDRz1(float dRz1) { pixelMatchVariables_.dRz1 = dRz1; } - void setPixelMatchDRz2(float dRz2) { pixelMatchVariables_.dRz2 = dRz2; } - - int pixelMatchSubdetector1() const { return pixelMatchVariables_.subdetectors / 10; } - int pixelMatchSubdetector2() const { return pixelMatchVariables_.subdetectors % 10; } - float pixelMatchDPhi1() const { return pixelMatchVariables_.dPhi1; } - float pixelMatchDPhi2() const { return pixelMatchVariables_.dPhi2; } - float pixelMatchDRz1() const { return pixelMatchVariables_.dRz1; } - float pixelMatchDRz2() const { return pixelMatchVariables_.dRz2; } - - private: - PixelMatchVariables pixelMatchVariables_; - }; + + } // namespace io_v1 + using GsfElectron = io_v1::GsfElectron; } // namespace reco diff --git a/DataFormats/EgammaCandidates/interface/GsfElectronCore.h b/DataFormats/EgammaCandidates/interface/GsfElectronCore.h index 7589efd89f537..f86fe875c37f7 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectronCore.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectronCore.h @@ -21,71 +21,74 @@ ****************************************************************************/ namespace reco { + namespace io_v1 { - class GsfElectronCore { - public: - // construction - GsfElectronCore(); - GsfElectronCore(const GsfTrackRef&); - GsfElectronCore* clone() const; - ~GsfElectronCore() {} + class GsfElectronCore { + public: + // construction + GsfElectronCore(); + GsfElectronCore(const GsfTrackRef&); + GsfElectronCore* clone() const; + ~GsfElectronCore() {} - // accessors - const GsfTrackRef& gsfTrack() const { return gsfTrack_; } - const SuperClusterRef& superCluster() const { - return (superCluster_.isNull() ? parentSuperCluster_ : superCluster_); - } - TrackRef ctfTrack() const { - return closestCtfTrack_; - } // get the CTF track best matching the GTF associated to this electron - float ctfGsfOverlap() const { - return ctfGsfOverlap_; - } // measure the fraction of common hits between the GSF and CTF tracks - bool ecalDrivenSeed() const { return isEcalDrivenSeed_; } - bool trackerDrivenSeed() const { return isTrackerDrivenSeed_; } + // accessors + const GsfTrackRef& gsfTrack() const { return gsfTrack_; } + const SuperClusterRef& superCluster() const { + return (superCluster_.isNull() ? parentSuperCluster_ : superCluster_); + } + TrackRef ctfTrack() const { + return closestCtfTrack_; + } // get the CTF track best matching the GTF associated to this electron + float ctfGsfOverlap() const { + return ctfGsfOverlap_; + } // measure the fraction of common hits between the GSF and CTF tracks + bool ecalDrivenSeed() const { return isEcalDrivenSeed_; } + bool trackerDrivenSeed() const { return isTrackerDrivenSeed_; } - /// get vector of references to Conversion's - reco::ConversionRefVector conversions() const { return conversions_; } - /// get vector of references to one leg Conversion's - reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } + /// get vector of references to Conversion's + reco::ConversionRefVector conversions() const { return conversions_; } + /// get vector of references to one leg Conversion's + reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } - // setters - void setGsfTrack(const GsfTrackRef& gsfTrack) { gsfTrack_ = gsfTrack; } - void setSuperCluster(const SuperClusterRef& scl) { superCluster_ = scl; } - void setCtfTrack(const TrackRef& closestCtfTrack, float ctfGsfOverlap) { - closestCtfTrack_ = closestCtfTrack; - ctfGsfOverlap_ = ctfGsfOverlap; - } + // setters + void setGsfTrack(const GsfTrackRef& gsfTrack) { gsfTrack_ = gsfTrack; } + void setSuperCluster(const SuperClusterRef& scl) { superCluster_ = scl; } + void setCtfTrack(const TrackRef& closestCtfTrack, float ctfGsfOverlap) { + closestCtfTrack_ = closestCtfTrack; + ctfGsfOverlap_ = ctfGsfOverlap; + } - /// add single ConversionRef to the vector of Refs - void addConversion(const reco::ConversionRef& r) { conversions_.push_back(r); } - /// add single ConversionRef to the vector of Refs - void addOneLegConversion(const reco::ConversionRef& r) { conversionsOneLeg_.push_back(r); } + /// add single ConversionRef to the vector of Refs + void addConversion(const reco::ConversionRef& r) { conversions_.push_back(r); } + /// add single ConversionRef to the vector of Refs + void addOneLegConversion(const reco::ConversionRef& r) { conversionsOneLeg_.push_back(r); } - // pflow eventual additionnal info - const SuperClusterRef& parentSuperCluster() const { return parentSuperCluster_; } - void setParentSuperCluster(const SuperClusterRef& scl) { parentSuperCluster_ = scl; } + // pflow eventual additionnal info + const SuperClusterRef& parentSuperCluster() const { return parentSuperCluster_; } + void setParentSuperCluster(const SuperClusterRef& scl) { parentSuperCluster_ = scl; } - private: - GsfTrackRef gsfTrack_; - SuperClusterRef superCluster_; - SuperClusterRef parentSuperCluster_; - TrackRef closestCtfTrack_; // best matching ctf track - // vector of references to Conversions - reco::ConversionRefVector conversions_; - //vector of references for 1-leg - reco::ConversionRefVector conversionsOneLeg_; - float ctfGsfOverlap_; // fraction of common hits between the ctf and gsf tracks - bool isEcalDrivenSeed_; - bool isTrackerDrivenSeed_; - }; + private: + GsfTrackRef gsfTrack_; + SuperClusterRef superCluster_; + SuperClusterRef parentSuperCluster_; + TrackRef closestCtfTrack_; // best matching ctf track + // vector of references to Conversions + reco::ConversionRefVector conversions_; + //vector of references for 1-leg + reco::ConversionRefVector conversionsOneLeg_; + float ctfGsfOverlap_; // fraction of common hits between the ctf and gsf tracks + bool isEcalDrivenSeed_; + bool isTrackerDrivenSeed_; + }; + } // namespace io_v1 + using GsfElectronCore = io_v1::GsfElectronCore; } // namespace reco //***************************************************************************** // -// \author David Chamont - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3 -// \author Claude Charlot - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3 +// \author David Chamont - Laboratoire Leprince-Ringuet - �cole polytechnique, CNRS/IN2P3 +// \author Claude Charlot - Laboratoire Leprince-Ringuet - �cole polytechnique, CNRS/IN2P3 // // // Revision 1.11.2.1 2011/03/04 18:22:31 chamont diff --git a/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h b/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h index 5ceaaf1d0ed98..5591209471c46 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h @@ -9,7 +9,10 @@ namespace reco { - class GsfElectronCore; + namespace io_v1 { + class GsfElectronCore; + } + using GsfElectronCore = io_v1::GsfElectronCore; typedef std::vector GsfElectronCoreCollection; typedef edm::Ref GsfElectronCoreRef; typedef edm::RefProd GsfElectronCoreRefProd; diff --git a/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h b/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h index 18d72eac4a2e5..65df24902bde4 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h @@ -10,9 +10,10 @@ #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" namespace reco { - - class GsfElectron; - + namespace io_v1 { + class GsfElectron; + } + using GsfElectron = io_v1::GsfElectron; /// collection of GsfElectron objects typedef std::vector GsfElectronCollection; //typedef GsfElectronCollection PixelMatchGsfElectronCollection ; diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 7cddf80e5b98d..c1d18100036c9 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -18,602 +18,611 @@ #include namespace reco { + namespace io_v1 { + + class Photon : public RecoCandidate { + public: + /// Forward declaration of data structures included in the object + struct FiducialFlags; + struct IsolationVariables; + struct ShowerShape; + struct MIPVariables; + struct SaturationInfo; + + /// default constructor + Photon() : RecoCandidate() { + pixelSeed_ = false; + haloTaggerMVAVal_ = 99; + } - class Photon : public RecoCandidate { - public: - /// Forward declaration of data structures included in the object - struct FiducialFlags; - struct IsolationVariables; - struct ShowerShape; - struct MIPVariables; - struct SaturationInfo; - - /// default constructor - Photon() : RecoCandidate() { - pixelSeed_ = false; - haloTaggerMVAVal_ = 99; - } - - /// copy constructor - Photon(const Photon&); - - /// constructor from values - Photon(const LorentzVector& p4, const Point& caloPos, const PhotonCoreRef& core, const Point& vtx = Point(0, 0, 0)); - - /// assignment operator - Photon& operator=(const Photon&) = default; - - /// destructor - ~Photon() override; - - /// returns a clone of the candidate - Photon* clone() const override; - - /// returns a reference to the core photon object - reco::PhotonCoreRef photonCore() const { return photonCore_; } - void setPhotonCore(const reco::PhotonCoreRef& photonCore) { photonCore_ = photonCore; } - - // - /// Retrieve photonCore attributes - // - // retrieve provenance - bool isPFlowPhoton() const { return this->photonCore()->isPFlowPhoton(); } - bool isStandardPhoton() const { return this->photonCore()->isStandardPhoton(); } - /// Ref to SuperCluster - reco::SuperClusterRef superCluster() const override; - /// Ref to PFlow SuperCluster - reco::SuperClusterRef parentSuperCluster() const { return this->photonCore()->parentSuperCluster(); } - /// vector of references to Conversion's - reco::ConversionRefVector conversions() const { return this->photonCore()->conversions(); } - enum ConversionProvenance { egamma = 0, pflow = 1, both = 2 }; - - /// vector of references to one leg Conversion's - reco::ConversionRefVector conversionsOneLeg() const { return this->photonCore()->conversionsOneLeg(); } - /// Bool flagging photons with a vector of refereces to conversions with size >0 - bool hasConversionTracks() const { - if (!this->photonCore()->conversions().empty() || !this->photonCore()->conversionsOneLeg().empty()) - return true; - else - return false; - } - /// reference to electron Pixel seed - reco::ElectronSeedRefVector electronPixelSeeds() const { return this->photonCore()->electronPixelSeeds(); } - /// Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds - bool hasPixelSeed() const { - if (!(this->photonCore()->electronPixelSeeds()).empty()) - return true; - else - return false; - } - int conversionTrackProvenance(const edm::RefToBase& convTrack) const; - - /// position in ECAL: this is th SC position if r9<0.93. If r8>0.93 is position of seed BasicCluster taking shower depth for unconverted photon - math::XYZPointF caloPosition() const { return caloPosition_; } - /// set primary event vertex used to define photon direction - void setVertex(const Point& vertex) override; - /// Implement Candidate method for particle species - bool isPhoton() const override { return true; } - - //======================================================= - // Fiducial Flags - //======================================================= - struct FiducialFlags { - //Fiducial flags - bool isEB; //Photon is in EB - bool isEE; //Photon is in EE - bool isEBEtaGap; //Photon is in supermodule/supercrystal eta gap in EB - bool isEBPhiGap; //Photon is in supermodule/supercrystal phi gap in EB - bool isEERingGap; //Photon is in crystal ring gap in EE - bool isEEDeeGap; //Photon is in crystal dee gap in EE - bool isEBEEGap; //Photon is in border between EB and EE. - - FiducialFlags() - : isEB(false), - isEE(false), - isEBEtaGap(false), - isEBPhiGap(false), - isEERingGap(false), - isEEDeeGap(false), - isEBEEGap(false) - - {} - }; - - /// set flags for photons in the ECAL fiducial volume - void setFiducialVolumeFlags(const FiducialFlags& a) { fiducialFlagBlock_ = a; } - /// Ritrievs fiducial flags - /// true if photon is in ECAL barrel - bool isEB() const { return fiducialFlagBlock_.isEB; } - // true if photon is in ECAL endcap - bool isEE() const { return fiducialFlagBlock_.isEE; } - /// true if photon is in EB, and inside the boundaries in super crystals/modules - bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } - bool isEBEtaGap() const { return fiducialFlagBlock_.isEBEtaGap; } - bool isEBPhiGap() const { return fiducialFlagBlock_.isEBPhiGap; } - /// true if photon is in EE, and inside the boundaries in supercrystal/D - bool isEEGap() const { return (isEERingGap() || isEEDeeGap()); } - bool isEERingGap() const { return fiducialFlagBlock_.isEERingGap; } - bool isEEDeeGap() const { return fiducialFlagBlock_.isEEDeeGap; } - /// true if photon is in boundary between EB and EE - bool isEBEEGap() const { return fiducialFlagBlock_.isEBEEGap; } - - //======================================================= - // Shower Shape Variables - //======================================================= - - struct ShowerShape { - float sigmaEtaEta; - float sigmaIetaIeta; - float e1x5; - float e2x5; - float e3x3; - float e5x5; - float maxEnergyXtal; - float hcalDepth1OverEcal; // hcal over ecal energy using first hcal depth - float hcalDepth2OverEcal; // hcal over ecal energy using 2nd hcal depth - float hcalDepth1OverEcalBc; - float hcalDepth2OverEcalBc; - std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) - std::array - hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) - std::vector hcalTowersBehindClusters; - bool invalidHcal; - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - float effSigmaRR; - float sigmaIetaIphi; - float sigmaIphiIphi; - float e2nd; - float eTop; - float eLeft; - float eRight; - float eBottom; - float e1x3; - float e2x2; - float e2x5Max; - float e2x5Left; - float e2x5Right; - float e2x5Top; - float e2x5Bottom; - float smMajor; - float smMinor; - float smAlpha; - ShowerShape() - : sigmaEtaEta(std::numeric_limits::max()), - sigmaIetaIeta(std::numeric_limits::max()), - e1x5(0.f), - e2x5(0.f), - e3x3(0.f), - e5x5(0.f), - maxEnergyXtal(0.f), - hcalDepth1OverEcal(0.f), - hcalDepth2OverEcal(0.f), - hcalDepth1OverEcalBc(0.f), - hcalDepth2OverEcalBc(0.f), - hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - invalidHcal(false), - pre7DepthHcal(true), - effSigmaRR(std::numeric_limits::max()), - sigmaIetaIphi(std::numeric_limits::max()), - sigmaIphiIphi(std::numeric_limits::max()), - e2nd(0.f), - eTop(0.f), - eLeft(0.f), - eRight(0.f), - eBottom(0.f), - e1x3(0.f), - e2x2(0.f), - e2x5Max(0.f), - e2x5Left(0.f), - e2x5Right(0.f), - e2x5Top(0.f), - e2x5Bottom(0.f), - smMajor(0.f), - smMinor(0.f), - smAlpha(0.f) {} - }; - const ShowerShape& showerShapeVariables() const { return showerShapeBlock_; } - const ShowerShape& full5x5_showerShapeVariables() const { return full5x5_showerShapeBlock_; } - - void setShowerShapeVariables(const ShowerShape& a) { showerShapeBlock_ = a; } - void full5x5_setShowerShapeVariables(const ShowerShape& a) { full5x5_showerShapeBlock_ = a; } - - /// the total hadronic over electromagnetic fraction - float hcalOverEcal(const ShowerShape& ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; - else if (depth == 1) - return ss.hcalDepth1OverEcal; - else if (depth == 2) - return ss.hcalDepth2OverEcal; - - return 0.f; - } else { - const auto& hovere = ss.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + /// copy constructor + Photon(const Photon&); + + /// constructor from values + Photon(const LorentzVector& p4, + const Point& caloPos, + const PhotonCoreRef& core, + const Point& vtx = Point(0, 0, 0)); + + /// assignment operator + Photon& operator=(const Photon&) = default; + + /// destructor + ~Photon() override; + + /// returns a clone of the candidate + Photon* clone() const override; + + /// returns a reference to the core photon object + reco::PhotonCoreRef photonCore() const { return photonCore_; } + void setPhotonCore(const reco::PhotonCoreRef& photonCore) { photonCore_ = photonCore; } + + // + /// Retrieve photonCore attributes + // + // retrieve provenance + bool isPFlowPhoton() const { return this->photonCore()->isPFlowPhoton(); } + bool isStandardPhoton() const { return this->photonCore()->isStandardPhoton(); } + /// Ref to SuperCluster + reco::SuperClusterRef superCluster() const override; + /// Ref to PFlow SuperCluster + reco::SuperClusterRef parentSuperCluster() const { return this->photonCore()->parentSuperCluster(); } + /// vector of references to Conversion's + reco::ConversionRefVector conversions() const { return this->photonCore()->conversions(); } + enum ConversionProvenance { egamma = 0, pflow = 1, both = 2 }; + + /// vector of references to one leg Conversion's + reco::ConversionRefVector conversionsOneLeg() const { return this->photonCore()->conversionsOneLeg(); } + /// Bool flagging photons with a vector of refereces to conversions with size >0 + bool hasConversionTracks() const { + if (!this->photonCore()->conversions().empty() || !this->photonCore()->conversionsOneLeg().empty()) + return true; + else + return false; } - } - float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShapeBlock_, depth); } - float hadronicOverEm(int depth = 0) const { return hcalOverEcal(depth); } - - /// the ratio of total energy of hcal rechits behind the SC and the SC energy - float hcalOverEcalBc(const ShowerShape& ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; - else if (depth == 1) - return ss.hcalDepth1OverEcalBc; - else if (depth == 2) - return ss.hcalDepth2OverEcalBc; - - return 0.f; - } else { - const auto& hovere = ss.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + /// reference to electron Pixel seed + reco::ElectronSeedRefVector electronPixelSeeds() const { return this->photonCore()->electronPixelSeeds(); } + /// Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds + bool hasPixelSeed() const { + if (!(this->photonCore()->electronPixelSeeds()).empty()) + return true; + else + return false; } - } - float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShapeBlock_, depth); } - float hadTowOverEm(int depth = 0) const { return hcalOverEcalBc(depth); } - - const std::vector& hcalTowersBehindClusters() const { - return showerShapeBlock_.hcalTowersBehindClusters; - } - - /// returns false if H/E is not reliably estimated (e.g. because hcal was off or masked) - bool hadronicOverEmValid() const { return !showerShapeBlock_.invalidHcal; } - bool hadTowOverEmValid() const { return !showerShapeBlock_.invalidHcal; } - - /// Shower shape variables - float e1x5() const { return showerShapeBlock_.e1x5; } - float e2x5() const { return showerShapeBlock_.e2x5; } - float e3x3() const { return showerShapeBlock_.e3x3; } - float e5x5() const { return showerShapeBlock_.e5x5; } - float maxEnergyXtal() const { return showerShapeBlock_.maxEnergyXtal; } - float sigmaEtaEta() const { return showerShapeBlock_.sigmaEtaEta; } - float sigmaIetaIeta() const { return showerShapeBlock_.sigmaIetaIeta; } - float r1x5() const { return showerShapeBlock_.e1x5 / showerShapeBlock_.e5x5; } - float r2x5() const { return showerShapeBlock_.e2x5 / showerShapeBlock_.e5x5; } - float r9() const { return showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } - - ///full5x5 Shower shape variables - float full5x5_e1x5() const { return full5x5_showerShapeBlock_.e1x5; } - float full5x5_e2x5() const { return full5x5_showerShapeBlock_.e2x5; } - float full5x5_e3x3() const { return full5x5_showerShapeBlock_.e3x3; } - float full5x5_e5x5() const { return full5x5_showerShapeBlock_.e5x5; } - float full5x5_maxEnergyXtal() const { return full5x5_showerShapeBlock_.maxEnergyXtal; } - float full5x5_sigmaEtaEta() const { return full5x5_showerShapeBlock_.sigmaEtaEta; } - float full5x5_sigmaIetaIeta() const { return full5x5_showerShapeBlock_.sigmaIetaIeta; } - float full5x5_r1x5() const { return full5x5_showerShapeBlock_.e1x5 / full5x5_showerShapeBlock_.e5x5; } - float full5x5_r2x5() const { return full5x5_showerShapeBlock_.e2x5 / full5x5_showerShapeBlock_.e5x5; } - float full5x5_r9() const { return full5x5_showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } - - /// the total hadronic over electromagnetic fraction - float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShapeBlock_, depth); } - float full5x5_hadronicOverEm(int depth = 0) const { return full5x5_hcalOverEcal(depth); } - - /// the ratio of total energy of hcal rechits behind the SC and the SC energy - float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShapeBlock_, depth); } - float full5x5_hadTowOverEm(int depth = 0) const { return full5x5_hcalOverEcalBc(depth); } - - //======================================================= - // SaturationInfo - //======================================================= - - struct SaturationInfo { - int nSaturatedXtals; - bool isSeedSaturated; - SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} - }; - - // accessors - float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } - float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } - const SaturationInfo& saturationInfo() const { return saturationInfo_; } - void setSaturationInfo(const SaturationInfo& s) { saturationInfo_ = s; } - - //======================================================= - // Energy Determinations - //======================================================= - enum P4type { undefined = -1, ecal_standard = 0, ecal_photons = 1, regression1 = 2, regression2 = 3 }; - - struct EnergyCorrections { - float scEcalEnergy; - float scEcalEnergyError; - LorentzVector scEcalP4; - float phoEcalEnergy; - float phoEcalEnergyError; - LorentzVector phoEcalP4; - float regression1Energy; - float regression1EnergyError; - LorentzVector regression1P4; - float regression2Energy; - float regression2EnergyError; - LorentzVector regression2P4; - P4type candidateP4type; - EnergyCorrections() - : scEcalEnergy(0.), - scEcalEnergyError(999.), - scEcalP4(0., 0., 0., 0.), - phoEcalEnergy(0.), - phoEcalEnergyError(999.), - phoEcalP4(0., 0., 0., 0.), - regression1Energy(0.), - regression1EnergyError(999.), - regression1P4(0., 0., 0., 0.), - regression2Energy(0.), - regression2EnergyError(999.), - regression2P4(0., 0., 0., 0.), - candidateP4type(undefined) {} - }; - - using RecoCandidate::p4; - using RecoCandidate::setP4; - - //sets both energy and its uncertainty - void setCorrectedEnergy(P4type type, float E, float dE, bool toCand = true); - void setP4(P4type type, const LorentzVector& p4, float p4Error, bool setToRecoCandidate); - void setEnergyCorrections(const EnergyCorrections& e) { eCorrections_ = e; } - void setCandidateP4type(const P4type type) { eCorrections_.candidateP4type = type; } - - float getCorrectedEnergy(P4type type) const; - float getCorrectedEnergyError(P4type type) const; - P4type getCandidateP4type() const { return eCorrections_.candidateP4type; } - const LorentzVector& p4(P4type type) const; - const EnergyCorrections& energyCorrections() const { return eCorrections_; } - - //======================================================= - // MIP Variables - //======================================================= - - struct MIPVariables { - float mipChi2; - float mipTotEnergy; - float mipSlope; - float mipIntercept; - int mipNhitCone; - bool mipIsHalo; - - MIPVariables() - : - - mipChi2(0), - mipTotEnergy(0), - mipSlope(0), - mipIntercept(0), - mipNhitCone(0), - mipIsHalo(false) {} - }; - - /// MIP variables - float mipChi2() const { return mipVariableBlock_.mipChi2; } - float mipTotEnergy() const { return mipVariableBlock_.mipTotEnergy; } - float mipSlope() const { return mipVariableBlock_.mipSlope; } - float mipIntercept() const { return mipVariableBlock_.mipIntercept; } - int mipNhitCone() const { return mipVariableBlock_.mipNhitCone; } - bool mipIsHalo() const { return mipVariableBlock_.mipIsHalo; } - - ///set mip Variables - void setMIPVariables(const MIPVariables& mipVar) { mipVariableBlock_ = mipVar; } - - //======================================================= - // Isolation Variables - //======================================================= - - struct IsolationVariables { - //These are analysis quantities calculated in the PhotonIDAlgo class - - //EcalRecHit isolation - float ecalRecHitSumEt; - //HcalTower isolation - float hcalTowerSumEt; - //HcalDepth1Tower isolation - float hcalDepth1TowerSumEt; - //HcalDepth2Tower isolation - float hcalDepth2TowerSumEt; - //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalTowerSumEtBc; - //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth1TowerSumEtBc; - //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth2TowerSumEtBc; - std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed - std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - //Sum of track pT in a cone of dR - float trkSumPtSolidCone; - //Sum of track pT in a hollow cone of outer radius, inner radius - float trkSumPtHollowCone; - //Number of tracks in a cone of dR - int nTrkSolidCone; - //Number of tracks in a hollow cone of outer radius, inner radius - int nTrkHollowCone; - IsolationVariables() - : - - ecalRecHitSumEt(0.f), - hcalTowerSumEt(0.f), - hcalDepth1TowerSumEt(0.f), - hcalDepth2TowerSumEt(0.f), - hcalTowerSumEtBc(0.f), - hcalDepth1TowerSumEtBc(0.f), - hcalDepth2TowerSumEtBc(0.f), - hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - pre7DepthHcal(true), - trkSumPtSolidCone(0.f), - trkSumPtHollowCone(0.f), - nTrkSolidCone(0), - nTrkHollowCone(0) {} - }; - - /// set relevant isolation variables - void setIsolationVariables(const IsolationVariables& isolInDr04, const IsolationVariables& isolInDr03) { - isolationR04_ = isolInDr04; - isolationR03_ = isolInDr03; - } - - /// Egamma Isolation variables in cone dR=0.4 - ///Ecal isolation sum calculated from recHits - float ecalRecHitSumEtConeDR04() const { return isolationR04_.ecalRecHitSumEt; } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() - float hcalTowerSumEt(const IsolationVariables& iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalTowerSumEt; - else if (depth == 1) - return iv.hcalDepth1TowerSumEt; - else if (depth == 2) - return iv.hcalDepth2TowerSumEt; - - return 0.f; - } else { - const auto& hcaliso = iv.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + int conversionTrackProvenance(const edm::RefToBase& convTrack) const; + + /// position in ECAL: this is th SC position if r9<0.93. If r8>0.93 is position of seed BasicCluster taking shower depth for unconverted photon + math::XYZPointF caloPosition() const { return caloPosition_; } + /// set primary event vertex used to define photon direction + void setVertex(const Point& vertex) override; + /// Implement Candidate method for particle species + bool isPhoton() const override { return true; } + + //======================================================= + // Fiducial Flags + //======================================================= + struct FiducialFlags { + //Fiducial flags + bool isEB; //Photon is in EB + bool isEE; //Photon is in EE + bool isEBEtaGap; //Photon is in supermodule/supercrystal eta gap in EB + bool isEBPhiGap; //Photon is in supermodule/supercrystal phi gap in EB + bool isEERingGap; //Photon is in crystal ring gap in EE + bool isEEDeeGap; //Photon is in crystal dee gap in EE + bool isEBEEGap; //Photon is in border between EB and EE. + + FiducialFlags() + : isEB(false), + isEE(false), + isEBEtaGap(false), + isEBPhiGap(false), + isEERingGap(false), + isEEDeeGap(false), + isEBEEGap(false) + + {} + }; + + /// set flags for photons in the ECAL fiducial volume + void setFiducialVolumeFlags(const FiducialFlags& a) { fiducialFlagBlock_ = a; } + /// Ritrievs fiducial flags + /// true if photon is in ECAL barrel + bool isEB() const { return fiducialFlagBlock_.isEB; } + // true if photon is in ECAL endcap + bool isEE() const { return fiducialFlagBlock_.isEE; } + /// true if photon is in EB, and inside the boundaries in super crystals/modules + bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } + bool isEBEtaGap() const { return fiducialFlagBlock_.isEBEtaGap; } + bool isEBPhiGap() const { return fiducialFlagBlock_.isEBPhiGap; } + /// true if photon is in EE, and inside the boundaries in supercrystal/D + bool isEEGap() const { return (isEERingGap() || isEEDeeGap()); } + bool isEERingGap() const { return fiducialFlagBlock_.isEERingGap; } + bool isEEDeeGap() const { return fiducialFlagBlock_.isEEDeeGap; } + /// true if photon is in boundary between EB and EE + bool isEBEEGap() const { return fiducialFlagBlock_.isEBEEGap; } + + //======================================================= + // Shower Shape Variables + //======================================================= + + struct ShowerShape { + float sigmaEtaEta; + float sigmaIetaIeta; + float e1x5; + float e2x5; + float e3x3; + float e5x5; + float maxEnergyXtal; + float hcalDepth1OverEcal; // hcal over ecal energy using first hcal depth + float hcalDepth2OverEcal; // hcal over ecal energy using 2nd hcal depth + float hcalDepth1OverEcalBc; + float hcalDepth2OverEcalBc; + std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array + hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) + std::vector hcalTowersBehindClusters; + bool invalidHcal; + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + float effSigmaRR; + float sigmaIetaIphi; + float sigmaIphiIphi; + float e2nd; + float eTop; + float eLeft; + float eRight; + float eBottom; + float e1x3; + float e2x2; + float e2x5Max; + float e2x5Left; + float e2x5Right; + float e2x5Top; + float e2x5Bottom; + float smMajor; + float smMinor; + float smAlpha; + ShowerShape() + : sigmaEtaEta(std::numeric_limits::max()), + sigmaIetaIeta(std::numeric_limits::max()), + e1x5(0.f), + e2x5(0.f), + e3x3(0.f), + e5x5(0.f), + maxEnergyXtal(0.f), + hcalDepth1OverEcal(0.f), + hcalDepth2OverEcal(0.f), + hcalDepth1OverEcalBc(0.f), + hcalDepth2OverEcalBc(0.f), + hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + invalidHcal(false), + pre7DepthHcal(true), + effSigmaRR(std::numeric_limits::max()), + sigmaIetaIphi(std::numeric_limits::max()), + sigmaIphiIphi(std::numeric_limits::max()), + e2nd(0.f), + eTop(0.f), + eLeft(0.f), + eRight(0.f), + eBottom(0.f), + e1x3(0.f), + e2x2(0.f), + e2x5Max(0.f), + e2x5Left(0.f), + e2x5Right(0.f), + e2x5Top(0.f), + e2x5Bottom(0.f), + smMajor(0.f), + smMinor(0.f), + smAlpha(0.f) {} + }; + const ShowerShape& showerShapeVariables() const { return showerShapeBlock_; } + const ShowerShape& full5x5_showerShapeVariables() const { return full5x5_showerShapeBlock_; } + + void setShowerShapeVariables(const ShowerShape& a) { showerShapeBlock_ = a; } + void full5x5_setShowerShapeVariables(const ShowerShape& a) { full5x5_showerShapeBlock_ = a; } + + /// the total hadronic over electromagnetic fraction + float hcalOverEcal(const ShowerShape& ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; + else if (depth == 1) + return ss.hcalDepth1OverEcal; + else if (depth == 2) + return ss.hcalDepth2OverEcal; + + return 0.f; + } else { + const auto& hovere = ss.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } - } - float hcalTowerSumEtConeDR04(int depth = 0) const { return hcalTowerSumEt(isolationR04_, depth); } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() - float hcalTowerSumEtBc(const IsolationVariables& iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalTowerSumEtBc; - else if (depth == 1) - return iv.hcalDepth1TowerSumEtBc; - else if (depth == 2) - return iv.hcalDepth2TowerSumEtBc; - - return 0.f; - } else { - const auto& hcaliso = iv.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShapeBlock_, depth); } + float hadronicOverEm(int depth = 0) const { return hcalOverEcal(depth); } + + /// the ratio of total energy of hcal rechits behind the SC and the SC energy + float hcalOverEcalBc(const ShowerShape& ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; + else if (depth == 1) + return ss.hcalDepth1OverEcalBc; + else if (depth == 2) + return ss.hcalDepth2OverEcalBc; + + return 0.f; + } else { + const auto& hovere = ss.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } - } - float hcalTowerSumEtBcConeDR04(int depth = 0) const { return hcalTowerSumEtBc(isolationR04_, depth); } - // Track pT sum - float trkSumPtSolidConeDR04() const { return isolationR04_.trkSumPtSolidCone; } - //As above, excluding the core at the center of the cone - float trkSumPtHollowConeDR04() const { return isolationR04_.trkSumPtHollowCone; } - //Returns number of tracks in a cone of dR - int nTrkSolidConeDR04() const { return isolationR04_.nTrkSolidCone; } - //As above, excluding the core at the center of the cone - int nTrkHollowConeDR04() const { return isolationR04_.nTrkHollowCone; } - // - /// Isolation variables in cone dR=0.3 - float ecalRecHitSumEtConeDR03() const { return isolationR03_.ecalRecHitSumEt; } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() - float hcalTowerSumEtConeDR03(int depth = 0) const { return hcalTowerSumEt(isolationR03_, depth); } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() - float hcalTowerSumEtBcConeDR03(int depth = 0) const { return hcalTowerSumEtBc(isolationR03_, depth); } - // Track pT sum c - float trkSumPtSolidConeDR03() const { return isolationR03_.trkSumPtSolidCone; } - //As above, excluding the core at the center of the cone - float trkSumPtHollowConeDR03() const { return isolationR03_.trkSumPtHollowCone; } - //Returns number of tracks in a cone of dR - int nTrkSolidConeDR03() const { return isolationR03_.nTrkSolidCone; } - //As above, excluding the core at the center of the cone - int nTrkHollowConeDR03() const { return isolationR03_.nTrkHollowCone; } - - //======================================================= - // PFlow based Isolation Variables - //======================================================= - - struct PflowIsolationVariables { - float chargedHadronIso; //charged hadron isolation with dxy,dz match to pv - float chargedHadronWorstVtxIso; //max charged hadron isolation when dxy/dz matching to given vtx - float chargedHadronWorstVtxGeomVetoIso; //as chargedHadronWorstVtxIso but an additional geometry based veto cone - float chargedHadronPFPVIso; //only considers particles assigned to the primary vertex (PV) by particle flow, corresponds to <10_6 chargedHadronIso - float neutralHadronIso; - float photonIso; - float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of photon - float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of photon - PflowIsolationVariables() - : - - chargedHadronIso(0.), - chargedHadronWorstVtxIso(0.), - chargedHadronWorstVtxGeomVetoIso(0.), - chargedHadronPFPVIso(0.), - neutralHadronIso(0.), - photonIso(0.), - sumEcalClusterEt(0.), - sumHcalClusterEt(0.) {} - }; - - /// Accessors for Particle Flow Isolation variables - float chargedHadronIso() const { return pfIsolation_.chargedHadronIso; } - float chargedHadronWorstVtxIso() const { return pfIsolation_.chargedHadronWorstVtxIso; } - float chargedHadronWorstVtxGeomVetoIso() const { return pfIsolation_.chargedHadronWorstVtxGeomVetoIso; } - float chargedHadronPFPVIso() const { return pfIsolation_.chargedHadronPFPVIso; } - float neutralHadronIso() const { return pfIsolation_.neutralHadronIso; } - float photonIso() const { return pfIsolation_.photonIso; } - - //backwards compat functions for pat::Photon - float ecalPFClusterIso() const { return pfIsolation_.sumEcalClusterEt; }; - float hcalPFClusterIso() const { return pfIsolation_.sumHcalClusterEt; }; - - /// Get Particle Flow Isolation variables block - const PflowIsolationVariables& getPflowIsolationVariables() const { return pfIsolation_; } - - /// Set Particle Flow Isolation variables - void setPflowIsolationVariables(const PflowIsolationVariables& pfisol) { pfIsolation_ = pfisol; } + float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShapeBlock_, depth); } + float hadTowOverEm(int depth = 0) const { return hcalOverEcalBc(depth); } - static constexpr float mvaPlaceholder = -999999999.; + const std::vector& hcalTowersBehindClusters() const { + return showerShapeBlock_.hcalTowersBehindClusters; + } - struct PflowIDVariables { - int nClusterOutsideMustache; - float etOutsideMustache; - float mva; - float dnn; + /// returns false if H/E is not reliably estimated (e.g. because hcal was off or masked) + bool hadronicOverEmValid() const { return !showerShapeBlock_.invalidHcal; } + bool hadTowOverEmValid() const { return !showerShapeBlock_.invalidHcal; } + + /// Shower shape variables + float e1x5() const { return showerShapeBlock_.e1x5; } + float e2x5() const { return showerShapeBlock_.e2x5; } + float e3x3() const { return showerShapeBlock_.e3x3; } + float e5x5() const { return showerShapeBlock_.e5x5; } + float maxEnergyXtal() const { return showerShapeBlock_.maxEnergyXtal; } + float sigmaEtaEta() const { return showerShapeBlock_.sigmaEtaEta; } + float sigmaIetaIeta() const { return showerShapeBlock_.sigmaIetaIeta; } + float r1x5() const { return showerShapeBlock_.e1x5 / showerShapeBlock_.e5x5; } + float r2x5() const { return showerShapeBlock_.e2x5 / showerShapeBlock_.e5x5; } + float r9() const { return showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } + + ///full5x5 Shower shape variables + float full5x5_e1x5() const { return full5x5_showerShapeBlock_.e1x5; } + float full5x5_e2x5() const { return full5x5_showerShapeBlock_.e2x5; } + float full5x5_e3x3() const { return full5x5_showerShapeBlock_.e3x3; } + float full5x5_e5x5() const { return full5x5_showerShapeBlock_.e5x5; } + float full5x5_maxEnergyXtal() const { return full5x5_showerShapeBlock_.maxEnergyXtal; } + float full5x5_sigmaEtaEta() const { return full5x5_showerShapeBlock_.sigmaEtaEta; } + float full5x5_sigmaIetaIeta() const { return full5x5_showerShapeBlock_.sigmaIetaIeta; } + float full5x5_r1x5() const { return full5x5_showerShapeBlock_.e1x5 / full5x5_showerShapeBlock_.e5x5; } + float full5x5_r2x5() const { return full5x5_showerShapeBlock_.e2x5 / full5x5_showerShapeBlock_.e5x5; } + float full5x5_r9() const { return full5x5_showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } + + /// the total hadronic over electromagnetic fraction + float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShapeBlock_, depth); } + float full5x5_hadronicOverEm(int depth = 0) const { return full5x5_hcalOverEcal(depth); } + + /// the ratio of total energy of hcal rechits behind the SC and the SC energy + float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShapeBlock_, depth); } + float full5x5_hadTowOverEm(int depth = 0) const { return full5x5_hcalOverEcalBc(depth); } + + //======================================================= + // SaturationInfo + //======================================================= + + struct SaturationInfo { + int nSaturatedXtals; + bool isSeedSaturated; + SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} + }; + + // accessors + float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } + float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } + const SaturationInfo& saturationInfo() const { return saturationInfo_; } + void setSaturationInfo(const SaturationInfo& s) { saturationInfo_ = s; } + + //======================================================= + // Energy Determinations + //======================================================= + enum P4type { undefined = -1, ecal_standard = 0, ecal_photons = 1, regression1 = 2, regression2 = 3 }; + + struct EnergyCorrections { + float scEcalEnergy; + float scEcalEnergyError; + LorentzVector scEcalP4; + float phoEcalEnergy; + float phoEcalEnergyError; + LorentzVector phoEcalP4; + float regression1Energy; + float regression1EnergyError; + LorentzVector regression1P4; + float regression2Energy; + float regression2EnergyError; + LorentzVector regression2P4; + P4type candidateP4type; + EnergyCorrections() + : scEcalEnergy(0.), + scEcalEnergyError(999.), + scEcalP4(0., 0., 0., 0.), + phoEcalEnergy(0.), + phoEcalEnergyError(999.), + phoEcalP4(0., 0., 0., 0.), + regression1Energy(0.), + regression1EnergyError(999.), + regression1P4(0., 0., 0., 0.), + regression2Energy(0.), + regression2EnergyError(999.), + regression2P4(0., 0., 0., 0.), + candidateP4type(undefined) {} + }; + + using RecoCandidate::p4; + using RecoCandidate::setP4; + + //sets both energy and its uncertainty + void setCorrectedEnergy(P4type type, float E, float dE, bool toCand = true); + void setP4(P4type type, const LorentzVector& p4, float p4Error, bool setToRecoCandidate); + void setEnergyCorrections(const EnergyCorrections& e) { eCorrections_ = e; } + void setCandidateP4type(const P4type type) { eCorrections_.candidateP4type = type; } + + float getCorrectedEnergy(P4type type) const; + float getCorrectedEnergyError(P4type type) const; + P4type getCandidateP4type() const { return eCorrections_.candidateP4type; } + const LorentzVector& p4(P4type type) const; + const EnergyCorrections& energyCorrections() const { return eCorrections_; } + + //======================================================= + // MIP Variables + //======================================================= + + struct MIPVariables { + float mipChi2; + float mipTotEnergy; + float mipSlope; + float mipIntercept; + int mipNhitCone; + bool mipIsHalo; + + MIPVariables() + : + + mipChi2(0), + mipTotEnergy(0), + mipSlope(0), + mipIntercept(0), + mipNhitCone(0), + mipIsHalo(false) {} + }; + + /// MIP variables + float mipChi2() const { return mipVariableBlock_.mipChi2; } + float mipTotEnergy() const { return mipVariableBlock_.mipTotEnergy; } + float mipSlope() const { return mipVariableBlock_.mipSlope; } + float mipIntercept() const { return mipVariableBlock_.mipIntercept; } + int mipNhitCone() const { return mipVariableBlock_.mipNhitCone; } + bool mipIsHalo() const { return mipVariableBlock_.mipIsHalo; } + + ///set mip Variables + void setMIPVariables(const MIPVariables& mipVar) { mipVariableBlock_ = mipVar; } + + //======================================================= + // Isolation Variables + //======================================================= + + struct IsolationVariables { + //These are analysis quantities calculated in the PhotonIDAlgo class + + //EcalRecHit isolation + float ecalRecHitSumEt; + //HcalTower isolation + float hcalTowerSumEt; + //HcalDepth1Tower isolation + float hcalDepth1TowerSumEt; + //HcalDepth2Tower isolation + float hcalDepth2TowerSumEt; + //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalTowerSumEtBc; + //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalDepth1TowerSumEtBc; + //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalDepth2TowerSumEtBc; + std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + //Sum of track pT in a cone of dR + float trkSumPtSolidCone; + //Sum of track pT in a hollow cone of outer radius, inner radius + float trkSumPtHollowCone; + //Number of tracks in a cone of dR + int nTrkSolidCone; + //Number of tracks in a hollow cone of outer radius, inner radius + int nTrkHollowCone; + IsolationVariables() + : + + ecalRecHitSumEt(0.f), + hcalTowerSumEt(0.f), + hcalDepth1TowerSumEt(0.f), + hcalDepth2TowerSumEt(0.f), + hcalTowerSumEtBc(0.f), + hcalDepth1TowerSumEtBc(0.f), + hcalDepth2TowerSumEtBc(0.f), + hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + pre7DepthHcal(true), + trkSumPtSolidCone(0.f), + trkSumPtHollowCone(0.f), + nTrkSolidCone(0), + nTrkHollowCone(0) {} + }; + + /// set relevant isolation variables + void setIsolationVariables(const IsolationVariables& isolInDr04, const IsolationVariables& isolInDr03) { + isolationR04_ = isolInDr04; + isolationR03_ = isolInDr03; + } - PflowIDVariables() - : nClusterOutsideMustache(-1), etOutsideMustache(mvaPlaceholder), mva(mvaPlaceholder), dnn(mvaPlaceholder) {} + /// Egamma Isolation variables in cone dR=0.4 + ///Ecal isolation sum calculated from recHits + float ecalRecHitSumEtConeDR04() const { return isolationR04_.ecalRecHitSumEt; } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() + float hcalTowerSumEt(const IsolationVariables& iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalTowerSumEt; + else if (depth == 1) + return iv.hcalDepth1TowerSumEt; + else if (depth == 2) + return iv.hcalDepth2TowerSumEt; + + return 0.f; + } else { + const auto& hcaliso = iv.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float hcalTowerSumEtConeDR04(int depth = 0) const { return hcalTowerSumEt(isolationR04_, depth); } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() + float hcalTowerSumEtBc(const IsolationVariables& iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalTowerSumEtBc; + else if (depth == 1) + return iv.hcalDepth1TowerSumEtBc; + else if (depth == 2) + return iv.hcalDepth2TowerSumEtBc; + + return 0.f; + } else { + const auto& hcaliso = iv.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float hcalTowerSumEtBcConeDR04(int depth = 0) const { return hcalTowerSumEtBc(isolationR04_, depth); } + // Track pT sum + float trkSumPtSolidConeDR04() const { return isolationR04_.trkSumPtSolidCone; } + //As above, excluding the core at the center of the cone + float trkSumPtHollowConeDR04() const { return isolationR04_.trkSumPtHollowCone; } + //Returns number of tracks in a cone of dR + int nTrkSolidConeDR04() const { return isolationR04_.nTrkSolidCone; } + //As above, excluding the core at the center of the cone + int nTrkHollowConeDR04() const { return isolationR04_.nTrkHollowCone; } + // + /// Isolation variables in cone dR=0.3 + float ecalRecHitSumEtConeDR03() const { return isolationR03_.ecalRecHitSumEt; } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() + float hcalTowerSumEtConeDR03(int depth = 0) const { return hcalTowerSumEt(isolationR03_, depth); } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() + float hcalTowerSumEtBcConeDR03(int depth = 0) const { return hcalTowerSumEtBc(isolationR03_, depth); } + // Track pT sum c + float trkSumPtSolidConeDR03() const { return isolationR03_.trkSumPtSolidCone; } + //As above, excluding the core at the center of the cone + float trkSumPtHollowConeDR03() const { return isolationR03_.trkSumPtHollowCone; } + //Returns number of tracks in a cone of dR + int nTrkSolidConeDR03() const { return isolationR03_.nTrkSolidCone; } + //As above, excluding the core at the center of the cone + int nTrkHollowConeDR03() const { return isolationR03_.nTrkHollowCone; } + + //======================================================= + // PFlow based Isolation Variables + //======================================================= + + struct PflowIsolationVariables { + float chargedHadronIso; //charged hadron isolation with dxy,dz match to pv + float chargedHadronWorstVtxIso; //max charged hadron isolation when dxy/dz matching to given vtx + float chargedHadronWorstVtxGeomVetoIso; //as chargedHadronWorstVtxIso but an additional geometry based veto cone + float chargedHadronPFPVIso; //only considers particles assigned to the primary vertex (PV) by particle flow, corresponds to <10_6 chargedHadronIso + float neutralHadronIso; + float photonIso; + float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of photon + float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of photon + PflowIsolationVariables() + : + + chargedHadronIso(0.), + chargedHadronWorstVtxIso(0.), + chargedHadronWorstVtxGeomVetoIso(0.), + chargedHadronPFPVIso(0.), + neutralHadronIso(0.), + photonIso(0.), + sumEcalClusterEt(0.), + sumHcalClusterEt(0.) {} + }; + + /// Accessors for Particle Flow Isolation variables + float chargedHadronIso() const { return pfIsolation_.chargedHadronIso; } + float chargedHadronWorstVtxIso() const { return pfIsolation_.chargedHadronWorstVtxIso; } + float chargedHadronWorstVtxGeomVetoIso() const { return pfIsolation_.chargedHadronWorstVtxGeomVetoIso; } + float chargedHadronPFPVIso() const { return pfIsolation_.chargedHadronPFPVIso; } + float neutralHadronIso() const { return pfIsolation_.neutralHadronIso; } + float photonIso() const { return pfIsolation_.photonIso; } + + //backwards compat functions for pat::Photon + float ecalPFClusterIso() const { return pfIsolation_.sumEcalClusterEt; }; + float hcalPFClusterIso() const { return pfIsolation_.sumHcalClusterEt; }; + + /// Get Particle Flow Isolation variables block + const PflowIsolationVariables& getPflowIsolationVariables() const { return pfIsolation_; } + + /// Set Particle Flow Isolation variables + void setPflowIsolationVariables(const PflowIsolationVariables& pfisol) { pfIsolation_ = pfisol; } + + static constexpr float mvaPlaceholder = -999999999.; + + struct PflowIDVariables { + int nClusterOutsideMustache; + float etOutsideMustache; + float mva; + float dnn; + + PflowIDVariables() + : nClusterOutsideMustache(-1), + etOutsideMustache(mvaPlaceholder), + mva(mvaPlaceholder), + dnn(mvaPlaceholder) {} + }; + + // getters + int nClusterOutsideMustache() const { return pfID_.nClusterOutsideMustache; } + float etOutsideMustache() const { return pfID_.etOutsideMustache; } + float pfMVA() const { return pfID_.mva; } + float pfDNN() const { return pfID_.dnn; } + // setters + void setPflowIDVariables(const PflowIDVariables& pfid) { pfID_ = pfid; } + + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + void hcalToRun2EffDepth(); + + ///MVA based beam halo tagger - trained for EE and for pT > 200 GeV + float haloTaggerMVAVal() const { return haloTaggerMVAVal_; } + + ///set the haloTaggerMVAVal here + void setHaloTaggerMVAVal(float x) { haloTaggerMVAVal_ = x; } + + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// position of seed BasicCluster for shower depth of unconverted photon + math::XYZPointF caloPosition_; + /// reference to the PhotonCore + reco::PhotonCoreRef photonCore_; + // + bool pixelSeed_; + // + FiducialFlags fiducialFlagBlock_; + IsolationVariables isolationR04_; + IsolationVariables isolationR03_; + ShowerShape showerShapeBlock_; + ShowerShape full5x5_showerShapeBlock_; + SaturationInfo saturationInfo_; + EnergyCorrections eCorrections_; + MIPVariables mipVariableBlock_; + PflowIsolationVariables pfIsolation_; + PflowIDVariables pfID_; + float haloTaggerMVAVal_; }; - // getters - int nClusterOutsideMustache() const { return pfID_.nClusterOutsideMustache; } - float etOutsideMustache() const { return pfID_.etOutsideMustache; } - float pfMVA() const { return pfID_.mva; } - float pfDNN() const { return pfID_.dnn; } - // setters - void setPflowIDVariables(const PflowIDVariables& pfid) { pfID_ = pfid; } - - // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest - void hcalToRun2EffDepth(); - - ///MVA based beam halo tagger - trained for EE and for pT > 200 GeV - float haloTaggerMVAVal() const { return haloTaggerMVAVal_; } - - ///set the haloTaggerMVAVal here - void setHaloTaggerMVAVal(float x) { haloTaggerMVAVal_ = x; } - - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// position of seed BasicCluster for shower depth of unconverted photon - math::XYZPointF caloPosition_; - /// reference to the PhotonCore - reco::PhotonCoreRef photonCore_; - // - bool pixelSeed_; - // - FiducialFlags fiducialFlagBlock_; - IsolationVariables isolationR04_; - IsolationVariables isolationR03_; - ShowerShape showerShapeBlock_; - ShowerShape full5x5_showerShapeBlock_; - SaturationInfo saturationInfo_; - EnergyCorrections eCorrections_; - MIPVariables mipVariableBlock_; - PflowIsolationVariables pfIsolation_; - PflowIDVariables pfID_; - float haloTaggerMVAVal_; - }; - + } // namespace io_v1 + using Photon = io_v1::Photon; } // namespace reco #endif diff --git a/DataFormats/EgammaCandidates/interface/PhotonCore.h b/DataFormats/EgammaCandidates/interface/PhotonCore.h index 725aa3cc98ad7..bbf5b3d415ff4 100644 --- a/DataFormats/EgammaCandidates/interface/PhotonCore.h +++ b/DataFormats/EgammaCandidates/interface/PhotonCore.h @@ -20,82 +20,86 @@ #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h" namespace reco { + namespace io_v1 { - class PhotonCore { - public: - /// default constructor - // PhotonCore() { } + class PhotonCore { + public: + /// default constructor + // PhotonCore() { } - /// To be deleted: Internal comment for Florian - /// I would reserve this constructor to build the standard photons, as it was before, plus I add the initialization of the provenance - PhotonCore(const reco::SuperClusterRef &scl) : superCluster_(scl), isPFlowPhoton_(false), isStandardPhoton_(true) {} + /// To be deleted: Internal comment for Florian + /// I would reserve this constructor to build the standard photons, as it was before, plus I add the initialization of the provenance + PhotonCore(const reco::SuperClusterRef &scl) + : superCluster_(scl), isPFlowPhoton_(false), isStandardPhoton_(true) {} - // while for building photons from pf I would use the default constructor - PhotonCore() : isPFlowPhoton_(false), isStandardPhoton_(false) {} - // followed by the setters of the provenance and of the Ref to the wanted supercluster - // at that point if in PF you have found a photon which correspond to a standard SC yuo can - // set both supercluster and the two flags to true - // if you have found an object which does not have a standard SC associated you set only the - // one from pflow. - // How does this sound ? + // while for building photons from pf I would use the default constructor + PhotonCore() : isPFlowPhoton_(false), isStandardPhoton_(false) {} + // followed by the setters of the provenance and of the Ref to the wanted supercluster + // at that point if in PF you have found a photon which correspond to a standard SC yuo can + // set both supercluster and the two flags to true + // if you have found an object which does not have a standard SC associated you set only the + // one from pflow. + // How does this sound ? - /// destructor - virtual ~PhotonCore() {} + /// destructor + virtual ~PhotonCore() {} - PhotonCore *clone() const { return new PhotonCore(*this); } + PhotonCore *clone() const { return new PhotonCore(*this); } - /// set reference to SuperCluster - void setSuperCluster(const reco::SuperClusterRef &r) { superCluster_ = r; } - /// set reference to PFlow SuperCluster - void setParentSuperCluster(const reco::SuperClusterRef &r) { parentSuperCluster_ = r; } - /// add single ConversionRef to the vector of Refs - void addConversion(const reco::ConversionRef &r) { conversions_.push_back(r); } - /// add single ConversionRef to the vector of Refs - void addOneLegConversion(const reco::ConversionRef &r) { conversionsOneLeg_.push_back(r); } - /// set electron pixel seed ref - void addElectronPixelSeed(const reco::ElectronSeedRef &r) { electronSeed_.push_back(r); } - /// set the provenance - void setPFlowPhoton(const bool prov) { isPFlowPhoton_ = prov; } - void setStandardPhoton(const bool prov) { isStandardPhoton_ = prov; } + /// set reference to SuperCluster + void setSuperCluster(const reco::SuperClusterRef &r) { superCluster_ = r; } + /// set reference to PFlow SuperCluster + void setParentSuperCluster(const reco::SuperClusterRef &r) { parentSuperCluster_ = r; } + /// add single ConversionRef to the vector of Refs + void addConversion(const reco::ConversionRef &r) { conversions_.push_back(r); } + /// add single ConversionRef to the vector of Refs + void addOneLegConversion(const reco::ConversionRef &r) { conversionsOneLeg_.push_back(r); } + /// set electron pixel seed ref + void addElectronPixelSeed(const reco::ElectronSeedRef &r) { electronSeed_.push_back(r); } + /// set the provenance + void setPFlowPhoton(const bool prov) { isPFlowPhoton_ = prov; } + void setStandardPhoton(const bool prov) { isStandardPhoton_ = prov; } - /// get reference to SuperCluster - reco::SuperClusterRef superCluster() const { return superCluster_; } - /// get reference to PFlow SuperCluster - reco::SuperClusterRef parentSuperCluster() const { return parentSuperCluster_; } + /// get reference to SuperCluster + reco::SuperClusterRef superCluster() const { return superCluster_; } + /// get reference to PFlow SuperCluster + reco::SuperClusterRef parentSuperCluster() const { return parentSuperCluster_; } - //// comment for Florian. I have seen that in GsfElectronCore they have a getter for the supercluster - // which returns the pfSuperCluster only if the standard supeclsuter is not null - // But I had udnerstood from you when we spke last time that we wish to be free - // to have both SCs available. Or not ? + //// comment for Florian. I have seen that in GsfElectronCore they have a getter for the supercluster + // which returns the pfSuperCluster only if the standard supeclsuter is not null + // But I had udnerstood from you when we spke last time that we wish to be free + // to have both SCs available. Or not ? - /// get vector of references to Conversion's - reco::ConversionRefVector conversions() const { return conversions_; } - /// get vector of references to one leg Conversion's - reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } + /// get vector of references to Conversion's + reco::ConversionRefVector conversions() const { return conversions_; } + /// get vector of references to one leg Conversion's + reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } - void setConversions(const reco::ConversionRefVector &conversions) { conversions_ = conversions; } - void setConversionsOneLeg(const reco::ConversionRefVector &conversions) { conversionsOneLeg_ = conversions; } + void setConversions(const reco::ConversionRefVector &conversions) { conversions_ = conversions; } + void setConversionsOneLeg(const reco::ConversionRefVector &conversions) { conversionsOneLeg_ = conversions; } - /// get reference to electron seed if existing - reco::ElectronSeedRefVector electronPixelSeeds() const { return electronSeed_; } - bool isPFlowPhoton() const { return isPFlowPhoton_; } - bool isStandardPhoton() const { return isStandardPhoton_; } + /// get reference to electron seed if existing + reco::ElectronSeedRefVector electronPixelSeeds() const { return electronSeed_; } + bool isPFlowPhoton() const { return isPFlowPhoton_; } + bool isStandardPhoton() const { return isStandardPhoton_; } - private: - /// reference to a SuperCluster - reco::SuperClusterRef superCluster_; - // vector of references to Conversions - reco::ConversionRefVector conversions_; - //vector of references for 1-leg - reco::ConversionRefVector conversionsOneLeg_; - // vector of references to ElectronPixelSeeds - reco::ElectronSeedRefVector electronSeed_; - /// reference to a Particle flow SuperCluster - reco::SuperClusterRef parentSuperCluster_; - bool isPFlowPhoton_; - bool isStandardPhoton_; - }; + private: + /// reference to a SuperCluster + reco::SuperClusterRef superCluster_; + // vector of references to Conversions + reco::ConversionRefVector conversions_; + //vector of references for 1-leg + reco::ConversionRefVector conversionsOneLeg_; + // vector of references to ElectronPixelSeeds + reco::ElectronSeedRefVector electronSeed_; + /// reference to a Particle flow SuperCluster + reco::SuperClusterRef parentSuperCluster_; + bool isPFlowPhoton_; + bool isStandardPhoton_; + }; + } // namespace io_v1 + using PhotonCore = io_v1::PhotonCore; } // namespace reco #endif diff --git a/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h b/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h index c4f42fbdd299e..47e4b776d4a00 100644 --- a/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h +++ b/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class PhotonCore; + namespace io_v1 { + class PhotonCore; + } + using PhotonCore = io_v1::PhotonCore; /// collectin of PhotonCore objects typedef std::vector PhotonCoreCollection; diff --git a/DataFormats/EgammaCandidates/interface/PhotonFwd.h b/DataFormats/EgammaCandidates/interface/PhotonFwd.h index fbd53d29598f7..40e24ee8b2f1a 100644 --- a/DataFormats/EgammaCandidates/interface/PhotonFwd.h +++ b/DataFormats/EgammaCandidates/interface/PhotonFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Photon; + namespace io_v1 { + class Photon; + } + using Photon = io_v1::Photon; /// collectin of Photon objects typedef std::vector PhotonCollection; diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 4f13001dc7804..ce1f08d80c910 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -1,274 +1,196 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -279,18 +201,18 @@ - + - - + + - + - - + + @@ -315,24 +237,24 @@ - + - + - + - + - + - - + + - - + + diff --git a/DataFormats/EgammaReco/interface/ElectronSeed.h b/DataFormats/EgammaReco/interface/ElectronSeed.h index 538c2f716702f..0a515b6324ae7 100644 --- a/DataFormats/EgammaReco/interface/ElectronSeed.h +++ b/DataFormats/EgammaReco/interface/ElectronSeed.h @@ -47,112 +47,115 @@ #include namespace reco { - - class ElectronSeed : public TrajectorySeed { - public: - struct PMVars { - float dRZPos; - float dRZNeg; - float dPhiPos; - float dPhiNeg; - int detId; //this is already stored as the hit is stored in traj seed but a useful sanity check - int layerOrDiskNr; //redundant as stored in detId but its a huge pain to hence why its saved here - - PMVars(); - - void setDPhi(float pos, float neg); - void setDRZ(float pos, float neg); - void setDet(int iDetId, int iLayerOrDiskNr); + namespace io_v1 { + + class ElectronSeed : public TrajectorySeed { + public: + struct PMVars { + float dRZPos; + float dRZNeg; + float dPhiPos; + float dPhiNeg; + int detId; //this is already stored as the hit is stored in traj seed but a useful sanity check + int layerOrDiskNr; //redundant as stored in detId but its a huge pain to hence why its saved here + + PMVars(); + + void setDPhi(float pos, float neg); + void setDRZ(float pos, float neg); + void setDet(int iDetId, int iLayerOrDiskNr); + }; + + typedef edm::RefToBase CaloClusterRef; + typedef edm::Ref CtfTrackRef; + + static std::string const& name() { + static std::string const name_("ElectronSeed"); + return name_; + } + + //! Construction of base attributes + ElectronSeed(); + ElectronSeed(const TrajectorySeed&); + ElectronSeed(PTrajectoryStateOnDet& pts, RecHitContainer& rh, PropagationDirection& dir); + ElectronSeed* clone() const override { return new ElectronSeed(*this); } + ~ElectronSeed() override; + + //! Set additional info + void setCtfTrack(const CtfTrackRef&); + void setCaloCluster(const CaloClusterRef& clus) { + caloCluster_ = clus; + isEcalDriven_ = true; + } + void addHitInfo(const PMVars& hitVars) { hitInfo_.push_back(hitVars); } + void setNrLayersAlongTraj(int val) { nrLayersAlongTraj_ = val; } + //! Accessors + const CtfTrackRef& ctfTrack() const { return ctfTrack_; } + const CaloClusterRef& caloCluster() const { return caloCluster_; } + + //! Utility + TrackCharge getCharge() const { return startingState().parameters().charge(); } + + bool isEcalDriven() const { return isEcalDriven_; } + bool isTrackerDriven() const { return isTrackerDriven_; } + + const std::vector& hitInfo() const { return hitInfo_; } + float dPhiNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiNeg); } + float dPhiPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiPos); } + float dPhiBest(size_t hitNr) const { return bestVal(dPhiNeg(hitNr), dPhiPos(hitNr)); } + float dRZPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZPos); } + float dRZNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZNeg); } + float dRZBest(size_t hitNr) const { return bestVal(dRZNeg(hitNr), dRZPos(hitNr)); } + int detId(size_t hitNr) const { return hitNr < hitInfo_.size() ? hitInfo_[hitNr].detId : 0; } + int subDet(size_t hitNr) const { return DetId(detId(hitNr)).subdetId(); } + int layerOrDiskNr(size_t hitNr) const { return getVal(hitNr, &PMVars::layerOrDiskNr); } + int nrLayersAlongTraj() const { return nrLayersAlongTraj_; } + + unsigned int hitsMask() const; + void initTwoHitSeed(const unsigned char hitMask); + void setNegAttributes(const float dRZ2 = std::numeric_limits::max(), + const float dPhi2 = std::numeric_limits::max(), + const float dRZ1 = std::numeric_limits::max(), + const float dPhi1 = std::numeric_limits::max()); + void setPosAttributes(const float dRZ2 = std::numeric_limits::max(), + const float dPhi2 = std::numeric_limits::max(), + const float dRZ1 = std::numeric_limits::max(), + const float dPhi1 = std::numeric_limits::max()); + + //this is a backwards compatible function designed to + //convert old format ElectronSeeds to the new format + //only public due to root io rules, not intended for any other use + //also in theory not necessary to part of this class + static std::vector createHitInfo(const float dPhi1Pos, + const float dPhi1Neg, + const float dRZ1Pos, + const float dRZ1Neg, + const float dPhi2Pos, + const float dPhi2Neg, + const float dRZ2Pos, + const float dRZ2Neg, + const char hitMask, + TrajectorySeed::RecHitRange const& recHits); + + private: + static float bestVal(float val1, float val2) { return std::abs(val1) < std::abs(val2) ? val1 : val2; } + template + T getVal(unsigned int hitNr, T PMVars::*val) const { + return hitNr < hitInfo_.size() ? hitInfo_[hitNr].*val : std::numeric_limits::max(); + } + static std::vector hitNrsFromMask(unsigned int hitMask); + + private: + CtfTrackRef ctfTrack_; + CaloClusterRef caloCluster_; + std::vector hitInfo_; + int nrLayersAlongTraj_; + + bool isEcalDriven_; + bool isTrackerDriven_; }; - - typedef edm::RefToBase CaloClusterRef; - typedef edm::Ref CtfTrackRef; - - static std::string const& name() { - static std::string const name_("ElectronSeed"); - return name_; - } - - //! Construction of base attributes - ElectronSeed(); - ElectronSeed(const TrajectorySeed&); - ElectronSeed(PTrajectoryStateOnDet& pts, RecHitContainer& rh, PropagationDirection& dir); - ElectronSeed* clone() const override { return new ElectronSeed(*this); } - ~ElectronSeed() override; - - //! Set additional info - void setCtfTrack(const CtfTrackRef&); - void setCaloCluster(const CaloClusterRef& clus) { - caloCluster_ = clus; - isEcalDriven_ = true; - } - void addHitInfo(const PMVars& hitVars) { hitInfo_.push_back(hitVars); } - void setNrLayersAlongTraj(int val) { nrLayersAlongTraj_ = val; } - //! Accessors - const CtfTrackRef& ctfTrack() const { return ctfTrack_; } - const CaloClusterRef& caloCluster() const { return caloCluster_; } - - //! Utility - TrackCharge getCharge() const { return startingState().parameters().charge(); } - - bool isEcalDriven() const { return isEcalDriven_; } - bool isTrackerDriven() const { return isTrackerDriven_; } - - const std::vector& hitInfo() const { return hitInfo_; } - float dPhiNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiNeg); } - float dPhiPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiPos); } - float dPhiBest(size_t hitNr) const { return bestVal(dPhiNeg(hitNr), dPhiPos(hitNr)); } - float dRZPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZPos); } - float dRZNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZNeg); } - float dRZBest(size_t hitNr) const { return bestVal(dRZNeg(hitNr), dRZPos(hitNr)); } - int detId(size_t hitNr) const { return hitNr < hitInfo_.size() ? hitInfo_[hitNr].detId : 0; } - int subDet(size_t hitNr) const { return DetId(detId(hitNr)).subdetId(); } - int layerOrDiskNr(size_t hitNr) const { return getVal(hitNr, &PMVars::layerOrDiskNr); } - int nrLayersAlongTraj() const { return nrLayersAlongTraj_; } - - unsigned int hitsMask() const; - void initTwoHitSeed(const unsigned char hitMask); - void setNegAttributes(const float dRZ2 = std::numeric_limits::max(), - const float dPhi2 = std::numeric_limits::max(), - const float dRZ1 = std::numeric_limits::max(), - const float dPhi1 = std::numeric_limits::max()); - void setPosAttributes(const float dRZ2 = std::numeric_limits::max(), - const float dPhi2 = std::numeric_limits::max(), - const float dRZ1 = std::numeric_limits::max(), - const float dPhi1 = std::numeric_limits::max()); - - //this is a backwards compatible function designed to - //convert old format ElectronSeeds to the new format - //only public due to root io rules, not intended for any other use - //also in theory not necessary to part of this class - static std::vector createHitInfo(const float dPhi1Pos, - const float dPhi1Neg, - const float dRZ1Pos, - const float dRZ1Neg, - const float dPhi2Pos, - const float dPhi2Neg, - const float dRZ2Pos, - const float dRZ2Neg, - const char hitMask, - TrajectorySeed::RecHitRange const& recHits); - - private: - static float bestVal(float val1, float val2) { return std::abs(val1) < std::abs(val2) ? val1 : val2; } - template - T getVal(unsigned int hitNr, T PMVars::*val) const { - return hitNr < hitInfo_.size() ? hitInfo_[hitNr].*val : std::numeric_limits::max(); - } - static std::vector hitNrsFromMask(unsigned int hitMask); - - private: - CtfTrackRef ctfTrack_; - CaloClusterRef caloCluster_; - std::vector hitInfo_; - int nrLayersAlongTraj_; - - bool isEcalDriven_; - bool isTrackerDriven_; - }; + } // namespace io_v1 + using ElectronSeed = io_v1::ElectronSeed; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/ElectronSeedFwd.h b/DataFormats/EgammaReco/interface/ElectronSeedFwd.h index a14cbbf7e9ce4..912baa650c06a 100644 --- a/DataFormats/EgammaReco/interface/ElectronSeedFwd.h +++ b/DataFormats/EgammaReco/interface/ElectronSeedFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class ElectronSeed; + namespace io_v1 { + class ElectronSeed; + } + using ElectronSeed = io_v1::ElectronSeed; /// collection of ElectronSeed objects typedef std::vector ElectronSeedCollection; /// reference to an object in a collection of ElectronSeed objects diff --git a/DataFormats/EgammaReco/interface/HFEMClusterShape.h b/DataFormats/EgammaReco/interface/HFEMClusterShape.h index 50885a19c2c03..738bdf8d37e2c 100644 --- a/DataFormats/EgammaReco/interface/HFEMClusterShape.h +++ b/DataFormats/EgammaReco/interface/HFEMClusterShape.h @@ -16,57 +16,60 @@ */ namespace reco { + namespace io_v1 { - class HFEMClusterShape { - public: - HFEMClusterShape() {} + class HFEMClusterShape { + public: + HFEMClusterShape() {} - HFEMClusterShape(double eLong1x1, - double eShort1x1, - double eLong3x3, - double eShort3x3, - double eLong5x5, - double eShort5x5, - double eLongCore, - double CellEta, - double CellPhi, - DetId seed); + HFEMClusterShape(double eLong1x1, + double eShort1x1, + double eLong3x3, + double eShort3x3, + double eLong5x5, + double eShort5x5, + double eLongCore, + double CellEta, + double CellPhi, + DetId seed); - //energy in long or short fibers various cluster sizes - double eLong1x1() const { return eLong1x1_; } - double eShort1x1() const { return eShort1x1_; } - double eLong3x3() const { return eLong3x3_; } - double eShort3x3() const { return eShort3x3_; } - double eLong5x5() const { return eLong5x5_; } - double eShort5x5() const { return eShort5x5_; } + //energy in long or short fibers various cluster sizes + double eLong1x1() const { return eLong1x1_; } + double eShort1x1() const { return eShort1x1_; } + double eLong3x3() const { return eLong3x3_; } + double eShort3x3() const { return eShort3x3_; } + double eLong5x5() const { return eLong5x5_; } + double eShort5x5() const { return eShort5x5_; } - //total energy in various clusters - double e1x1() const; - double e3x3() const; - double e5x5() const; + //total energy in various clusters + double e1x1() const; + double e3x3() const; + double e5x5() const; - //Identification Variables - //Longetudinal variable: E(3x3,short fibers)/E(3x3,long fibers) - double eSeL() const; - //Transverse Variable: E(Core of cluster)/E(3x3) - double eCOREe9() const; - //Shower Exclusion Variable: E(3x3)/E(5x5) - double e9e25() const; + //Identification Variables + //Longetudinal variable: E(3x3,short fibers)/E(3x3,long fibers) + double eSeL() const; + //Transverse Variable: E(Core of cluster)/E(3x3) + double eCOREe9() const; + //Shower Exclusion Variable: E(3x3)/E(5x5) + double e9e25() const; - //energy in central highest energy cells (at least 50% energy of previous total energy startign with seed cell) - double eCore() const { return eLongCore_; } + //energy in central highest energy cells (at least 50% energy of previous total energy startign with seed cell) + double eCore() const { return eLongCore_; } - double CellEta() const { return CellEta_; } - double CellPhi() const { return CellPhi_; } + double CellEta() const { return CellEta_; } + double CellPhi() const { return CellPhi_; } - //seed cell of cluster DetId - DetId seed() const { return seed_; } + //seed cell of cluster DetId + DetId seed() const { return seed_; } - private: - double eLong1x1_, eShort1x1_, eLong3x3_, eShort3x3_, eLong5x5_, eShort5x5_, eLongCore_, CellEta_, CellPhi_; - DetId seed_; - }; + private: + double eLong1x1_, eShort1x1_, eLong3x3_, eShort3x3_, eLong5x5_, eShort5x5_, eLongCore_, CellEta_, CellPhi_; + DetId seed_; + }; + } // namespace io_v1 + using HFEMClusterShape = io_v1::HFEMClusterShape; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h b/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h index 0a76dd1c350c6..12db1d83307bd 100644 --- a/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h +++ b/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h @@ -5,7 +5,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class HFEMClusterShape; + namespace io_v1 { + class HFEMClusterShape; + } + using HFEMClusterShape = io_v1::HFEMClusterShape; // collection of HFEMClusterShape objects typedef std::vector HFEMClusterShapeCollection; diff --git a/DataFormats/EgammaReco/interface/PreshowerCluster.h b/DataFormats/EgammaReco/interface/PreshowerCluster.h index bcd59e401abdd..86a43b6801e81 100644 --- a/DataFormats/EgammaReco/interface/PreshowerCluster.h +++ b/DataFormats/EgammaReco/interface/PreshowerCluster.h @@ -13,53 +13,56 @@ #include namespace reco { + namespace io_v1 { - class PreshowerCluster : public CaloCluster { - public: - typedef math::XYZPoint Point; + class PreshowerCluster : public CaloCluster { + public: + typedef math::XYZPoint Point; - /// default constructor - PreshowerCluster() : CaloCluster(0., Point(0., 0., 0.)) {} + /// default constructor + PreshowerCluster() : CaloCluster(0., Point(0., 0., 0.)) {} - ~PreshowerCluster() override; + ~PreshowerCluster() override; - /// Constructor from EcalRecHits - PreshowerCluster(const double E, - const Point& pos, - const std::vector >& usedHits, - const int plane); + /// Constructor from EcalRecHits + PreshowerCluster(const double E, + const Point& pos, + const std::vector >& usedHits, + const int plane); - /// Constructor from cluster - PreshowerCluster(const PreshowerCluster&); + /// Constructor from cluster + PreshowerCluster(const PreshowerCluster&); - /// Number of RecHits the cluster - int nhits() const { return hitsAndFractions_.size(); } + /// Number of RecHits the cluster + int nhits() const { return hitsAndFractions_.size(); } - /// Preshower plane - int plane() const { return plane_; } + /// Preshower plane + int plane() const { return plane_; } - double et() const { return energy() / cosh(eta()); } + double et() const { return energy() / cosh(eta()); } - /// Comparisons - bool operator==(const PreshowerCluster&) const; - bool operator<(const PreshowerCluster&) const; + /// Comparisons + bool operator==(const PreshowerCluster&) const; + bool operator<(const PreshowerCluster&) const; - /// Associated basic cluster; - CaloClusterPtr basicCluster() const { return bc_ref_; } + /// Associated basic cluster; + CaloClusterPtr basicCluster() const { return bc_ref_; } - /// DetIds of component RecHits -- now inherited from CaloCluster - //std::vector getHitsByDetId() const { return usedHits_; } + /// DetIds of component RecHits -- now inherited from CaloCluster + //std::vector getHitsByDetId() const { return usedHits_; } - void setBCRef(const CaloClusterPtr& r) { bc_ref_ = r; } + void setBCRef(const CaloClusterPtr& r) { bc_ref_ = r; } - private: - int plane_; + private: + int plane_; - /// Associated basic cluster; - CaloClusterPtr bc_ref_; + /// Associated basic cluster; + CaloClusterPtr bc_ref_; - /// used hits by detId -- now inherited from CaloCluster - //std::vector usedHits_; - }; + /// used hits by detId -- now inherited from CaloCluster + //std::vector usedHits_; + }; + } // namespace io_v1 + using PreshowerCluster = io_v1::PreshowerCluster; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h b/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h index 0300ff66ca250..5c7c178577da9 100644 --- a/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h +++ b/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h @@ -9,7 +9,10 @@ #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" namespace reco { - class PreshowerCluster; + namespace io_v1 { + class PreshowerCluster; + } + using PreshowerCluster = io_v1::PreshowerCluster; /// collection of PreshowerCluster objects typedef std::vector PreshowerClusterCollection; diff --git a/DataFormats/EgammaReco/interface/PreshowerClusterShape.h b/DataFormats/EgammaReco/interface/PreshowerClusterShape.h index ef72ee0791d77..d8f6e823dd090 100644 --- a/DataFormats/EgammaReco/interface/PreshowerClusterShape.h +++ b/DataFormats/EgammaReco/interface/PreshowerClusterShape.h @@ -10,39 +10,42 @@ #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" namespace reco { + namespace io_v1 { - class PreshowerClusterShape { - public: - /// default constructor - PreshowerClusterShape() {} + class PreshowerClusterShape { + public: + /// default constructor + PreshowerClusterShape() {} - virtual ~PreshowerClusterShape(); + virtual ~PreshowerClusterShape(); - /// constructor from strip energies - PreshowerClusterShape(const std::vector& stripEnergies, const int plane); + /// constructor from strip energies + PreshowerClusterShape(const std::vector& stripEnergies, const int plane); - /// Copy contructor - PreshowerClusterShape(const PreshowerClusterShape&); + /// Copy contructor + PreshowerClusterShape(const PreshowerClusterShape&); - /// Preshower plane - int plane() const { return plane_; } + /// Preshower plane + int plane() const { return plane_; } - /// Associated SuperCluster; - SuperClusterRef superCluster() const { return sc_ref_; } + /// Associated SuperCluster; + SuperClusterRef superCluster() const { return sc_ref_; } - /// Energies of component strips - virtual std::vector getStripEnergies() const { return stripEnergies_; } + /// Energies of component strips + virtual std::vector getStripEnergies() const { return stripEnergies_; } - void setSCRef(const SuperClusterRef& r) { sc_ref_ = r; } + void setSCRef(const SuperClusterRef& r) { sc_ref_ = r; } - private: - int plane_; + private: + int plane_; - /// Associated super cluster; - SuperClusterRef sc_ref_; + /// Associated super cluster; + SuperClusterRef sc_ref_; - /// used strip energies - std::vector stripEnergies_; - }; + /// used strip energies + std::vector stripEnergies_; + }; + } // namespace io_v1 + using PreshowerClusterShape = io_v1::PreshowerClusterShape; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h b/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h index 058d44464b6ce..efed326765e80 100644 --- a/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h +++ b/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h @@ -10,7 +10,10 @@ #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" namespace reco { - class PreshowerClusterShape; + namespace io_v1 { + class PreshowerClusterShape; + } + using PreshowerClusterShape = io_v1::PreshowerClusterShape; /// collection of PreshowerClusterShape objects typedef std::vector PreshowerClusterShapeCollection; diff --git a/DataFormats/EgammaReco/interface/SuperCluster.h b/DataFormats/EgammaReco/interface/SuperCluster.h index 738b5495a07aa..1f50fda8b484a 100644 --- a/DataFormats/EgammaReco/interface/SuperCluster.h +++ b/DataFormats/EgammaReco/interface/SuperCluster.h @@ -17,187 +17,190 @@ #include "DataFormats/EcalDetId/interface/EBDetId.h" namespace reco { - class SuperCluster : public CaloCluster { - public: - typedef math::XYZPoint Point; - - /// default constructor - SuperCluster() - : CaloCluster(0., Point(0., 0., 0.)), - preshowerEnergy_(0), - rawEnergy_(-1.), - phiWidth_(0), - etaWidth_(0), - preshowerEnergy1_(0), - preshowerEnergy2_(0) {} - - /// constructor defined by CaloCluster - will have to use setSeed and add() separately - SuperCluster(double energy, const Point& position); - - SuperCluster(double energy, - const Point& position, - const CaloClusterPtr& seed, - const CaloClusterPtrVector& clusters, - double Epreshower = 0., - double phiWidth = 0., - double etaWidth = 0., - double Epreshower1 = 0., - double Epreshower2 = 0.); - - // to be merged in the previous one? -- FIXME - SuperCluster(double energy, - const Point& position, - const CaloClusterPtr& seed, - const CaloClusterPtrVector& clusters, - const CaloClusterPtrVector& preshowerClusters, - double Epreshower = 0., - double phiWidth = 0., - double etaWidth = 0., - double Epreshower1 = 0., - double Epreshower2 = 0.); - - /// raw uncorrected energy (sum of energies of component BasicClusters) - double rawEnergy() const { return rawEnergy_; } - - /// energy deposited in preshower - double preshowerEnergy() const { return preshowerEnergy_; } - double preshowerEnergyPlane1() const { return preshowerEnergy1_; } - double preshowerEnergyPlane2() const { return preshowerEnergy2_; } - - /// obtain phi and eta width of the Super Cluster - double phiWidth() const { return phiWidth_; } - double etaWidth() const { return etaWidth_; } - - //Assign new variables to supercluster - void setPreshowerEnergy(double preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; }; - void setPreshowerEnergyPlane1(double preshowerEnergy1) { preshowerEnergy1_ = preshowerEnergy1; }; - void setPreshowerEnergyPlane2(double preshowerEnergy2) { preshowerEnergy2_ = preshowerEnergy2; }; - void setPhiWidth(double pw) { phiWidth_ = pw; } - void setEtaWidth(double ew) { etaWidth_ = ew; } - - /// seed BasicCluster - const CaloClusterPtr& seed() const { return seed_; } - - /// const access to the cluster list itself - const CaloClusterPtrVector& clusters() const { return clusters_; } - - /// const access to the preshower cluster list itself - const CaloClusterPtrVector& preshowerClusters() const { return preshowerClusters_; } - - /// fist iterator over BasicCluster constituents - CaloCluster_iterator clustersBegin() const { return clusters_.begin(); } - - /// last iterator over BasicCluster constituents - CaloCluster_iterator clustersEnd() const { return clusters_.end(); } - - /// fist iterator over PreshowerCluster constituents - CaloCluster_iterator preshowerClustersBegin() const { return preshowerClusters_.begin(); } - - /// last iterator over PreshowerCluster constituents - CaloCluster_iterator preshowerClustersEnd() const { return preshowerClusters_.end(); } - - /// number of BasicCluster constituents - size_t clustersSize() const { return clusters_.size(); } - - /// number of BasicCluster PreShower constituents - size_t preshowerClustersSize() const { return preshowerClusters_.size(); } - - /// list of used xtals by DetId // now inherited by CaloCluster - //std::vector getHitsByDetId() const { return usedHits_; } - - /// set reference to seed BasicCluster - void setSeed(const CaloClusterPtr& r) { seed_ = r; } - - //(re)-set clusters - void setClusters(const CaloClusterPtrVector& clusters) { - clusters_ = clusters; - computeRawEnergy(); - } - - //(re)-set preshower clusters - void setPreshowerClusters(const CaloClusterPtrVector& clusters) { preshowerClusters_ = clusters; } - - //clear hits and fractions vector (for slimming) - void clearHitsAndFractions() { hitsAndFractions_.clear(); } - - /// add reference to constituent BasicCluster - void addCluster(const CaloClusterPtr& r) { - clusters_.push_back(r); - computeRawEnergy(); - } - - /// add reference to constituent BasicCluster - void addPreshowerCluster(const CaloClusterPtr& r) { preshowerClusters_.push_back(r); } - - /** Set preshower planes status : + namespace io_v1 { + class SuperCluster : public CaloCluster { + public: + typedef math::XYZPoint Point; + + /// default constructor + SuperCluster() + : CaloCluster(0., Point(0., 0., 0.)), + preshowerEnergy_(0), + rawEnergy_(-1.), + phiWidth_(0), + etaWidth_(0), + preshowerEnergy1_(0), + preshowerEnergy2_(0) {} + + /// constructor defined by CaloCluster - will have to use setSeed and add() separately + SuperCluster(double energy, const Point& position); + + SuperCluster(double energy, + const Point& position, + const CaloClusterPtr& seed, + const CaloClusterPtrVector& clusters, + double Epreshower = 0., + double phiWidth = 0., + double etaWidth = 0., + double Epreshower1 = 0., + double Epreshower2 = 0.); + + // to be merged in the previous one? -- FIXME + SuperCluster(double energy, + const Point& position, + const CaloClusterPtr& seed, + const CaloClusterPtrVector& clusters, + const CaloClusterPtrVector& preshowerClusters, + double Epreshower = 0., + double phiWidth = 0., + double etaWidth = 0., + double Epreshower1 = 0., + double Epreshower2 = 0.); + + /// raw uncorrected energy (sum of energies of component BasicClusters) + double rawEnergy() const { return rawEnergy_; } + + /// energy deposited in preshower + double preshowerEnergy() const { return preshowerEnergy_; } + double preshowerEnergyPlane1() const { return preshowerEnergy1_; } + double preshowerEnergyPlane2() const { return preshowerEnergy2_; } + + /// obtain phi and eta width of the Super Cluster + double phiWidth() const { return phiWidth_; } + double etaWidth() const { return etaWidth_; } + + //Assign new variables to supercluster + void setPreshowerEnergy(double preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; }; + void setPreshowerEnergyPlane1(double preshowerEnergy1) { preshowerEnergy1_ = preshowerEnergy1; }; + void setPreshowerEnergyPlane2(double preshowerEnergy2) { preshowerEnergy2_ = preshowerEnergy2; }; + void setPhiWidth(double pw) { phiWidth_ = pw; } + void setEtaWidth(double ew) { etaWidth_ = ew; } + + /// seed BasicCluster + const CaloClusterPtr& seed() const { return seed_; } + + /// const access to the cluster list itself + const CaloClusterPtrVector& clusters() const { return clusters_; } + + /// const access to the preshower cluster list itself + const CaloClusterPtrVector& preshowerClusters() const { return preshowerClusters_; } + + /// fist iterator over BasicCluster constituents + CaloCluster_iterator clustersBegin() const { return clusters_.begin(); } + + /// last iterator over BasicCluster constituents + CaloCluster_iterator clustersEnd() const { return clusters_.end(); } + + /// fist iterator over PreshowerCluster constituents + CaloCluster_iterator preshowerClustersBegin() const { return preshowerClusters_.begin(); } + + /// last iterator over PreshowerCluster constituents + CaloCluster_iterator preshowerClustersEnd() const { return preshowerClusters_.end(); } + + /// number of BasicCluster constituents + size_t clustersSize() const { return clusters_.size(); } + + /// number of BasicCluster PreShower constituents + size_t preshowerClustersSize() const { return preshowerClusters_.size(); } + + /// list of used xtals by DetId // now inherited by CaloCluster + //std::vector getHitsByDetId() const { return usedHits_; } + + /// set reference to seed BasicCluster + void setSeed(const CaloClusterPtr& r) { seed_ = r; } + + //(re)-set clusters + void setClusters(const CaloClusterPtrVector& clusters) { + clusters_ = clusters; + computeRawEnergy(); + } + + //(re)-set preshower clusters + void setPreshowerClusters(const CaloClusterPtrVector& clusters) { preshowerClusters_ = clusters; } + + //clear hits and fractions vector (for slimming) + void clearHitsAndFractions() { hitsAndFractions_.clear(); } + + /// add reference to constituent BasicCluster + void addCluster(const CaloClusterPtr& r) { + clusters_.push_back(r); + computeRawEnergy(); + } + + /// add reference to constituent BasicCluster + void addPreshowerCluster(const CaloClusterPtr& r) { preshowerClusters_.push_back(r); } + + /** Set preshower planes status : 0 : both planes working 1 : only first plane working 2 : only second plane working 3 : both planes dead */ - void setPreshowerPlanesStatus(const uint32_t& status) { - uint32_t flags = flags_ & flagsMask_; - flags_ = flags | (status << flagsOffset_); - } + void setPreshowerPlanesStatus(const uint32_t& status) { + uint32_t flags = flags_ & flagsMask_; + flags_ = flags | (status << flagsOffset_); + } - /** Get preshower planes status : + /** Get preshower planes status : 0 : both planes working 1 : only first plane working 2 : only second plane working 3 : both planes dead */ - const int getPreshowerPlanesStatus() const { return (flags_ >> flagsOffset_); } - - const int seedCrysIEtaOrIx() const { - auto detid = seed_->seed(); - int ietaorix = 0; - if (detid.subdetId() == EcalBarrel) { - EBDetId ebdetid(detid); - ietaorix = ebdetid.ieta(); - } else if (detid.subdetId() == EcalEndcap) { - EEDetId eedetid(detid); - ietaorix = eedetid.ix(); + const int getPreshowerPlanesStatus() const { return (flags_ >> flagsOffset_); } + + const int seedCrysIEtaOrIx() const { + auto detid = seed_->seed(); + int ietaorix = 0; + if (detid.subdetId() == EcalBarrel) { + EBDetId ebdetid(detid); + ietaorix = ebdetid.ieta(); + } else if (detid.subdetId() == EcalEndcap) { + EEDetId eedetid(detid); + ietaorix = eedetid.ix(); + } + return ietaorix; } - return ietaorix; - } - - const int seedCrysIPhiOrIy() const { - auto detid = seed_->seed(); - int iphioriy = 0; - if (detid.subdetId() == EcalBarrel) { - EBDetId ebdetid(detid); - iphioriy = ebdetid.iphi(); - } else if (detid.subdetId() == EcalEndcap) { - EEDetId eedetid(detid); - iphioriy = eedetid.iy(); + + const int seedCrysIPhiOrIy() const { + auto detid = seed_->seed(); + int iphioriy = 0; + if (detid.subdetId() == EcalBarrel) { + EBDetId ebdetid(detid); + iphioriy = ebdetid.iphi(); + } else if (detid.subdetId() == EcalEndcap) { + EEDetId eedetid(detid); + iphioriy = eedetid.iy(); + } + return iphioriy; } - return iphioriy; - } - private: - void computeRawEnergy(); + private: + void computeRawEnergy(); - /// reference to BasicCluster seed - CaloClusterPtr seed_; + /// reference to BasicCluster seed + CaloClusterPtr seed_; - /// references to BasicCluster constitunets - CaloClusterPtrVector clusters_; + /// references to BasicCluster constitunets + CaloClusterPtrVector clusters_; - /// references to BasicCluster constitunets - CaloClusterPtrVector preshowerClusters_; + /// references to BasicCluster constitunets + CaloClusterPtrVector preshowerClusters_; - /// used hits by detId - retrieved from BC constituents -- now inherited from CaloCluster - //std::vector usedHits_; + /// used hits by detId - retrieved from BC constituents -- now inherited from CaloCluster + //std::vector usedHits_; - double preshowerEnergy_; + double preshowerEnergy_; - double rawEnergy_; + double rawEnergy_; - double phiWidth_; - double etaWidth_; + double phiWidth_; + double etaWidth_; - double preshowerEnergy1_; - double preshowerEnergy2_; - }; + double preshowerEnergy1_; + double preshowerEnergy2_; + }; + } // namespace io_v1 + using SuperCluster = io_v1::SuperCluster; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/SuperClusterFwd.h b/DataFormats/EgammaReco/interface/SuperClusterFwd.h index 0d47af5f0c183..94a5cb87906ff 100644 --- a/DataFormats/EgammaReco/interface/SuperClusterFwd.h +++ b/DataFormats/EgammaReco/interface/SuperClusterFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class SuperCluster; + namespace io_v1 { + class SuperCluster; + } + using SuperCluster = io_v1::SuperCluster; /// collection of SuperCluser objectr typedef std::vector SuperClusterCollection; diff --git a/DataFormats/EgammaReco/src/classes_def.xml b/DataFormats/EgammaReco/src/classes_def.xml index 43f33ec58d274..aefb655ddc69e 100644 --- a/DataFormats/EgammaReco/src/classes_def.xml +++ b/DataFormats/EgammaReco/src/classes_def.xml @@ -1,12 +1,12 @@ - - - + + + - - - + + + @@ -17,26 +17,21 @@ - - - - - - - + + - - - - - - - - - + + + + + + + + + @@ -71,86 +66,82 @@ - - + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + - + - + - - + + - - + + - - + + - - + + - - + + diff --git a/DataFormats/GsfTrackReco/interface/GsfTrack.h b/DataFormats/GsfTrackReco/interface/GsfTrack.h index a4d43789f73bc..534073444f57d 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrack.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrack.h @@ -8,107 +8,111 @@ #include "FWCore/Utilities/interface/thread_safety_macros.h" namespace reco { + namespace io_v1 { - class GsfTrack : public Track { - public: - /// parameter dimension mode - enum { dimensionMode = 3 }; - /// error matrix size mode - enum { covarianceSizeMode = dimensionMode * (dimensionMode + 1) / 2 }; - /// parameter vector (momentum part) from mode - typedef math::Vector::type ParameterVectorMode; - /// 3 parameter covariance matrix (momentum part) from mode - typedef math::Error::type CovarianceMatrixMode; - /// default constructor - GsfTrack(); - /// constructor from fit parameters and error matrix - /// notice that the reference point must be - /// the point of closest approch to the beamline. - GsfTrack(double chi2, double ndof, const Point&, const Vector&, int charge, const CovarianceMatrix&); - /// set reference to GSF "extra" object - void setGsfExtra(const GsfTrackExtraRef& ref) { gsfExtra_ = ref; } - /// reference to "extra" object - const GsfTrackExtraRef& gsfExtra() const { return gsfExtra_; } + class GsfTrack : public Track { + public: + /// parameter dimension mode + enum { dimensionMode = 3 }; + /// error matrix size mode + enum { covarianceSizeMode = dimensionMode * (dimensionMode + 1) / 2 }; + /// parameter vector (momentum part) from mode + typedef math::Vector::type ParameterVectorMode; + /// 3 parameter covariance matrix (momentum part) from mode + typedef math::Error::type CovarianceMatrixMode; + /// default constructor + GsfTrack(); + /// constructor from fit parameters and error matrix + /// notice that the reference point must be + /// the point of closest approch to the beamline. + GsfTrack(double chi2, double ndof, const Point&, const Vector&, int charge, const CovarianceMatrix&); + /// set reference to GSF "extra" object + void setGsfExtra(const GsfTrackExtraRef& ref) { gsfExtra_ = ref; } + /// reference to "extra" object + const GsfTrackExtraRef& gsfExtra() const { return gsfExtra_; } - /// set mode parameters - void setMode(int chargeMode, const Vector& momentumMode, const CovarianceMatrixMode& covarianceMode); + /// set mode parameters + void setMode(int chargeMode, const Vector& momentumMode, const CovarianceMatrixMode& covarianceMode); - /// track electric charge from mode - int chargeMode() const { return chargeMode_; } - /// q/p from mode - double qoverpMode() const { return chargeMode() / pMode(); } - /// polar angle from mode - double thetaMode() const { return momentumMode_.theta(); } - /// Lambda angle from mode - double lambdaMode() const { return M_PI / 2 - momentumMode_.theta(); } - /// momentum vector magnitude from mode - double pMode() const { return momentumMode_.R(); } - /// track transverse momentum from mode - double ptMode() const { return sqrt(momentumMode_.Perp2()); } - /// x coordinate of momentum vector from mode - double pxMode() const { return momentumMode_.x(); } - /// y coordinate of momentum vector from mode - double pyMode() const { return momentumMode_.y(); } - /// z coordinate of momentum vector from mode - double pzMode() const { return momentumMode_.z(); } - /// azimuthal angle of momentum vector from mode - double phiMode() const { return momentumMode_.Phi(); } - /// pseudorapidity of momentum vector from mode - double etaMode() const { return momentumMode_.Eta(); } + /// track electric charge from mode + int chargeMode() const { return chargeMode_; } + /// q/p from mode + double qoverpMode() const { return chargeMode() / pMode(); } + /// polar angle from mode + double thetaMode() const { return momentumMode_.theta(); } + /// Lambda angle from mode + double lambdaMode() const { return M_PI / 2 - momentumMode_.theta(); } + /// momentum vector magnitude from mode + double pMode() const { return momentumMode_.R(); } + /// track transverse momentum from mode + double ptMode() const { return sqrt(momentumMode_.Perp2()); } + /// x coordinate of momentum vector from mode + double pxMode() const { return momentumMode_.x(); } + /// y coordinate of momentum vector from mode + double pyMode() const { return momentumMode_.y(); } + /// z coordinate of momentum vector from mode + double pzMode() const { return momentumMode_.z(); } + /// azimuthal angle of momentum vector from mode + double phiMode() const { return momentumMode_.Phi(); } + /// pseudorapidity of momentum vector from mode + double etaMode() const { return momentumMode_.Eta(); } - /// track momentum vector from mode - const Vector& momentumMode() const { return momentumMode_; } + /// track momentum vector from mode + const Vector& momentumMode() const { return momentumMode_; } - /// Track parameters with one-to-one correspondence to the covariance matrix from mode - ParameterVectorMode parametersMode() const { return ParameterVectorMode(qoverpMode(), lambdaMode(), phiMode()); } - /// return track covariance matrix from mode - CovarianceMatrixMode covarianceMode() const { - CovarianceMatrixMode m; - fill(m); - return m; - } + /// Track parameters with one-to-one correspondence to the covariance matrix from mode + ParameterVectorMode parametersMode() const { return ParameterVectorMode(qoverpMode(), lambdaMode(), phiMode()); } + /// return track covariance matrix from mode + CovarianceMatrixMode covarianceMode() const { + CovarianceMatrixMode m; + fill(m); + return m; + } - /// i-th parameter ( i = 0, ... 2 ) from mode - double parameterMode(int i) const { return parametersMode()[i]; } - /// (i,j)-th element of covarianve matrix ( i, j = 0, ... 2 ) from mode - double covarianceMode(int i, int j) const { return covarianceMode_[covIndex(i, j)]; } - /// error on specified element from mode - double errorMode(int i) const { return sqrt(covarianceMode_[covIndex(i, i)]); } + /// i-th parameter ( i = 0, ... 2 ) from mode + double parameterMode(int i) const { return parametersMode()[i]; } + /// (i,j)-th element of covarianve matrix ( i, j = 0, ... 2 ) from mode + double covarianceMode(int i, int j) const { return covarianceMode_[covIndex(i, j)]; } + /// error on specified element from mode + double errorMode(int i) const { return sqrt(covarianceMode_[covIndex(i, i)]); } - /// error on signed transverse curvature from mode - double qoverpModeError() const { return errorMode(i_qoverp); } - /// error on Pt (set to 1000 TeV if charge==0 for safety) from mode - double ptModeError() const { - return (chargeMode() != 0) - ? sqrt(ptMode() * ptMode() * pMode() * pMode() / chargeMode() / chargeMode() * - covarianceMode(i_qoverp, i_qoverp) + - 2 * ptMode() * pMode() / chargeMode() * pzMode() * covarianceMode(i_qoverp, i_lambda) + - pzMode() * pzMode() * covarianceMode(i_lambda, i_lambda)) - : 1.e6; - } - /// error on theta from mode - double thetaModeError() const { return errorMode(i_lambda); } - /// error on lambda from mode - double lambdaModeError() const { return errorMode(i_lambda); } - /// error on eta from mode - double etaModeError() const { return errorMode(i_lambda) * pMode() / ptMode(); } - /// error on phi from mode - double phiModeError() const { return errorMode(i_phi); } + /// error on signed transverse curvature from mode + double qoverpModeError() const { return errorMode(i_qoverp); } + /// error on Pt (set to 1000 TeV if charge==0 for safety) from mode + double ptModeError() const { + return (chargeMode() != 0) + ? sqrt(ptMode() * ptMode() * pMode() * pMode() / chargeMode() / chargeMode() * + covarianceMode(i_qoverp, i_qoverp) + + 2 * ptMode() * pMode() / chargeMode() * pzMode() * covarianceMode(i_qoverp, i_lambda) + + pzMode() * pzMode() * covarianceMode(i_lambda, i_lambda)) + : 1.e6; + } + /// error on theta from mode + double thetaModeError() const { return errorMode(i_lambda); } + /// error on lambda from mode + double lambdaModeError() const { return errorMode(i_lambda); } + /// error on eta from mode + double etaModeError() const { return errorMode(i_lambda) * pMode() / ptMode(); } + /// error on phi from mode + double phiModeError() const { return errorMode(i_phi); } - private: - /// fill 3x3 SMatrix - CovarianceMatrixMode& fill CMS_THREAD_SAFE(CovarianceMatrixMode& v) const; + private: + /// fill 3x3 SMatrix + CovarianceMatrixMode& fill CMS_THREAD_SAFE(CovarianceMatrixMode& v) const; - private: - /// reference to GSF "extra" extension - GsfTrackExtraRef gsfExtra_; - /// electric charge from mode - char chargeMode_; - /// momentum vector from mode - Vector momentumMode_; - /// 3x3 momentum part of covariance (in q/p, lambda, phi) - float covarianceMode_[covarianceSizeMode]; - }; + private: + /// reference to GSF "extra" extension + GsfTrackExtraRef gsfExtra_; + /// electric charge from mode + char chargeMode_; + /// momentum vector from mode + Vector momentumMode_; + /// 3x3 momentum part of covariance (in q/p, lambda, phi) + float covarianceMode_[covarianceSizeMode]; + }; + + } // namespace io_v1 + using GsfTrack = io_v1::GsfTrack; } // namespace reco diff --git a/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h b/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h index 008e39284fc8b..647924a4547b7 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h @@ -13,74 +13,78 @@ #include namespace reco { - class GsfTrackExtra { - public: - /// parameter dimension - enum { dimension = 5 }; - /// local parameter vector - typedef math::Vector::type LocalParameterVector; - /// local covariance matrix - typedef math::Error::type LocalCovarianceMatrix; - /// point in the space - typedef math::XYZPoint Point; - /// spatial vector - typedef math::XYZVector Vector; + namespace io_v1 { + class GsfTrackExtra { + public: + /// parameter dimension + enum { dimension = 5 }; + /// local parameter vector + typedef math::Vector::type LocalParameterVector; + /// local covariance matrix + typedef math::Error::type LocalCovarianceMatrix; + /// point in the space + typedef math::XYZPoint Point; + /// spatial vector + typedef math::XYZVector Vector; - /// default constructor - GsfTrackExtra() {} - /// constructor from outermost position and momentum - GsfTrackExtra(const std::vector& outerStates, - const double& outerLocalPzSign, - const std::vector& innerStates, - const double& innerLocalPzSign, - const std::vector& tangents); - /// sign of local P_z at outermost state - double outerStateLocalPzSign() const { return positiveOuterStatePz_ ? 1. : -1.; } - /// weights at outermost state - std::vector outerStateWeights() const { return weights(outerStates_); } - /// local parameters at outermost state - std::vector outerStateLocalParameters() const { return parameters(outerStates_); } - /// local covariance matrices at outermost state - std::vector outerStateCovariances() const { return covariances(outerStates_); } - /// sign of local P_z at innermost state - double innerStateLocalPzSign() const { return positiveInnerStatePz_ ? 1. : -1.; } - /// weights at innermost state - std::vector innerStateWeights() const { return weights(innerStates_); } - /// local parameters at innermost state - std::vector innerStateLocalParameters() const { return parameters(innerStates_); } - /// local covariance matrices at innermost state - std::vector innerStateCovariances() const { return covariances(innerStates_); } - /// number of objects with information for tangents to the electron track - inline unsigned int tangentsSize() const { return tangents_.size(); } - /// access to tangent information - const std::vector& tangents() const { return tangents_; } - /// global position for tangent - const Point& tangentPosition(unsigned int index) const { return tangents_[index].position(); } - /// global momentum for tangent - const Vector& tangentMomentum(unsigned int index) const { return tangents_[index].momentum(); } - /// deltaP for tangent - Measurement1D tangentDeltaP(unsigned int index) const { return tangents_[index].deltaP(); } + /// default constructor + GsfTrackExtra() {} + /// constructor from outermost position and momentum + GsfTrackExtra(const std::vector& outerStates, + const double& outerLocalPzSign, + const std::vector& innerStates, + const double& innerLocalPzSign, + const std::vector& tangents); + /// sign of local P_z at outermost state + double outerStateLocalPzSign() const { return positiveOuterStatePz_ ? 1. : -1.; } + /// weights at outermost state + std::vector outerStateWeights() const { return weights(outerStates_); } + /// local parameters at outermost state + std::vector outerStateLocalParameters() const { return parameters(outerStates_); } + /// local covariance matrices at outermost state + std::vector outerStateCovariances() const { return covariances(outerStates_); } + /// sign of local P_z at innermost state + double innerStateLocalPzSign() const { return positiveInnerStatePz_ ? 1. : -1.; } + /// weights at innermost state + std::vector innerStateWeights() const { return weights(innerStates_); } + /// local parameters at innermost state + std::vector innerStateLocalParameters() const { return parameters(innerStates_); } + /// local covariance matrices at innermost state + std::vector innerStateCovariances() const { return covariances(innerStates_); } + /// number of objects with information for tangents to the electron track + inline unsigned int tangentsSize() const { return tangents_.size(); } + /// access to tangent information + const std::vector& tangents() const { return tangents_; } + /// global position for tangent + const Point& tangentPosition(unsigned int index) const { return tangents_[index].position(); } + /// global momentum for tangent + const Vector& tangentMomentum(unsigned int index) const { return tangents_[index].momentum(); } + /// deltaP for tangent + Measurement1D tangentDeltaP(unsigned int index) const { return tangents_[index].deltaP(); } - private: - /// extract weights from states - std::vector weights(const std::vector& states) const; - /// extract parameters from states - std::vector parameters(const std::vector& states) const; - /// extract covariance matrices from states - std::vector covariances(const std::vector& states) const; + private: + /// extract weights from states + std::vector weights(const std::vector& states) const; + /// extract parameters from states + std::vector parameters(const std::vector& states) const; + /// extract covariance matrices from states + std::vector covariances(const std::vector& states) const; - private: - /// states at outermost point - std::vector outerStates_; - /// positive sign of P_z(local) at outermost State? - bool positiveOuterStatePz_; - /// states at innermost point - std::vector innerStates_; - /// positive sign of P_z(local) at innermost State? - bool positiveInnerStatePz_; - /// information for tangents - std::vector tangents_; - }; + private: + /// states at outermost point + std::vector outerStates_; + /// positive sign of P_z(local) at outermost State? + bool positiveOuterStatePz_; + /// states at innermost point + std::vector innerStates_; + /// positive sign of P_z(local) at innermost State? + bool positiveInnerStatePz_; + /// information for tangents + std::vector tangents_; + }; + + } // namespace io_v1 + using GsfTrackExtra = io_v1::GsfTrackExtra; } // namespace reco diff --git a/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h b/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h index 4dc2d7e4d06ef..385ed923becfd 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class GsfTrackExtra; + namespace io_v1 { + class GsfTrackExtra; + } + using GsfTrackExtra = io_v1::GsfTrackExtra; /// collection of GsfTrackExtra objects typedef std::vector GsfTrackExtraCollection; /// persistent reference to a GsfTrackExtra diff --git a/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h b/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h index 3256ad0c3a5a2..19b4a3f2ef0eb 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class GsfTrack; + namespace io_v1 { + class GsfTrack; + } + using GsfTrack = io_v1::GsfTrack; /// collection of GsfTracks typedef std::vector GsfTrackCollection; /// persistent reference to a GsfTrack diff --git a/DataFormats/GsfTrackReco/src/classes_def.xml b/DataFormats/GsfTrackReco/src/classes_def.xml index bb3cefefe6e90..3f808b90ad8fa 100644 --- a/DataFormats/GsfTrackReco/src/classes_def.xml +++ b/DataFormats/GsfTrackReco/src/classes_def.xml @@ -15,39 +15,39 @@ - - + + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - + - + - - - + + + diff --git a/DataFormats/HGCalReco/src/classes_def.xml b/DataFormats/HGCalReco/src/classes_def.xml index 92c3f0cd6a741..f2201a40ca46d 100644 --- a/DataFormats/HGCalReco/src/classes_def.xml +++ b/DataFormats/HGCalReco/src/classes_def.xml @@ -68,7 +68,7 @@ - + diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index a104854bce32d..ae2e7dd188a94 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -27,13 +27,6 @@ - - - - - - - @@ -43,24 +36,11 @@ - - - - - - - - + + - - - - - - - - - + + @@ -81,15 +61,8 @@ - - - - - - - - - + + @@ -104,7 +77,7 @@ - + diff --git a/DataFormats/HcalIsolatedTrack/src/classes_def.xml b/DataFormats/HcalIsolatedTrack/src/classes_def.xml index da1f2e036f1a4..d304711d65c60 100644 --- a/DataFormats/HcalIsolatedTrack/src/classes_def.xml +++ b/DataFormats/HcalIsolatedTrack/src/classes_def.xml @@ -3,39 +3,36 @@ - + - + - - - - - + + - + - + - + diff --git a/DataFormats/HepMCCandidate/interface/GenParticle.h b/DataFormats/HepMCCandidate/interface/GenParticle.h index 935613bc7e0c3..b1c31052c5ea2 100644 --- a/DataFormats/HepMCCandidate/interface/GenParticle.h +++ b/DataFormats/HepMCCandidate/interface/GenParticle.h @@ -17,100 +17,104 @@ namespace HepMC { } namespace reco { - - class GenParticle : public CompositeRefCandidateT { - public: - /// default constructor - GenParticle() {} - /// default constructor - GenParticle(const LeafCandidate &c) : CompositeRefCandidateT(c) {} - /// constrocturo from values - GenParticle(Charge q, const LorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); - /// constrocturo from values - GenParticle(Charge q, const PolarLorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); - /// destructor - ~GenParticle() override; - /// return a clone - GenParticle *clone() const override; - void setCollisionId(int s) { collisionId_ = s; } - int collisionId() const { return collisionId_; } - - const GenStatusFlags &statusFlags() const { return statusFlags_; } - GenStatusFlags &statusFlags() { return statusFlags_; } - - ///////////////////////////////////////////////////////////////////////////// - //basic set of gen status flags accessible directly here - //the rest accessible through statusFlags() - //(see GenStatusFlags.h for their meaning) - - ///////////////////////////////////////////////////////////////////////////// - //these are robust, generator-independent functions for categorizing - //mainly final state particles, but also intermediate hadrons/taus - - //is particle prompt (not from hadron, muon, or tau decay) and final state - bool isPromptFinalState() const { return status() == 1 && statusFlags_.isPrompt(); } - - //is particle prompt (not from hadron, muon, or tau decay) and decayed - //such as a prompt tau - bool isPromptDecayed() const { return statusFlags_.isDecayedLeptonHadron() && statusFlags_.isPrompt(); } - - //this particle is a direct decay product of a prompt tau and is final state - //(eg an electron or muon from a leptonic decay of a prompt tau) - bool isDirectPromptTauDecayProductFinalState() const { - return status() == 1 && statusFlags_.isDirectPromptTauDecayProduct(); - } - - ///////////////////////////////////////////////////////////////////////////// - //these are generator history-dependent functions for tagging particles - //associated with the hard process - //Currently implemented for Pythia 6 and Pythia 8 status codes and history - //and may not have 100% consistent meaning across all types of processes - //Users are strongly encouraged to stick to the more robust flags above, - //as well as the expanded set available in GenStatusFlags.h - - //this particle is part of the hard process - bool isHardProcess() const { return statusFlags_.isHardProcess(); } - - //this particle is the final state direct descendant of a hard process particle - bool fromHardProcessFinalState() const { return status() == 1 && statusFlags_.fromHardProcess(); } - - //this particle is the decayed direct descendant of a hard process particle - //such as a tau from the hard process - bool fromHardProcessDecayed() const { - return statusFlags_.isDecayedLeptonHadron() && statusFlags_.fromHardProcess(); - } - - //this particle is a direct decay product of a hardprocess tau and is final state - //(eg an electron or muon from a leptonic decay of a tau from the hard process) - bool isDirectHardProcessTauDecayProductFinalState() const { - return status() == 1 && statusFlags_.isDirectHardProcessTauDecayProduct(); - } - - //this particle is the direct descendant of a hard process particle of the same pdg id. - //For outgoing particles the kinematics are those before QCD or QED FSR - //This corresponds roughly to status code 3 in pythia 6 - //This is the most complex and error prone of all the flags and you are strongly encouraged - //to consider using the others to fill your needs. - bool fromHardProcessBeforeFSR() const { return statusFlags_.fromHardProcessBeforeFSR(); } - - //provided for convenience. Use this one if you were using status 3 before and didn't know or care what it exactly meant - bool isMostlyLikePythia6Status3() { return fromHardProcessBeforeFSR(); } - - //this particle is the last copy of the particle in the chain with the same pdg id - //(and therefore is more likely, but not guaranteed, to carry the final physical momentum) - bool isLastCopy() const { return statusFlags_.isLastCopy(); } - - //this particle is the last copy of the particle in the chain with the same pdg id - //before QED or QCD FSR - //(and therefore is more likely, but not guaranteed, to carry the momentum after ISR) - bool isLastCopyBeforeFSR() const { return statusFlags_.isLastCopyBeforeFSR(); } - - private: - /// checp overlap with another candidate - bool overlap(const Candidate &) const override; - int collisionId_; - GenStatusFlags statusFlags_; - }; + namespace io_v1 { + + class GenParticle : public CompositeRefCandidateT { + public: + /// default constructor + GenParticle() {} + /// default constructor + GenParticle(const LeafCandidate &c) : CompositeRefCandidateT(c) {} + /// constrocturo from values + GenParticle(Charge q, const LorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); + /// constrocturo from values + GenParticle(Charge q, const PolarLorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); + /// destructor + ~GenParticle() override; + /// return a clone + GenParticle *clone() const override; + void setCollisionId(int s) { collisionId_ = s; } + int collisionId() const { return collisionId_; } + + const GenStatusFlags &statusFlags() const { return statusFlags_; } + GenStatusFlags &statusFlags() { return statusFlags_; } + + ///////////////////////////////////////////////////////////////////////////// + //basic set of gen status flags accessible directly here + //the rest accessible through statusFlags() + //(see GenStatusFlags.h for their meaning) + + ///////////////////////////////////////////////////////////////////////////// + //these are robust, generator-independent functions for categorizing + //mainly final state particles, but also intermediate hadrons/taus + + //is particle prompt (not from hadron, muon, or tau decay) and final state + bool isPromptFinalState() const { return status() == 1 && statusFlags_.isPrompt(); } + + //is particle prompt (not from hadron, muon, or tau decay) and decayed + //such as a prompt tau + bool isPromptDecayed() const { return statusFlags_.isDecayedLeptonHadron() && statusFlags_.isPrompt(); } + + //this particle is a direct decay product of a prompt tau and is final state + //(eg an electron or muon from a leptonic decay of a prompt tau) + bool isDirectPromptTauDecayProductFinalState() const { + return status() == 1 && statusFlags_.isDirectPromptTauDecayProduct(); + } + + ///////////////////////////////////////////////////////////////////////////// + //these are generator history-dependent functions for tagging particles + //associated with the hard process + //Currently implemented for Pythia 6 and Pythia 8 status codes and history + //and may not have 100% consistent meaning across all types of processes + //Users are strongly encouraged to stick to the more robust flags above, + //as well as the expanded set available in GenStatusFlags.h + + //this particle is part of the hard process + bool isHardProcess() const { return statusFlags_.isHardProcess(); } + + //this particle is the final state direct descendant of a hard process particle + bool fromHardProcessFinalState() const { return status() == 1 && statusFlags_.fromHardProcess(); } + + //this particle is the decayed direct descendant of a hard process particle + //such as a tau from the hard process + bool fromHardProcessDecayed() const { + return statusFlags_.isDecayedLeptonHadron() && statusFlags_.fromHardProcess(); + } + + //this particle is a direct decay product of a hardprocess tau and is final state + //(eg an electron or muon from a leptonic decay of a tau from the hard process) + bool isDirectHardProcessTauDecayProductFinalState() const { + return status() == 1 && statusFlags_.isDirectHardProcessTauDecayProduct(); + } + + //this particle is the direct descendant of a hard process particle of the same pdg id. + //For outgoing particles the kinematics are those before QCD or QED FSR + //This corresponds roughly to status code 3 in pythia 6 + //This is the most complex and error prone of all the flags and you are strongly encouraged + //to consider using the others to fill your needs. + bool fromHardProcessBeforeFSR() const { return statusFlags_.fromHardProcessBeforeFSR(); } + + //provided for convenience. Use this one if you were using status 3 before and didn't know or care what it exactly meant + bool isMostlyLikePythia6Status3() { return fromHardProcessBeforeFSR(); } + + //this particle is the last copy of the particle in the chain with the same pdg id + //(and therefore is more likely, but not guaranteed, to carry the final physical momentum) + bool isLastCopy() const { return statusFlags_.isLastCopy(); } + + //this particle is the last copy of the particle in the chain with the same pdg id + //before QED or QCD FSR + //(and therefore is more likely, but not guaranteed, to carry the momentum after ISR) + bool isLastCopyBeforeFSR() const { return statusFlags_.isLastCopyBeforeFSR(); } + + private: + /// checp overlap with another candidate + bool overlap(const Candidate &) const override; + int collisionId_; + GenStatusFlags statusFlags_; + }; + + } // namespace io_v1 + using GenParticle = io_v1::GenParticle; } // namespace reco diff --git a/DataFormats/HepMCCandidate/interface/GenParticleFwd.h b/DataFormats/HepMCCandidate/interface/GenParticleFwd.h index a44654967c4d2..c518b4ac55a20 100644 --- a/DataFormats/HepMCCandidate/interface/GenParticleFwd.h +++ b/DataFormats/HepMCCandidate/interface/GenParticleFwd.h @@ -10,7 +10,10 @@ #include "DataFormats/Common/interface/Association.h" namespace reco { - class GenParticle; + namespace io_v1 { + class GenParticle; + } + using GenParticle = io_v1::GenParticle; /// collection of GenParticles typedef std::vector GenParticleCollection; /// persistent reference to a GenParticle diff --git a/DataFormats/HepMCCandidate/src/classes_def.xml b/DataFormats/HepMCCandidate/src/classes_def.xml index e92bdd7cbc224..3c27ed72152d4 100644 --- a/DataFormats/HepMCCandidate/src/classes_def.xml +++ b/DataFormats/HepMCCandidate/src/classes_def.xml @@ -1,15 +1,12 @@ - - - - - + + - - - - + + + + @@ -18,13 +15,13 @@ - - - - - + + + + + - + @@ -33,10 +30,8 @@ - - - - + + @@ -51,9 +46,9 @@ - - - + + + diff --git a/DataFormats/JetMatching/src/classes_def.xml b/DataFormats/JetMatching/src/classes_def.xml index 569e9d760bc65..ba42d813822a0 100755 --- a/DataFormats/JetMatching/src/classes_def.xml +++ b/DataFormats/JetMatching/src/classes_def.xml @@ -1,16 +1,15 @@ - - + + - - + + - - - + + @@ -26,14 +25,13 @@ - - + + - - - + + @@ -42,18 +40,17 @@ - - + + - - + + - - - + + diff --git a/DataFormats/JetReco/interface/BasicJet.h b/DataFormats/JetReco/interface/BasicJet.h index 2ab1de643879a..a490a6adda360 100644 --- a/DataFormats/JetReco/interface/BasicJet.h +++ b/DataFormats/JetReco/interface/BasicJet.h @@ -16,27 +16,30 @@ #include "DataFormats/JetReco/interface/Jet.h" namespace reco { - class BasicJet : public Jet { - public: - /** Default constructor*/ - BasicJet() {} - - /** Constructor from values*/ - BasicJet(const LorentzVector& fP4, const Point& fVertex); - BasicJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); - - ~BasicJet() override {} - - /// Polymorphic clone - BasicJet* clone() const override; - - /// Print object - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - }; + namespace io_v1 { + class BasicJet : public Jet { + public: + /** Default constructor*/ + BasicJet() {} + + /** Constructor from values*/ + BasicJet(const LorentzVector& fP4, const Point& fVertex); + BasicJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); + + ~BasicJet() override {} + + /// Polymorphic clone + BasicJet* clone() const override; + + /// Print object + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + }; + } // namespace io_v1 + using BasicJet = io_v1::BasicJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/BasicJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/CaloJet.h b/DataFormats/JetReco/interface/CaloJet.h index 9445f205ce8b7..b211573133db5 100644 --- a/DataFormats/JetReco/interface/CaloJet.h +++ b/DataFormats/JetReco/interface/CaloJet.h @@ -24,140 +24,143 @@ #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" namespace reco { - class CaloJet : public Jet { - public: - typedef CaloTowerPtr ConstituentTypePtr; - typedef CaloTowerFwdPtr ConstituentTypeFwdPtr; - - struct Specific { - Specific() - : mMaxEInEmTowers(0), - mMaxEInHadTowers(0), - mHadEnergyInHO(0), - mHadEnergyInHB(0), - mHadEnergyInHF(0), - mHadEnergyInHE(0), - mEmEnergyInEB(0), - mEmEnergyInEE(0), - mEmEnergyInHF(0), - mEnergyFractionHadronic(0), - mEnergyFractionEm(0), - mTowersArea(0) {} - - /// Maximum energy in EM towers - float mMaxEInEmTowers; - /// Maximum energy in HCAL towers - float mMaxEInHadTowers; - /// Hadronic nergy fraction in HO - float mHadEnergyInHO; - /// Hadronic energy in HB - float mHadEnergyInHB; - /// Hadronic energy in HF - float mHadEnergyInHF; - /// Hadronic energy in HE - float mHadEnergyInHE; - /// Em energy in EB - float mEmEnergyInEB; - /// Em energy in EE - float mEmEnergyInEE; - /// Em energy in HF - float mEmEnergyInHF; - /// Hadronic energy fraction - float mEnergyFractionHadronic; - /// Em energy fraction - float mEnergyFractionEm; - /// Area of contributing CaloTowers - float mTowersArea; + namespace io_v1 { + class CaloJet : public Jet { + public: + typedef CaloTowerPtr ConstituentTypePtr; + typedef CaloTowerFwdPtr ConstituentTypeFwdPtr; + + struct Specific { + Specific() + : mMaxEInEmTowers(0), + mMaxEInHadTowers(0), + mHadEnergyInHO(0), + mHadEnergyInHB(0), + mHadEnergyInHF(0), + mHadEnergyInHE(0), + mEmEnergyInEB(0), + mEmEnergyInEE(0), + mEmEnergyInHF(0), + mEnergyFractionHadronic(0), + mEnergyFractionEm(0), + mTowersArea(0) {} + + /// Maximum energy in EM towers + float mMaxEInEmTowers; + /// Maximum energy in HCAL towers + float mMaxEInHadTowers; + /// Hadronic nergy fraction in HO + float mHadEnergyInHO; + /// Hadronic energy in HB + float mHadEnergyInHB; + /// Hadronic energy in HF + float mHadEnergyInHF; + /// Hadronic energy in HE + float mHadEnergyInHE; + /// Em energy in EB + float mEmEnergyInEB; + /// Em energy in EE + float mEmEnergyInEE; + /// Em energy in HF + float mEmEnergyInHF; + /// Hadronic energy fraction + float mEnergyFractionHadronic; + /// Em energy fraction + float mEnergyFractionEm; + /// Area of contributing CaloTowers + float mTowersArea; + }; + + /** Default constructor*/ + CaloJet() {} + + /** Constructor from values*/ + CaloJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + + /** Constructor from values*/ + CaloJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); + + /** backward compatible, vertex=(0,0,0) */ + CaloJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~CaloJet() override {} + + /** Returns the maximum energy deposited in ECAL towers*/ + float maxEInEmTowers() const { return m_specific.mMaxEInEmTowers; } + /** Returns the maximum energy deposited in HCAL towers*/ + float maxEInHadTowers() const { return m_specific.mMaxEInHadTowers; } + /** Returns the jet hadronic energy fraction*/ + float energyFractionHadronic() const { return m_specific.mEnergyFractionHadronic; } + /** Returns the jet electromagnetic energy fraction*/ + float emEnergyFraction() const { return m_specific.mEnergyFractionEm; } + /** Returns the jet hadronic energy in HB*/ + float hadEnergyInHB() const { return m_specific.mHadEnergyInHB; } + /** Returns the jet hadronic energy in HO*/ + float hadEnergyInHO() const { return m_specific.mHadEnergyInHO; } + /** Returns the jet hadronic energy in HE*/ + float hadEnergyInHE() const { return m_specific.mHadEnergyInHE; } + /** Returns the jet hadronic energy in HF*/ + float hadEnergyInHF() const { return m_specific.mHadEnergyInHF; } + /** Returns the jet electromagnetic energy in EB*/ + float emEnergyInEB() const { return m_specific.mEmEnergyInEB; } + /** Returns the jet electromagnetic energy in EE*/ + float emEnergyInEE() const { return m_specific.mEmEnergyInEE; } + /** Returns the jet electromagnetic energy extracted from HF*/ + float emEnergyInHF() const { return m_specific.mEmEnergyInHF; } + /** Returns area of contributing towers */ + float towersArea() const { return m_specific.mTowersArea; } + /** Returns the number of constituents carrying a 90% of the total Jet energy*/ + int n90() const { return nCarrying(0.9); } + /** Returns the number of constituents carrying a 60% of the total Jet energy*/ + int n60() const { return nCarrying(0.6); } + + /// Physics Eta (use jet Z and kinematics only) + // float physicsEtaQuick (float fZVertex) const; + /// Physics Eta (use jet Z and kinematics only) + //float physicsEta (float fZVertex) const {return physicsEtaQuick (fZVertex);} + /// Physics p4 (use jet Z and kinematics only) + //LorentzVector physicsP4 (float fZVertex) const; + /// Physics p4 for full 3d vertex corretion + LorentzVector physicsP4(const Particle::Point& vertex) const; + /// detector p4 for full 3d vertex correction. + LorentzVector detectorP4() const; + + /// Physics Eta (loop over constituents) + //float physicsEtaDetailed (float fZVertex) const; + + /// Detector Eta (default for CaloJets) + //float detectorEta () const {return eta();} + + /// get specific constituent + virtual CaloTowerPtr getCaloConstituent(unsigned fIndex) const; + /// get all constituents + virtual std::vector getCaloConstituents() const; + + // block accessors + + const Specific& getSpecific() const { return m_specific; } + + /// Polymorphic clone + CaloJet* clone() const override; + + /// Print object + std::string print() const override; + + /// CaloTowers indexes + std::vector getTowerIndices() const; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + //Variables specific to to the CaloJet class + Specific m_specific; }; - - /** Default constructor*/ - CaloJet() {} - - /** Constructor from values*/ - CaloJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - - /** Constructor from values*/ - CaloJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); - - /** backward compatible, vertex=(0,0,0) */ - CaloJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~CaloJet() override {} - - /** Returns the maximum energy deposited in ECAL towers*/ - float maxEInEmTowers() const { return m_specific.mMaxEInEmTowers; } - /** Returns the maximum energy deposited in HCAL towers*/ - float maxEInHadTowers() const { return m_specific.mMaxEInHadTowers; } - /** Returns the jet hadronic energy fraction*/ - float energyFractionHadronic() const { return m_specific.mEnergyFractionHadronic; } - /** Returns the jet electromagnetic energy fraction*/ - float emEnergyFraction() const { return m_specific.mEnergyFractionEm; } - /** Returns the jet hadronic energy in HB*/ - float hadEnergyInHB() const { return m_specific.mHadEnergyInHB; } - /** Returns the jet hadronic energy in HO*/ - float hadEnergyInHO() const { return m_specific.mHadEnergyInHO; } - /** Returns the jet hadronic energy in HE*/ - float hadEnergyInHE() const { return m_specific.mHadEnergyInHE; } - /** Returns the jet hadronic energy in HF*/ - float hadEnergyInHF() const { return m_specific.mHadEnergyInHF; } - /** Returns the jet electromagnetic energy in EB*/ - float emEnergyInEB() const { return m_specific.mEmEnergyInEB; } - /** Returns the jet electromagnetic energy in EE*/ - float emEnergyInEE() const { return m_specific.mEmEnergyInEE; } - /** Returns the jet electromagnetic energy extracted from HF*/ - float emEnergyInHF() const { return m_specific.mEmEnergyInHF; } - /** Returns area of contributing towers */ - float towersArea() const { return m_specific.mTowersArea; } - /** Returns the number of constituents carrying a 90% of the total Jet energy*/ - int n90() const { return nCarrying(0.9); } - /** Returns the number of constituents carrying a 60% of the total Jet energy*/ - int n60() const { return nCarrying(0.6); } - - /// Physics Eta (use jet Z and kinematics only) - // float physicsEtaQuick (float fZVertex) const; - /// Physics Eta (use jet Z and kinematics only) - //float physicsEta (float fZVertex) const {return physicsEtaQuick (fZVertex);} - /// Physics p4 (use jet Z and kinematics only) - //LorentzVector physicsP4 (float fZVertex) const; - /// Physics p4 for full 3d vertex corretion - LorentzVector physicsP4(const Particle::Point& vertex) const; - /// detector p4 for full 3d vertex correction. - LorentzVector detectorP4() const; - - /// Physics Eta (loop over constituents) - //float physicsEtaDetailed (float fZVertex) const; - - /// Detector Eta (default for CaloJets) - //float detectorEta () const {return eta();} - - /// get specific constituent - virtual CaloTowerPtr getCaloConstituent(unsigned fIndex) const; - /// get all constituents - virtual std::vector getCaloConstituents() const; - - // block accessors - - const Specific& getSpecific() const { return m_specific; } - - /// Polymorphic clone - CaloJet* clone() const override; - - /// Print object - std::string print() const override; - - /// CaloTowers indexes - std::vector getTowerIndices() const; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - //Variables specific to to the CaloJet class - Specific m_specific; - }; + } // namespace io_v1 + using CaloJet = io_v1::CaloJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/CaloJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/CaloJetFwd.h b/DataFormats/JetReco/interface/CaloJetFwd.h index e242d3de59a04..264229e15a4e2 100644 --- a/DataFormats/JetReco/interface/CaloJetFwd.h +++ b/DataFormats/JetReco/interface/CaloJetFwd.h @@ -1,7 +1,10 @@ #ifndef DataFormats_JetReco_CaloJetFwd_h #define DataFormats_JetReco_CaloJetFwd_h namespace reco { - class CaloJet; -} + namespace io_v1 { + class CaloJet; + } + using CaloJet = io_v1::CaloJet; +} // namespace reco #endif diff --git a/DataFormats/JetReco/interface/GenJet.h b/DataFormats/JetReco/interface/GenJet.h index 24fd9609a30f6..d362f89f96925 100644 --- a/DataFormats/JetReco/interface/GenJet.h +++ b/DataFormats/JetReco/interface/GenJet.h @@ -16,124 +16,126 @@ ************************************************************/ #include "DataFormats/JetReco/interface/Jet.h" +#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" namespace reco { - class GenParticle; - - class GenJet : public Jet { - public: - struct Specific { - Specific() - : m_EmEnergy(0), - m_HadEnergy(0), - m_InvisibleEnergy(0), - m_AuxiliaryEnergy(0), - m_ChargedHadronEnergy(0), - m_NeutralHadronEnergy(0), - m_ChargedEmEnergy(0), - m_NeutralEmEnergy(0), - m_MuonEnergy(0), - m_ChargedHadronMultiplicity(0), - m_NeutralHadronMultiplicity(0), - m_ChargedEmMultiplicity(0), - m_NeutralEmMultiplicity(0), - m_MuonMultiplicity(0) {} - - /// Calo-like definitions: - /// Energy of EM particles - float m_EmEnergy; - /// Energy of Hadrons - float m_HadEnergy; - /// Invisible energy (mu, nu, ...) - float m_InvisibleEnergy; - /// Anything else (undecayed Sigmas etc.) - float m_AuxiliaryEnergy; - - /// PF-like definitions: - /// pi+, K+, etc - float m_ChargedHadronEnergy; - /// K0, etc - float m_NeutralHadronEnergy; - /// Electrons - float m_ChargedEmEnergy; - /// Photons - float m_NeutralEmEnergy; - /// Muons - float m_MuonEnergy; - /// Corresponding multiplicities: - int m_ChargedHadronMultiplicity; - int m_NeutralHadronMultiplicity; - int m_ChargedEmMultiplicity; - int m_NeutralEmMultiplicity; - int m_MuonMultiplicity; + namespace io_v1 { + class GenJet : public Jet { + public: + struct Specific { + Specific() + : m_EmEnergy(0), + m_HadEnergy(0), + m_InvisibleEnergy(0), + m_AuxiliaryEnergy(0), + m_ChargedHadronEnergy(0), + m_NeutralHadronEnergy(0), + m_ChargedEmEnergy(0), + m_NeutralEmEnergy(0), + m_MuonEnergy(0), + m_ChargedHadronMultiplicity(0), + m_NeutralHadronMultiplicity(0), + m_ChargedEmMultiplicity(0), + m_NeutralEmMultiplicity(0), + m_MuonMultiplicity(0) {} + + /// Calo-like definitions: + /// Energy of EM particles + float m_EmEnergy; + /// Energy of Hadrons + float m_HadEnergy; + /// Invisible energy (mu, nu, ...) + float m_InvisibleEnergy; + /// Anything else (undecayed Sigmas etc.) + float m_AuxiliaryEnergy; + + /// PF-like definitions: + /// pi+, K+, etc + float m_ChargedHadronEnergy; + /// K0, etc + float m_NeutralHadronEnergy; + /// Electrons + float m_ChargedEmEnergy; + /// Photons + float m_NeutralEmEnergy; + /// Muons + float m_MuonEnergy; + /// Corresponding multiplicities: + int m_ChargedHadronMultiplicity; + int m_NeutralHadronMultiplicity; + int m_ChargedEmMultiplicity; + int m_NeutralEmMultiplicity; + int m_MuonMultiplicity; + }; + + /** Default constructor*/ + GenJet() {} + + /** Constructor from values*/ + GenJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + GenJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); + + /** backward compatible, vertex=(0,0,0) */ + GenJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~GenJet() override {} + /** Returns energy of electromagnetic particles*/ + float emEnergy() const { return m_specific.m_EmEnergy; }; + /** Returns energy of hadronic particles*/ + float hadEnergy() const { return m_specific.m_HadEnergy; }; + /** Returns invisible energy*/ + float invisibleEnergy() const { return m_specific.m_InvisibleEnergy; }; + /** Returns other energy (undecayed Sigmas etc.)*/ + float auxiliaryEnergy() const { return m_specific.m_AuxiliaryEnergy; }; + + // PF-like definitions + float chargedHadronEnergy() const { return m_specific.m_ChargedHadronEnergy; } + float neutralHadronEnergy() const { return m_specific.m_NeutralHadronEnergy; } + float chargedEmEnergy() const { return m_specific.m_ChargedEmEnergy; } + float neutralEmEnergy() const { return m_specific.m_NeutralEmEnergy; } + float muonEnergy() const { return m_specific.m_MuonEnergy; } + int chargedHadronMultiplicity() const { return m_specific.m_ChargedHadronMultiplicity; } + int neutralHadronMultiplicity() const { return m_specific.m_NeutralHadronMultiplicity; } + int chargedEmMultiplicity() const { return m_specific.m_ChargedEmMultiplicity; } + int neutralEmMultiplicity() const { return m_specific.m_NeutralEmMultiplicity; } + int muonMultiplicity() const { return m_specific.m_MuonMultiplicity; } + + /// Detector Eta (use reference Z and jet kinematics only) + float detectorEta(float fZVertex) const; + + /// convert generic constituent to specific type + static const GenParticle* genParticle(const reco::Candidate* fConstituent); + /// get specific constituent + virtual const GenParticle* getGenConstituent(unsigned fIndex) const; + /// get all constituents + virtual std::vector getGenConstituents() const; + + // block accessors + + const Specific& getSpecific() const { return m_specific; } + + /// set the specific (note: responsibility of keeping it consistent with the jet daughers belongs to the caller) + void setSpecific(const Specific& spec) { m_specific = spec; } + + /// Polymorphic clone + GenJet* clone() const override; + + /// Print object + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + // Data members + //Variables specific to to the GenJet class + Specific m_specific; }; - - /** Default constructor*/ - GenJet() {} - - /** Constructor from values*/ - GenJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - GenJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); - - /** backward compatible, vertex=(0,0,0) */ - GenJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~GenJet() override {} - /** Returns energy of electromagnetic particles*/ - float emEnergy() const { return m_specific.m_EmEnergy; }; - /** Returns energy of hadronic particles*/ - float hadEnergy() const { return m_specific.m_HadEnergy; }; - /** Returns invisible energy*/ - float invisibleEnergy() const { return m_specific.m_InvisibleEnergy; }; - /** Returns other energy (undecayed Sigmas etc.)*/ - float auxiliaryEnergy() const { return m_specific.m_AuxiliaryEnergy; }; - - // PF-like definitions - float chargedHadronEnergy() const { return m_specific.m_ChargedHadronEnergy; } - float neutralHadronEnergy() const { return m_specific.m_NeutralHadronEnergy; } - float chargedEmEnergy() const { return m_specific.m_ChargedEmEnergy; } - float neutralEmEnergy() const { return m_specific.m_NeutralEmEnergy; } - float muonEnergy() const { return m_specific.m_MuonEnergy; } - int chargedHadronMultiplicity() const { return m_specific.m_ChargedHadronMultiplicity; } - int neutralHadronMultiplicity() const { return m_specific.m_NeutralHadronMultiplicity; } - int chargedEmMultiplicity() const { return m_specific.m_ChargedEmMultiplicity; } - int neutralEmMultiplicity() const { return m_specific.m_NeutralEmMultiplicity; } - int muonMultiplicity() const { return m_specific.m_MuonMultiplicity; } - - /// Detector Eta (use reference Z and jet kinematics only) - float detectorEta(float fZVertex) const; - - /// convert generic constituent to specific type - static const GenParticle* genParticle(const reco::Candidate* fConstituent); - /// get specific constituent - virtual const GenParticle* getGenConstituent(unsigned fIndex) const; - /// get all constituents - virtual std::vector getGenConstituents() const; - - // block accessors - - const Specific& getSpecific() const { return m_specific; } - - /// set the specific (note: responsibility of keeping it consistent with the jet daughers belongs to the caller) - void setSpecific(const Specific& spec) { m_specific = spec; } - - /// Polymorphic clone - GenJet* clone() const override; - - /// Print object - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - // Data members - //Variables specific to to the GenJet class - Specific m_specific; - }; + } // namespace io_v1 + using GenJet = io_v1::GenJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/GenJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/GenJetFwd.h b/DataFormats/JetReco/interface/GenJetFwd.h index b7c18220156bc..b60dc627b8914 100644 --- a/DataFormats/JetReco/interface/GenJetFwd.h +++ b/DataFormats/JetReco/interface/GenJetFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_JetReco_GenJetFwd_h #define DataFormats_JetReco_GenJetFwd_h namespace reco { - class GenJet; -} + namespace io_v1 { + class GenJet; + } + using GenJet = io_v1::GenJet; +} // namespace reco #endif diff --git a/DataFormats/JetReco/interface/JPTJet.h b/DataFormats/JetReco/interface/JPTJet.h index 127c96e6af14a..9a1360954fe59 100644 --- a/DataFormats/JetReco/interface/JPTJet.h +++ b/DataFormats/JetReco/interface/JPTJet.h @@ -25,120 +25,123 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class JPTJet : public Jet { - public: - struct Specific { - Specific() - : mChargedHadronEnergy(0), - mChargedEmEnergy(0), - mResponseOfChargedWithEff(0), - mResponseOfChargedWithoutEff(0), - mSumPtOfChargedWithEff(0), - mSumPtOfChargedWithoutEff(0), - mSumEnergyOfChargedWithEff(0), - mSumEnergyOfChargedWithoutEff(0), - R2momtr(0), - Eta2momtr(0), - Phi2momtr(0), - Pout(0), - Zch(0), - JPTSeed(0) {} - edm::RefToBase theCaloJetRef; - reco::TrackRefVector pionsInVertexInCalo; - reco::TrackRefVector pionsInVertexOutCalo; - reco::TrackRefVector pionsOutVertexInCalo; - reco::TrackRefVector muonsInVertexInCalo; - reco::TrackRefVector muonsInVertexOutCalo; - reco::TrackRefVector muonsOutVertexInCalo; - reco::TrackRefVector elecsInVertexInCalo; - reco::TrackRefVector elecsInVertexOutCalo; - reco::TrackRefVector elecsOutVertexInCalo; - float mChargedHadronEnergy; - float mChargedEmEnergy; - float mResponseOfChargedWithEff; - float mResponseOfChargedWithoutEff; - float mSumPtOfChargedWithEff; - float mSumPtOfChargedWithoutEff; - float mSumEnergyOfChargedWithEff; - float mSumEnergyOfChargedWithoutEff; - float R2momtr; - float Eta2momtr; - float Phi2momtr; - float Pout; - float Zch; - int JPTSeed; + namespace io_v1 { + class JPTJet : public Jet { + public: + struct Specific { + Specific() + : mChargedHadronEnergy(0), + mChargedEmEnergy(0), + mResponseOfChargedWithEff(0), + mResponseOfChargedWithoutEff(0), + mSumPtOfChargedWithEff(0), + mSumPtOfChargedWithoutEff(0), + mSumEnergyOfChargedWithEff(0), + mSumEnergyOfChargedWithoutEff(0), + R2momtr(0), + Eta2momtr(0), + Phi2momtr(0), + Pout(0), + Zch(0), + JPTSeed(0) {} + edm::RefToBase theCaloJetRef; + reco::TrackRefVector pionsInVertexInCalo; + reco::TrackRefVector pionsInVertexOutCalo; + reco::TrackRefVector pionsOutVertexInCalo; + reco::TrackRefVector muonsInVertexInCalo; + reco::TrackRefVector muonsInVertexOutCalo; + reco::TrackRefVector muonsOutVertexInCalo; + reco::TrackRefVector elecsInVertexInCalo; + reco::TrackRefVector elecsInVertexOutCalo; + reco::TrackRefVector elecsOutVertexInCalo; + float mChargedHadronEnergy; + float mChargedEmEnergy; + float mResponseOfChargedWithEff; + float mResponseOfChargedWithoutEff; + float mSumPtOfChargedWithEff; + float mSumPtOfChargedWithoutEff; + float mSumEnergyOfChargedWithEff; + float mSumEnergyOfChargedWithoutEff; + float R2momtr; + float Eta2momtr; + float Phi2momtr; + float Pout; + float Zch; + int JPTSeed; + }; + + /** Default constructor*/ + JPTJet() {} + + /** Constructor from values*/ + JPTJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + + /** backward compatible, vertex=(0,0,0) */ + JPTJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~JPTJet() override {} + /// chargedHadronEnergy + float chargedHadronEnergy() const { return mspecific.mChargedHadronEnergy; } + /// chargedHadronEnergyFraction + float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } + /// chargedEmEnergy + float chargedEmEnergy() const { return mspecific.mChargedEmEnergy; } + /// chargedEmEnergyFraction + float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } + /// chargedMultiplicity + int chargedMultiplicity() const { + return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size() + + mspecific.pionsInVertexInCalo.size() + mspecific.pionsInVertexOutCalo.size() + + mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); + } + /// muonMultiplicity + int muonMultiplicity() const { + return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size(); + } + /// elecMultiplicity + int elecMultiplicity() const { + return mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); + } + /// Tracks + const reco::TrackRefVector& getPionsInVertexInCalo() const { return mspecific.pionsInVertexInCalo; } + const reco::TrackRefVector& getPionsInVertexOutCalo() const { return mspecific.pionsInVertexOutCalo; } + const reco::TrackRefVector& getPionsOutVertexInCalo() const { return mspecific.pionsOutVertexInCalo; } + const reco::TrackRefVector& getMuonsInVertexInCalo() const { return mspecific.muonsInVertexInCalo; } + const reco::TrackRefVector& getMuonsInVertexOutCalo() const { return mspecific.muonsInVertexOutCalo; } + const reco::TrackRefVector& getMuonsOutVertexInCalo() const { return mspecific.muonsOutVertexInCalo; } + const reco::TrackRefVector& getElecsInVertexInCalo() const { return mspecific.elecsInVertexInCalo; } + const reco::TrackRefVector& getElecsInVertexOutCalo() const { return mspecific.elecsInVertexOutCalo; } + const reco::TrackRefVector& getElecsOutVertexInCalo() const { return mspecific.elecsOutVertexInCalo; } + + const edm::RefToBase& getCaloJetRef() const { return mspecific.theCaloJetRef; } + /// block accessors + + const Specific& getSpecific() const { return mspecific; } + + /// Polymorphic clone + JPTJet* clone() const override; + + /// Print object in details + virtual void printJet() const; + + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + //Variables specific to to the JPTJet class + + Specific mspecific; }; - /** Default constructor*/ - JPTJet() {} - - /** Constructor from values*/ - JPTJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - - /** backward compatible, vertex=(0,0,0) */ - JPTJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~JPTJet() override {} - /// chargedHadronEnergy - float chargedHadronEnergy() const { return mspecific.mChargedHadronEnergy; } - /// chargedHadronEnergyFraction - float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } - /// chargedEmEnergy - float chargedEmEnergy() const { return mspecific.mChargedEmEnergy; } - /// chargedEmEnergyFraction - float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } - /// chargedMultiplicity - int chargedMultiplicity() const { - return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size() + - mspecific.pionsInVertexInCalo.size() + mspecific.pionsInVertexOutCalo.size() + - mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); - } - /// muonMultiplicity - int muonMultiplicity() const { - return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size(); - } - /// elecMultiplicity - int elecMultiplicity() const { - return mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); - } - /// Tracks - const reco::TrackRefVector& getPionsInVertexInCalo() const { return mspecific.pionsInVertexInCalo; } - const reco::TrackRefVector& getPionsInVertexOutCalo() const { return mspecific.pionsInVertexOutCalo; } - const reco::TrackRefVector& getPionsOutVertexInCalo() const { return mspecific.pionsOutVertexInCalo; } - const reco::TrackRefVector& getMuonsInVertexInCalo() const { return mspecific.muonsInVertexInCalo; } - const reco::TrackRefVector& getMuonsInVertexOutCalo() const { return mspecific.muonsInVertexOutCalo; } - const reco::TrackRefVector& getMuonsOutVertexInCalo() const { return mspecific.muonsOutVertexInCalo; } - const reco::TrackRefVector& getElecsInVertexInCalo() const { return mspecific.elecsInVertexInCalo; } - const reco::TrackRefVector& getElecsInVertexOutCalo() const { return mspecific.elecsInVertexOutCalo; } - const reco::TrackRefVector& getElecsOutVertexInCalo() const { return mspecific.elecsOutVertexInCalo; } - - const edm::RefToBase& getCaloJetRef() const { return mspecific.theCaloJetRef; } - /// block accessors - - const Specific& getSpecific() const { return mspecific; } - - /// Polymorphic clone - JPTJet* clone() const override; - - /// Print object in details - virtual void printJet() const; - - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - //Variables specific to to the JPTJet class - - Specific mspecific; - }; - - // streamer - //std::ostream& operator<<(std::ostream& out, const reco::JPTJet& jet); + // streamer + //std::ostream& operator<<(std::ostream& out, const reco::JPTJet& jet); + } // namespace io_v1 + using JPTJet = io_v1::JPTJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/JPTJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/Jet.h b/DataFormats/JetReco/interface/Jet.h index 56081b3dcc756..8a1ab3ac8092b 100644 --- a/DataFormats/JetReco/interface/Jet.h +++ b/DataFormats/JetReco/interface/Jet.h @@ -17,113 +17,116 @@ #include "DataFormats/Candidate/interface/CompositePtrCandidate.h" namespace reco { - class Jet : public CompositePtrCandidate { - public: - typedef edm::Ptr Constituent; - typedef std::vector Constituents; - - /// record to store eta-phi first and second moments - class EtaPhiMoments { + namespace io_v1 { + class Jet : public CompositePtrCandidate { public: - float etaMean; - float phiMean; - float etaEtaMoment; - float phiPhiMoment; - float etaPhiMoment; - }; + typedef edm::Ptr Constituent; + typedef std::vector Constituents; - /// Default constructor - Jet() : mJetArea(0), mPileupEnergy(0), mPassNumber(0), mIsWeighted(false) {} - /// Initiator - Jet(const LorentzVector& fP4, const Point& fVertex); - Jet(const LorentzVector& fP4, const Point& fVertex, const Constituents& fConstituents); - /// Destructor - ~Jet() override {} + /// record to store eta-phi first and second moments + class EtaPhiMoments { + public: + float etaMean; + float phiMean; + float etaEtaMoment; + float phiPhiMoment; + float etaPhiMoment; + }; - /// eta-phi statistics, ET weighted - EtaPhiMoments etaPhiStatistics() const; + /// Default constructor + Jet() : mJetArea(0), mPileupEnergy(0), mPassNumber(0), mIsWeighted(false) {} + /// Initiator + Jet(const LorentzVector& fP4, const Point& fVertex); + Jet(const LorentzVector& fP4, const Point& fVertex, const Constituents& fConstituents); + /// Destructor + ~Jet() override {} - /// eta-eta second moment, ET weighted - float etaetaMoment() const; + /// eta-phi statistics, ET weighted + EtaPhiMoments etaPhiStatistics() const; - /// phi-phi second moment, ET weighted - float phiphiMoment() const; + /// eta-eta second moment, ET weighted + float etaetaMoment() const; - /// eta-phi second moment, ET weighted - float etaphiMoment() const; + /// phi-phi second moment, ET weighted + float phiphiMoment() const; - /// ET in annulus between rmin and rmax around jet direction - float etInAnnulus(float fRmin, float fRmax) const; + /// eta-phi second moment, ET weighted + float etaphiMoment() const; - /// return # of constituent carrying fraction of energy - int nCarrying(float fFraction) const; + /// ET in annulus between rmin and rmax around jet direction + float etInAnnulus(float fRmin, float fRmax) const; - /// maximum distance from jet to constituent - float maxDistance() const; + /// return # of constituent carrying fraction of energy + int nCarrying(float fFraction) const; - /// # of constituents - virtual int nConstituents() const { return numberOfDaughters(); } + /// maximum distance from jet to constituent + float maxDistance() const; - /// static function to convert detector eta to physics eta - static float physicsEta(float fZVertex, float fDetectorEta); + /// # of constituents + virtual int nConstituents() const { return numberOfDaughters(); } - /// static function to convert physics eta to detector eta - static float detectorEta(float fZVertex, float fPhysicsEta); + /// static function to convert detector eta to physics eta + static float physicsEta(float fZVertex, float fDetectorEta); - static Candidate::LorentzVector physicsP4(const Candidate::Point& newVertex, - const Candidate& inParticle, - const Candidate::Point& oldVertex = Candidate::Point(0, 0, 0)); + /// static function to convert physics eta to detector eta + static float detectorEta(float fZVertex, float fPhysicsEta); - static Candidate::LorentzVector detectorP4(const Candidate::Point& vertex, const Candidate& inParticle); + static Candidate::LorentzVector physicsP4(const Candidate::Point& newVertex, + const Candidate& inParticle, + const Candidate::Point& oldVertex = Candidate::Point(0, 0, 0)); - /// list of constituents - virtual Constituents getJetConstituents() const; + static Candidate::LorentzVector detectorP4(const Candidate::Point& vertex, const Candidate& inParticle); - /// quick list of constituents - virtual std::vector getJetConstituentsQuick() const; + /// list of constituents + virtual Constituents getJetConstituents() const; - // jet structure variables: - // constituentPtDistribution is the pT distribution among the jet constituents - // (ptDistribution = 1 if jet made by one constituent carrying all its momentum, - // ptDistribution = 0 if jet made by infinite constituents carrying an infinitesimal fraction of pt): - float constituentPtDistribution() const; + /// quick list of constituents + virtual std::vector getJetConstituentsQuick() const; - // rmsCand is the rms of the eta-phi spread of the jet's constituents wrt the jet axis: - float constituentEtaPhiSpread() const; + // jet structure variables: + // constituentPtDistribution is the pT distribution among the jet constituents + // (ptDistribution = 1 if jet made by one constituent carrying all its momentum, + // ptDistribution = 0 if jet made by infinite constituents carrying an infinitesimal fraction of pt): + float constituentPtDistribution() const; - /// Print object - virtual std::string print() const; + // rmsCand is the rms of the eta-phi spread of the jet's constituents wrt the jet axis: + float constituentEtaPhiSpread() const; - /// scale energy of the jet - virtual void scaleEnergy(double fScale); + /// Print object + virtual std::string print() const; - /// set jet area - virtual void setJetArea(float fArea) { mJetArea = fArea; } - /// get jet area - virtual float jetArea() const { return mJetArea; } + /// scale energy of the jet + virtual void scaleEnergy(double fScale); - /// Set pileup energy contribution as calculated by algorithm - virtual void setPileup(float fEnergy) { mPileupEnergy = fEnergy; } - /// pileup energy contribution as calculated by algorithm - virtual float pileup() const { return mPileupEnergy; } + /// set jet area + virtual void setJetArea(float fArea) { mJetArea = fArea; } + /// get jet area + virtual float jetArea() const { return mJetArea; } - /// Set number of passes taken by algorithm - virtual void setNPasses(int fPasses) { mPassNumber = fPasses; } - /// number of passes taken by algorithm - virtual int nPasses() const { return mPassNumber; } + /// Set pileup energy contribution as calculated by algorithm + virtual void setPileup(float fEnergy) { mPileupEnergy = fEnergy; } + /// pileup energy contribution as calculated by algorithm + virtual float pileup() const { return mPileupEnergy; } - /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) - virtual void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } - /// boolean if weights were applied by algorithm (e.g. PUPPI weights) - virtual int isWeighted() const { return mIsWeighted; } + /// Set number of passes taken by algorithm + virtual void setNPasses(int fPasses) { mPassNumber = fPasses; } + /// number of passes taken by algorithm + virtual int nPasses() const { return mPassNumber; } - bool isJet() const override; + /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) + virtual void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } + /// boolean if weights were applied by algorithm (e.g. PUPPI weights) + virtual int isWeighted() const { return mIsWeighted; } - private: - float mJetArea; - float mPileupEnergy; - int mPassNumber; - bool mIsWeighted; - }; + bool isJet() const override; + + private: + float mJetArea; + float mPileupEnergy; + int mPassNumber; + bool mIsWeighted; + }; + } // namespace io_v1 + using Jet = io_v1::Jet; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/JetExtendedAssociation.h b/DataFormats/JetReco/interface/JetExtendedAssociation.h index 38c7c1ca27740..cde4775c92e03 100644 --- a/DataFormats/JetReco/interface/JetExtendedAssociation.h +++ b/DataFormats/JetReco/interface/JetExtendedAssociation.h @@ -22,9 +22,12 @@ namespace fwlite { namespace reco { namespace JetExtendedAssociation { - class JetExtendedData; + namespace io_v1 { + class JetExtendedData; + } + using io_v1::JetExtendedData; typedef math::PtEtaPhiELorentzVectorF LorentzVector; - typedef reco::JetExtendedAssociation::JetExtendedData Value; + typedef reco::JetExtendedAssociation::io_v1::JetExtendedData Value; typedef std::vector Values; typedef edm::AssociationVector Container; typedef Container::value_type value_type; @@ -64,15 +67,17 @@ namespace reco { /// check if jet is associated bool hasJet(const Container&, const reco::Jet&); - class JetExtendedData { - public: - JetExtendedData(); - ~JetExtendedData() {} - int mTracksAtVertexNumber; - LorentzVector mTracksAtVertexP4; - int mTracksAtCaloNumber; - LorentzVector mTracksAtCaloP4; - }; + namespace io_v1 { + class JetExtendedData { + public: + JetExtendedData(); + ~JetExtendedData() {} + int mTracksAtVertexNumber; + LorentzVector mTracksAtVertexP4; + int mTracksAtCaloNumber; + LorentzVector mTracksAtCaloP4; + }; + } // namespace io_v1 } // namespace JetExtendedAssociation } // namespace reco diff --git a/DataFormats/JetReco/interface/JetFwd.h b/DataFormats/JetReco/interface/JetFwd.h index f815e76e5f481..53bb2592d9a10 100644 --- a/DataFormats/JetReco/interface/JetFwd.h +++ b/DataFormats/JetReco/interface/JetFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_JetReco_JetFwd_h #define DataFormats_JetReco_JetFwd_h namespace reco { - class Jet; + namespace io_v1 { + class Jet; + } + using Jet = io_v1::Jet; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/JetID.h b/DataFormats/JetReco/interface/JetID.h index 316a47e1784e4..963dd193afb0b 100644 --- a/DataFormats/JetReco/interface/JetID.h +++ b/DataFormats/JetReco/interface/JetID.h @@ -13,54 +13,58 @@ #include "DataFormats/Common/interface/ValueMap.h" namespace reco { - struct JetID { - // initialize - JetID() { - fHPD = 0.0; - fRBX = 0.0; - n90Hits = 0; - fSubDetector1 = 0.0; - fSubDetector2 = 0.0; - fSubDetector3 = 0.0; - fSubDetector4 = 0.0; - restrictedEMF = 0.0; - nHCALTowers = 0; - nECALTowers = 0; - approximatefHPD = 0.0; - approximatefRBX = 0.0; - hitsInN90 = 0; - numberOfHits2RPC = 0; - numberOfHits3RPC = 0; - numberOfHitsRPC = 0; + namespace io_v1 { + struct JetID { + // initialize + JetID() { + fHPD = 0.0; + fRBX = 0.0; + n90Hits = 0; + fSubDetector1 = 0.0; + fSubDetector2 = 0.0; + fSubDetector3 = 0.0; + fSubDetector4 = 0.0; + restrictedEMF = 0.0; + nHCALTowers = 0; + nECALTowers = 0; + approximatefHPD = 0.0; + approximatefRBX = 0.0; + hitsInN90 = 0; + numberOfHits2RPC = 0; + numberOfHits3RPC = 0; + numberOfHitsRPC = 0; - fEB = fEE = fHB = fHE = fHO = fLong = fShort = 0.0; - fLS = fHFOOT = 0.0; - } + fEB = fEE = fHB = fHE = fHO = fLong = fShort = 0.0; + fLS = fHFOOT = 0.0; + } - // hcal+ecal id - float fHPD; - float fRBX; - short n90Hits; - float fSubDetector1; - float fSubDetector2; - float fSubDetector3; - float fSubDetector4; - float restrictedEMF; - short nHCALTowers; - short nECALTowers; - float approximatefHPD; - float approximatefRBX; - short hitsInN90; - // muon hits id - short numberOfHits2RPC; - short numberOfHits3RPC; - short numberOfHitsRPC; + // hcal+ecal id + float fHPD; + float fRBX; + short n90Hits; + float fSubDetector1; + float fSubDetector2; + float fSubDetector3; + float fSubDetector4; + float restrictedEMF; + short nHCALTowers; + short nECALTowers; + float approximatefHPD; + float approximatefRBX; + short hitsInN90; + // muon hits id + short numberOfHits2RPC; + short numberOfHits3RPC; + short numberOfHitsRPC; - float fEB, fEE, fHB, fHE, fHO, fLong, fShort; - float fLS, fHFOOT; - }; + float fEB, fEE, fHB, fHE, fHO, fLong, fShort; + float fLS, fHFOOT; + }; - typedef edm::ValueMap JetIDValueMap; + typedef edm::ValueMap JetIDValueMap; + } // namespace io_v1 + using JetID = io_v1::JetID; + using JetIDValueMap = io_v1::JetIDValueMap; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/PFJet.h b/DataFormats/JetReco/interface/PFJet.h index 3d300767ef373..03cd529803581 100644 --- a/DataFormats/JetReco/interface/PFJet.h +++ b/DataFormats/JetReco/interface/PFJet.h @@ -17,178 +17,181 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" namespace reco { - class PFJet : public Jet { - public: - typedef reco::PFCandidatePtr ConstituentTypePtr; - typedef reco::PFCandidateFwdPtr ConstituentTypeFwdPtr; - - struct Specific { - Specific() - : mChargedHadronEnergy(0), - mNeutralHadronEnergy(0), - mPhotonEnergy(0), - mElectronEnergy(0), - mMuonEnergy(0), - mHFHadronEnergy(0), - mHFEMEnergy(0), - - mChargedHadronMultiplicity(0), - mNeutralHadronMultiplicity(0), - mPhotonMultiplicity(0), - mElectronMultiplicity(0), - mMuonMultiplicity(0), - mHFHadronMultiplicity(0), - mHFEMMultiplicity(0), - - mChargedEmEnergy(0), - mChargedMuEnergy(0), - mNeutralEmEnergy(0), - - mChargedMultiplicity(0), - mNeutralMultiplicity(0), - - mHOEnergy(0) {} - float mChargedHadronEnergy; - float mNeutralHadronEnergy; - float mPhotonEnergy; - float mElectronEnergy; - float mMuonEnergy; - float mHFHadronEnergy; - float mHFEMEnergy; - - int mChargedHadronMultiplicity; - int mNeutralHadronMultiplicity; - int mPhotonMultiplicity; - int mElectronMultiplicity; - int mMuonMultiplicity; - int mHFHadronMultiplicity; - int mHFEMMultiplicity; - - //old (deprecated) data members - //kept only for backwards compatibility: - float mChargedEmEnergy; - float mChargedMuEnergy; - float mNeutralEmEnergy; - int mChargedMultiplicity; - int mNeutralMultiplicity; - - float mHOEnergy; + namespace io_v1 { + class PFJet : public Jet { + public: + typedef reco::PFCandidatePtr ConstituentTypePtr; + typedef reco::PFCandidateFwdPtr ConstituentTypeFwdPtr; + + struct Specific { + Specific() + : mChargedHadronEnergy(0), + mNeutralHadronEnergy(0), + mPhotonEnergy(0), + mElectronEnergy(0), + mMuonEnergy(0), + mHFHadronEnergy(0), + mHFEMEnergy(0), + + mChargedHadronMultiplicity(0), + mNeutralHadronMultiplicity(0), + mPhotonMultiplicity(0), + mElectronMultiplicity(0), + mMuonMultiplicity(0), + mHFHadronMultiplicity(0), + mHFEMMultiplicity(0), + + mChargedEmEnergy(0), + mChargedMuEnergy(0), + mNeutralEmEnergy(0), + + mChargedMultiplicity(0), + mNeutralMultiplicity(0), + + mHOEnergy(0) {} + float mChargedHadronEnergy; + float mNeutralHadronEnergy; + float mPhotonEnergy; + float mElectronEnergy; + float mMuonEnergy; + float mHFHadronEnergy; + float mHFEMEnergy; + + int mChargedHadronMultiplicity; + int mNeutralHadronMultiplicity; + int mPhotonMultiplicity; + int mElectronMultiplicity; + int mMuonMultiplicity; + int mHFHadronMultiplicity; + int mHFEMMultiplicity; + + //old (deprecated) data members + //kept only for backwards compatibility: + float mChargedEmEnergy; + float mChargedMuEnergy; + float mNeutralEmEnergy; + int mChargedMultiplicity; + int mNeutralMultiplicity; + + float mHOEnergy; + }; + + /** Default constructor*/ + PFJet() {} + + /** Constructor from values*/ + PFJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + + PFJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); + + /** backward compatible, vertex=(0,0,0) */ + PFJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~PFJet() override {} + + /// chargedHadronEnergy + float chargedHadronEnergy() const { return m_specific.mChargedHadronEnergy; } + /// chargedHadronEnergyFraction + float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } + /// neutralHadronEnergy + float neutralHadronEnergy() const { return m_specific.mNeutralHadronEnergy; } + /// neutralHadronEnergyFraction + float neutralHadronEnergyFraction() const { return neutralHadronEnergy() / energy(); } + /// photonEnergy + float photonEnergy() const { return m_specific.mPhotonEnergy; } + /// photonEnergyFraction + float photonEnergyFraction() const { return photonEnergy() / energy(); } + /// electronEnergy + float electronEnergy() const { return m_specific.mElectronEnergy; } + /// electronEnergyFraction + float electronEnergyFraction() const { return electronEnergy() / energy(); } + /// muonEnergy + float muonEnergy() const { return m_specific.mMuonEnergy; } + /// muonEnergyFraction + float muonEnergyFraction() const { return muonEnergy() / energy(); } + /// HFHadronEnergy + float HFHadronEnergy() const { return m_specific.mHFHadronEnergy; } + /// HFHadronEnergyFraction + float HFHadronEnergyFraction() const { return HFHadronEnergy() / energy(); } + /// HFEMEnergy + float HFEMEnergy() const { return m_specific.mHFEMEnergy; } + /// HFEMEnergyFraction + float HFEMEnergyFraction() const { return HFEMEnergy() / energy(); } + + /// chargedHadronMultiplicity + int chargedHadronMultiplicity() const { return m_specific.mChargedHadronMultiplicity; } + /// neutralHadronMultiplicity + int neutralHadronMultiplicity() const { return m_specific.mNeutralHadronMultiplicity; } + /// photonMultiplicity + int photonMultiplicity() const { return m_specific.mPhotonMultiplicity; } + /// electronMultiplicity + int electronMultiplicity() const { return m_specific.mElectronMultiplicity; } + /// muonMultiplicity + int muonMultiplicity() const { return m_specific.mMuonMultiplicity; } + /// HFHadronMultiplicity + int HFHadronMultiplicity() const { return m_specific.mHFHadronMultiplicity; } + /// HFEMMultiplicity + int HFEMMultiplicity() const { return m_specific.mHFEMMultiplicity; } + + /// chargedEmEnergy + float chargedEmEnergy() const { return m_specific.mChargedEmEnergy; } + /// chargedEmEnergyFraction + float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } + /// chargedMuEnergy + float chargedMuEnergy() const { return m_specific.mChargedMuEnergy; } + /// chargedMuEnergyFraction + float chargedMuEnergyFraction() const { return chargedMuEnergy() / energy(); } + /// neutralEmEnergy + float neutralEmEnergy() const { return m_specific.mNeutralEmEnergy; } + /// neutralEmEnergyFraction + float neutralEmEnergyFraction() const { return neutralEmEnergy() / energy(); } + + /// chargedMultiplicity + int chargedMultiplicity() const { return m_specific.mChargedMultiplicity; } + /// neutralMultiplicity + int neutralMultiplicity() const { return m_specific.mNeutralMultiplicity; } + + /// hoEnergy + float hoEnergy() const { return m_specific.mHOEnergy; } + /// hoEnergyFraction + float hoEnergyFraction() const { return hoEnergy() / energy(); } + + /// get specific constituent + virtual reco::PFCandidatePtr getPFConstituent(unsigned fIndex) const; + + /// get all constituents + virtual std::vector getPFConstituents() const; + + /// \ brief get all tracks in the jets + /// All PFCandidates hold a reference to a track. All the non-null + /// references are added to the returned TrackRefVector + reco::TrackRefVector getTrackRefs() const; + + // block accessors + + const Specific& getSpecific() const { return m_specific; } + + /// Polymorphic clone + PFJet* clone() const override; + + /// Print object in details + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + //Variables specific to to the PFJet class + Specific m_specific; }; - /** Default constructor*/ - PFJet() {} - - /** Constructor from values*/ - PFJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - - PFJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); - - /** backward compatible, vertex=(0,0,0) */ - PFJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~PFJet() override {} - - /// chargedHadronEnergy - float chargedHadronEnergy() const { return m_specific.mChargedHadronEnergy; } - /// chargedHadronEnergyFraction - float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } - /// neutralHadronEnergy - float neutralHadronEnergy() const { return m_specific.mNeutralHadronEnergy; } - /// neutralHadronEnergyFraction - float neutralHadronEnergyFraction() const { return neutralHadronEnergy() / energy(); } - /// photonEnergy - float photonEnergy() const { return m_specific.mPhotonEnergy; } - /// photonEnergyFraction - float photonEnergyFraction() const { return photonEnergy() / energy(); } - /// electronEnergy - float electronEnergy() const { return m_specific.mElectronEnergy; } - /// electronEnergyFraction - float electronEnergyFraction() const { return electronEnergy() / energy(); } - /// muonEnergy - float muonEnergy() const { return m_specific.mMuonEnergy; } - /// muonEnergyFraction - float muonEnergyFraction() const { return muonEnergy() / energy(); } - /// HFHadronEnergy - float HFHadronEnergy() const { return m_specific.mHFHadronEnergy; } - /// HFHadronEnergyFraction - float HFHadronEnergyFraction() const { return HFHadronEnergy() / energy(); } - /// HFEMEnergy - float HFEMEnergy() const { return m_specific.mHFEMEnergy; } - /// HFEMEnergyFraction - float HFEMEnergyFraction() const { return HFEMEnergy() / energy(); } - - /// chargedHadronMultiplicity - int chargedHadronMultiplicity() const { return m_specific.mChargedHadronMultiplicity; } - /// neutralHadronMultiplicity - int neutralHadronMultiplicity() const { return m_specific.mNeutralHadronMultiplicity; } - /// photonMultiplicity - int photonMultiplicity() const { return m_specific.mPhotonMultiplicity; } - /// electronMultiplicity - int electronMultiplicity() const { return m_specific.mElectronMultiplicity; } - /// muonMultiplicity - int muonMultiplicity() const { return m_specific.mMuonMultiplicity; } - /// HFHadronMultiplicity - int HFHadronMultiplicity() const { return m_specific.mHFHadronMultiplicity; } - /// HFEMMultiplicity - int HFEMMultiplicity() const { return m_specific.mHFEMMultiplicity; } - - /// chargedEmEnergy - float chargedEmEnergy() const { return m_specific.mChargedEmEnergy; } - /// chargedEmEnergyFraction - float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } - /// chargedMuEnergy - float chargedMuEnergy() const { return m_specific.mChargedMuEnergy; } - /// chargedMuEnergyFraction - float chargedMuEnergyFraction() const { return chargedMuEnergy() / energy(); } - /// neutralEmEnergy - float neutralEmEnergy() const { return m_specific.mNeutralEmEnergy; } - /// neutralEmEnergyFraction - float neutralEmEnergyFraction() const { return neutralEmEnergy() / energy(); } - - /// chargedMultiplicity - int chargedMultiplicity() const { return m_specific.mChargedMultiplicity; } - /// neutralMultiplicity - int neutralMultiplicity() const { return m_specific.mNeutralMultiplicity; } - - /// hoEnergy - float hoEnergy() const { return m_specific.mHOEnergy; } - /// hoEnergyFraction - float hoEnergyFraction() const { return hoEnergy() / energy(); } - - /// get specific constituent - virtual reco::PFCandidatePtr getPFConstituent(unsigned fIndex) const; - - /// get all constituents - virtual std::vector getPFConstituents() const; - - /// \ brief get all tracks in the jets - /// All PFCandidates hold a reference to a track. All the non-null - /// references are added to the returned TrackRefVector - reco::TrackRefVector getTrackRefs() const; - - // block accessors - - const Specific& getSpecific() const { return m_specific; } - - /// Polymorphic clone - PFJet* clone() const override; - - /// Print object in details - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - //Variables specific to to the PFJet class - Specific m_specific; - }; - - // streamer - std::ostream& operator<<(std::ostream& out, const reco::PFJet& jet); + // streamer + std::ostream& operator<<(std::ostream& out, const reco::io_v1::PFJet& jet); + } // namespace io_v1 + using PFJet = io_v1::PFJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/PFJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/PFJetCollection.h b/DataFormats/JetReco/interface/PFJetCollection.h index 74e154e327dd7..041e6e9bd7ea2 100644 --- a/DataFormats/JetReco/interface/PFJetCollection.h +++ b/DataFormats/JetReco/interface/PFJetCollection.h @@ -11,7 +11,10 @@ #include "DataFormats/JetReco/interface/PFJet.h" //INCLUDECHECKER:SKIP namespace reco { - class PFJet; + namespace io_v1 { + class PFJet; + } + using PFJet = io_v1::PFJet; /// collection of PFJet objects typedef std::vector PFJetCollection; /// edm references diff --git a/DataFormats/JetReco/interface/TrackExtrapolation.h b/DataFormats/JetReco/interface/TrackExtrapolation.h index 461372c6687fb..ac14af443806d 100644 --- a/DataFormats/JetReco/interface/TrackExtrapolation.h +++ b/DataFormats/JetReco/interface/TrackExtrapolation.h @@ -19,34 +19,37 @@ #include namespace reco { - class TrackExtrapolation { - // Next two typedefs use double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, - // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase - // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. - typedef ROOT::Math::PositionVector3D > Point; - typedef ROOT::Math::DisplacementVector3D > Vector; - - public: - TrackExtrapolation() {} - TrackExtrapolation(reco::TrackRef const& track, std::vector const& pos, std::vector const& mom) - : track_(track) { - pos_.resize(pos.size()); - copy(pos.begin(), pos.end(), pos_.begin()); - mom_.resize(mom.size()); - copy(mom.begin(), mom.end(), mom_.begin()); - } - - ~TrackExtrapolation() {} - - reco::TrackRef const& track() const { return track_; } - std::vector const& positions() const { return pos_; } - std::vector const& momenta() const { return mom_; } - - protected: - reco::TrackRef track_; - std::vector pos_; - std::vector mom_; - }; + namespace io_v1 { + class TrackExtrapolation { + // Next two typedefs use double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D > Point; + typedef ROOT::Math::DisplacementVector3D > Vector; + + public: + TrackExtrapolation() {} + TrackExtrapolation(reco::TrackRef const& track, std::vector const& pos, std::vector const& mom) + : track_(track) { + pos_.resize(pos.size()); + copy(pos.begin(), pos.end(), pos_.begin()); + mom_.resize(mom.size()); + copy(mom.begin(), mom.end(), mom_.begin()); + } + + ~TrackExtrapolation() {} + + reco::TrackRef const& track() const { return track_; } + std::vector const& positions() const { return pos_; } + std::vector const& momenta() const { return mom_; } + + protected: + reco::TrackRef track_; + std::vector pos_; + std::vector mom_; + }; + } // namespace io_v1 + using TrackExtrapolation = io_v1::TrackExtrapolation; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/TrackJet.h b/DataFormats/JetReco/interface/TrackJet.h index 160d8ad213387..20625cb0f2473 100644 --- a/DataFormats/JetReco/interface/TrackJet.h +++ b/DataFormats/JetReco/interface/TrackJet.h @@ -20,48 +20,51 @@ #include "DataFormats/VertexReco/interface/VertexFwd.h" namespace reco { + namespace io_v1 { - class TrackJet : public Jet { - public: - /// Default constructor - TrackJet(); - /// Constructor without constituents - TrackJet(const LorentzVector& fP4, const Point& fVertex); - /// Constructor from RecoChargedRefCandidate constituents - TrackJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); - /// Destructor - ~TrackJet() override {} - /// Polymorphic clone - TrackJet* clone() const override; + class TrackJet : public Jet { + public: + /// Default constructor + TrackJet(); + /// Constructor without constituents + TrackJet(const LorentzVector& fP4, const Point& fVertex); + /// Constructor from RecoChargedRefCandidate constituents + TrackJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); + /// Destructor + ~TrackJet() override {} + /// Polymorphic clone + TrackJet* clone() const override; - /// Number of track daughters - size_t numberOfTracks() const { return numberOfDaughters(); } - /// Return Ptr to the track costituent - virtual edm::Ptr track(size_t i) const; - /// Return pointers to all track costituents - std::vector > tracks() const; + /// Number of track daughters + size_t numberOfTracks() const { return numberOfDaughters(); } + /// Return Ptr to the track costituent + virtual edm::Ptr track(size_t i) const; + /// Return pointers to all track costituents + std::vector > tracks() const; - /// calculate and set the charge by adding up the constituting track charges - void resetCharge(); - /// get associated primary vertex - const reco::VertexRef primaryVertex() const; - /// set associated primary vertex - void setPrimaryVertex(const reco::VertexRef& vtx); - /// check jet to be associated to the hard primary vertex - bool fromHardVertex() const { return (this->primaryVertex().index() == 0); } + /// calculate and set the charge by adding up the constituting track charges + void resetCharge(); + /// get associated primary vertex + const reco::VertexRef primaryVertex() const; + /// set associated primary vertex + void setPrimaryVertex(const reco::VertexRef& vtx); + /// check jet to be associated to the hard primary vertex + bool fromHardVertex() const { return (this->primaryVertex().index() == 0); } - /// Print object - std::string print() const override; + /// Print object + std::string print() const override; - private: - /// Polymorphic overlap - bool overlap(const Candidate& dummy) const override; + private: + /// Polymorphic overlap + bool overlap(const Candidate& dummy) const override; - private: - /// Associated primary vertex - reco::VertexRef vtx_; - }; + private: + /// Associated primary vertex + reco::VertexRef vtx_; + }; + } // namespace io_v1 + using TrackJet = io_v1::TrackJet; } // namespace reco #endif diff --git a/DataFormats/JetReco/src/PFJet.cc b/DataFormats/JetReco/src/PFJet.cc index e5f0c62839870..a45c4493227d4 100644 --- a/DataFormats/JetReco/src/PFJet.cc +++ b/DataFormats/JetReco/src/PFJet.cc @@ -11,6 +11,7 @@ #include "DataFormats/JetReco/interface/PFJet.h" using namespace reco; +using namespace reco::io_v1; PFJet::PFJet(const LorentzVector& fP4, const Point& fVertex, @@ -95,7 +96,7 @@ std::string PFJet::print() const { return out.str(); } -std::ostream& reco::operator<<(std::ostream& out, const reco::PFJet& jet) { +std::ostream& reco::io_v1::operator<<(std::ostream& out, const reco::io_v1::PFJet& jet) { if (out) { out << "PFJet " << "(pt, eta, phi) = " << jet.pt() << "," << jet.eta() << "," << jet.phi() diff --git a/DataFormats/JetReco/src/classes_def_1.xml b/DataFormats/JetReco/src/classes_def_1.xml index fd256e416e1f3..3bd191bb8db7c 100644 --- a/DataFormats/JetReco/src/classes_def_1.xml +++ b/DataFormats/JetReco/src/classes_def_1.xml @@ -1,142 +1,122 @@ - - - - - + + - - + + - - - - - + + - - + + - - - - - - + + + + + + - - + + - + - + - - - - - + + - - + + - - - - - + + + + + - - + + - - - - - + + - - - + + - - - - - + + + + + - - - + + + - + - + - - - - - + + - - - + + - - - - - + + + + + - - - + + + - + - - - - - + + - - - - - + + + + + - - - + + + - + - + diff --git a/DataFormats/JetReco/src/classes_def_2.xml b/DataFormats/JetReco/src/classes_def_2.xml index 8d553c7c88ba2..6fcf0f211c28b 100755 --- a/DataFormats/JetReco/src/classes_def_2.xml +++ b/DataFormats/JetReco/src/classes_def_2.xml @@ -12,9 +12,9 @@ - + - + @@ -34,9 +34,9 @@ - + - + @@ -56,9 +56,9 @@ - + - + @@ -78,9 +78,9 @@ - + - + @@ -97,12 +97,12 @@ - + - - - - + + + + diff --git a/DataFormats/JetReco/src/classes_def_3.xml b/DataFormats/JetReco/src/classes_def_3.xml index 0d8a9a8db0761..b861e8f7ec052 100644 --- a/DataFormats/JetReco/src/classes_def_3.xml +++ b/DataFormats/JetReco/src/classes_def_3.xml @@ -1,26 +1,24 @@ - - - - - + + - - - - - + + + + + - - - + + + - + - + + @@ -32,7 +30,7 @@ - + @@ -46,13 +44,13 @@ - + - + - + @@ -85,8 +83,8 @@ - - + + @@ -103,33 +101,33 @@ - + - - - - - - - - - + + + + + + + + + - + - + - + - + - + - + - - + + diff --git a/DataFormats/JetReco/src/classes_def_4.xml b/DataFormats/JetReco/src/classes_def_4.xml index f9d237a532468..78ddc9b50eefa 100644 --- a/DataFormats/JetReco/src/classes_def_4.xml +++ b/DataFormats/JetReco/src/classes_def_4.xml @@ -1,14 +1,14 @@ - - + + - - - - - - - + + + + + + + @@ -21,34 +21,32 @@ - - - + + + - - - + + + - - + + - - + + - - - - + + @@ -58,22 +56,22 @@ - - - + + + - - + + - - - - - - - - - + + + + + + + + + @@ -90,8 +88,8 @@ - - + + @@ -108,9 +106,9 @@ - + - + @@ -130,9 +128,9 @@ - + - + diff --git a/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml b/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml index d812650d64efd..7e82060cd986b 100644 --- a/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml +++ b/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml @@ -5,7 +5,7 @@ - + @@ -13,14 +13,14 @@ - + - + @@ -35,7 +35,7 @@ - + @@ -71,7 +71,7 @@ - + diff --git a/DataFormats/L1TCorrelator/src/classes_def.xml b/DataFormats/L1TCorrelator/src/classes_def.xml index 8ac314ea58ae1..30ab39372a30b 100644 --- a/DataFormats/L1TCorrelator/src/classes_def.xml +++ b/DataFormats/L1TCorrelator/src/classes_def.xml @@ -1,20 +1,15 @@ - - - - + + - - - - - + + @@ -24,40 +19,29 @@ - - setEgCaloPtr(edm::refToPtr(onfile.egRef_)); - ]]> - - - + - + - + - - - - - - - + + @@ -67,9 +51,8 @@ - - - + + @@ -77,7 +60,7 @@ - + @@ -85,17 +68,15 @@ - - - + + - - - + + @@ -105,28 +86,28 @@ - + - + - + - + diff --git a/DataFormats/L1THGCal/src/classes_def.xml b/DataFormats/L1THGCal/src/classes_def.xml index 2a0ace5b5b502..cb370fe7f7025 100644 --- a/DataFormats/L1THGCal/src/classes_def.xml +++ b/DataFormats/L1THGCal/src/classes_def.xml @@ -30,17 +30,8 @@ - - - - - - - - - - - + + @@ -48,37 +39,22 @@ - - - - - - - - - - - - + + - - - - - - + + - - - + + diff --git a/DataFormats/L1TMuonPhase2/src/classes_def.xml b/DataFormats/L1TMuonPhase2/src/classes_def.xml index 3af19882e9fc8..d5fc2af4de331 100644 --- a/DataFormats/L1TMuonPhase2/src/classes_def.xml +++ b/DataFormats/L1TMuonPhase2/src/classes_def.xml @@ -7,26 +7,23 @@ - - - - + + - - - + + - + diff --git a/DataFormats/L1TParticleFlow/src/classes_def.xml b/DataFormats/L1TParticleFlow/src/classes_def.xml index e45d86590aa53..86bcf76ea0296 100644 --- a/DataFormats/L1TParticleFlow/src/classes_def.xml +++ b/DataFormats/L1TParticleFlow/src/classes_def.xml @@ -1,11 +1,7 @@ - - - - - - + + @@ -13,9 +9,8 @@ - - - + + @@ -23,13 +18,8 @@ - - - - - - - + + @@ -39,20 +29,8 @@ - - - setCaloPtr(edm::refToPtr(onfile.clusterRef_)); - ]]> - - - - - - - - - + + @@ -60,10 +38,8 @@ - - - - + + @@ -71,11 +47,8 @@ - - - - - + + diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index ae574642ceb45..9550524686c48 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -1,8 +1,6 @@ - - - - + + @@ -16,9 +14,8 @@ - - - + + @@ -37,11 +34,8 @@ - - - - - + + @@ -61,12 +55,8 @@ - - - - - - + + @@ -78,11 +68,8 @@ - - - - - + + @@ -101,11 +88,8 @@ - - - - - + + @@ -117,16 +101,8 @@ - - - - - - - - - - + + @@ -139,11 +115,8 @@ - - - - - + + @@ -156,38 +129,24 @@ - - - - - + + - - - - - + + - - - - - + + - - - - + + - - - - - + + @@ -239,15 +198,15 @@ - + - + - + - + - + diff --git a/DataFormats/METReco/interface/BeamHaloSummary.h b/DataFormats/METReco/interface/BeamHaloSummary.h index e32e0701f8d1a..6847278abedb4 100644 --- a/DataFormats/METReco/interface/BeamHaloSummary.h +++ b/DataFormats/METReco/interface/BeamHaloSummary.h @@ -22,80 +22,86 @@ namespace reco { class BeamHaloInfoProducer; + namespace io_v1 { - class BeamHaloSummary { - friend class reco::BeamHaloInfoProducer; + class BeamHaloSummary { + friend class reco::BeamHaloInfoProducer; - public: - //constructors - BeamHaloSummary(); - BeamHaloSummary(CSCHaloData& csc, EcalHaloData& ecal, HcalHaloData& hcal, GlobalHaloData& global); + public: + //constructors + BeamHaloSummary(); + BeamHaloSummary(CSCHaloData& csc, EcalHaloData& ecal, HcalHaloData& hcal, GlobalHaloData& global); - //destructor - virtual ~BeamHaloSummary() {} + //destructor + virtual ~BeamHaloSummary() {} - const bool HcalLooseHaloId() const { return !HcalHaloReport.empty() ? HcalHaloReport[0] : false; } - const bool HcalTightHaloId() const { return HcalHaloReport.size() > 1 ? HcalHaloReport[1] : false; } + const bool HcalLooseHaloId() const { return !HcalHaloReport.empty() ? HcalHaloReport[0] : false; } + const bool HcalTightHaloId() const { return HcalHaloReport.size() > 1 ? HcalHaloReport[1] : false; } - const bool EcalLooseHaloId() const { return !EcalHaloReport.empty() ? EcalHaloReport[0] : false; } - const bool EcalTightHaloId() const { return EcalHaloReport.size() > 1 ? EcalHaloReport[1] : false; } + const bool EcalLooseHaloId() const { return !EcalHaloReport.empty() ? EcalHaloReport[0] : false; } + const bool EcalTightHaloId() const { return EcalHaloReport.size() > 1 ? EcalHaloReport[1] : false; } - const bool CSCLooseHaloId() const { return !CSCHaloReport.empty() ? CSCHaloReport[0] : false; } - const bool CSCTightHaloId() const { return CSCHaloReport.size() > 1 ? CSCHaloReport[1] : false; } - const bool CSCTightHaloIdTrkMuUnveto() const { return CSCHaloReport.size() > 4 ? CSCHaloReport[4] : false; } - const bool CSCTightHaloId2015() const { return CSCHaloReport.size() > 5 ? CSCHaloReport[5] : false; } + const bool CSCLooseHaloId() const { return !CSCHaloReport.empty() ? CSCHaloReport[0] : false; } + const bool CSCTightHaloId() const { return CSCHaloReport.size() > 1 ? CSCHaloReport[1] : false; } + const bool CSCTightHaloIdTrkMuUnveto() const { return CSCHaloReport.size() > 4 ? CSCHaloReport[4] : false; } + const bool CSCTightHaloId2015() const { return CSCHaloReport.size() > 5 ? CSCHaloReport[5] : false; } - const bool GlobalLooseHaloId() const { return !GlobalHaloReport.empty() ? GlobalHaloReport[0] : false; } - const bool GlobalTightHaloId() const { return GlobalHaloReport.size() > 1 ? GlobalHaloReport[1] : false; } - const bool GlobalTightHaloId2016() const { return GlobalHaloReport.size() > 2 ? GlobalHaloReport[2] : false; } - const bool GlobalSuperTightHaloId2016() const { return GlobalHaloReport.size() > 3 ? GlobalHaloReport[3] : false; } + const bool GlobalLooseHaloId() const { return !GlobalHaloReport.empty() ? GlobalHaloReport[0] : false; } + const bool GlobalTightHaloId() const { return GlobalHaloReport.size() > 1 ? GlobalHaloReport[1] : false; } + const bool GlobalTightHaloId2016() const { return GlobalHaloReport.size() > 2 ? GlobalHaloReport[2] : false; } + const bool GlobalSuperTightHaloId2016() const { + return GlobalHaloReport.size() > 3 ? GlobalHaloReport[3] : false; + } - const bool EventSmellsLikeHalo() const { - return HcalLooseHaloId() || EcalLooseHaloId() || CSCLooseHaloId() || GlobalLooseHaloId(); - } - const bool LooseId() const { return EventSmellsLikeHalo(); } - const bool TightId() const { - return HcalTightHaloId() || EcalTightHaloId() || CSCTightHaloId() || GlobalTightHaloId(); - } - const bool ExtremeTightId() const { return GlobalTightHaloId(); } + const bool EventSmellsLikeHalo() const { + return HcalLooseHaloId() || EcalLooseHaloId() || CSCLooseHaloId() || GlobalLooseHaloId(); + } + const bool LooseId() const { return EventSmellsLikeHalo(); } + const bool TightId() const { + return HcalTightHaloId() || EcalTightHaloId() || CSCTightHaloId() || GlobalTightHaloId(); + } + const bool ExtremeTightId() const { return GlobalTightHaloId(); } - // Getters - std::vector& GetHcalHaloReport() { return HcalHaloReport; } - const std::vector& GetHcalHaloReport() const { return HcalHaloReport; } + // Getters + std::vector& GetHcalHaloReport() { return HcalHaloReport; } + const std::vector& GetHcalHaloReport() const { return HcalHaloReport; } - std::vector& GetEcalHaloReport() { return EcalHaloReport; } - const std::vector& GetEcalHaloReport() const { return EcalHaloReport; } + std::vector& GetEcalHaloReport() { return EcalHaloReport; } + const std::vector& GetEcalHaloReport() const { return EcalHaloReport; } - std::vector& GetCSCHaloReport() { return CSCHaloReport; } - const std::vector& GetCSCHaloReport() const { return CSCHaloReport; } + std::vector& GetCSCHaloReport() { return CSCHaloReport; } + const std::vector& GetCSCHaloReport() const { return CSCHaloReport; } - std::vector& GetGlobalHaloReport() { return GlobalHaloReport; } - const std::vector& GetGlobalHaloReport() const { return GlobalHaloReport; } + std::vector& GetGlobalHaloReport() { return GlobalHaloReport; } + const std::vector& GetGlobalHaloReport() const { return GlobalHaloReport; } - std::vector& GetHcaliPhiSuspects() { return HcaliPhiSuspects; } - const std::vector& GetHcaliPhiSuspects() const { return HcaliPhiSuspects; } + std::vector& GetHcaliPhiSuspects() { return HcaliPhiSuspects; } + const std::vector& GetHcaliPhiSuspects() const { return HcaliPhiSuspects; } - std::vector& GetEcaliPhiSuspects() { return EcaliPhiSuspects; } - const std::vector& GetEcaliPhiSuspects() const { return EcaliPhiSuspects; } + std::vector& GetEcaliPhiSuspects() { return EcaliPhiSuspects; } + const std::vector& GetEcaliPhiSuspects() const { return EcaliPhiSuspects; } - std::vector& GetGlobaliPhiSuspects() { return GlobaliPhiSuspects; } - const std::vector& GetGlobaliPhiSuspects() const { return GlobaliPhiSuspects; } + std::vector& GetGlobaliPhiSuspects() { return GlobaliPhiSuspects; } + const std::vector& GetGlobaliPhiSuspects() const { return GlobaliPhiSuspects; } - std::vector& getProblematicStrips() { return problematicStrips; } - const std::vector& getProblematicStrips() const { return problematicStrips; } + std::vector& getProblematicStrips() { return problematicStrips; } + const std::vector& getProblematicStrips() const { return problematicStrips; } - private: - std::vector HcalHaloReport; - std::vector EcalHaloReport; - std::vector CSCHaloReport; - std::vector GlobalHaloReport; + private: + std::vector HcalHaloReport; + std::vector EcalHaloReport; + std::vector CSCHaloReport; + std::vector GlobalHaloReport; - std::vector HcaliPhiSuspects; - std::vector EcaliPhiSuspects; - std::vector GlobaliPhiSuspects; + std::vector HcaliPhiSuspects; + std::vector EcaliPhiSuspects; + std::vector GlobaliPhiSuspects; - std::vector problematicStrips; - }; + std::vector problematicStrips; + }; + + } // namespace io_v1 + using BeamHaloSummary = io_v1::BeamHaloSummary; } // namespace reco diff --git a/DataFormats/METReco/interface/CSCHaloData.h b/DataFormats/METReco/interface/CSCHaloData.h index 1d50c0fd1b48d..28973e0183238 100644 --- a/DataFormats/METReco/interface/CSCHaloData.h +++ b/DataFormats/METReco/interface/CSCHaloData.h @@ -20,144 +20,148 @@ */ namespace reco { - - class CSCHaloData { - public: - // Default constructor - CSCHaloData(); - - virtual ~CSCHaloData() {} - - // Number of HaloTriggers in +/- endcap - int NumberOfHaloTriggers(HaloData::Endcap z = HaloData::both) const; - int NumberOfHaloTriggers_TrkMuUnVeto(HaloData::Endcap z = HaloData::both) const; - int NHaloTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTriggers(z); } - - // Number of Halo Tracks in +/- endcap - int NumberOfHaloTracks(HaloData::Endcap z = HaloData::both) const; - int NHaloTracks(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTracks(z); } - - // Halo trigger bit from the HLT - bool CSCHaloHLTAccept() const { return HLTAccept; } - - // Number of chamber-level triggers with non-collision timing - short int NumberOfOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const; - short int NOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfOutOfTimeTriggers(z); } - // Number of CSCRecHits with non-collision timing - short int NumberOfOutTimeHits() const { return nOutOfTimeHits; } - short int NOutOfTimeHits() const { return nOutOfTimeHits; } - // Look at number of muons with timing consistent with incoming particles - short int NTracksSmalldT() const { return nTracks_Small_dT; } - short int NTracksSmallBeta() const { return nTracks_Small_beta; } - short int NTracksSmallBetaAndSmalldT() const { return nTracks_Small_dT_Small_beta; } - - // MLR - short int NFlatHaloSegments() const { return nFlatHaloSegments; } - bool GetSegmentsInBothEndcaps() const { return segments_in_both_endcaps; } - bool GetSegmentIsCaloMatched() const { return segmentiscalomatched; } - bool GetSegmentIsHCaloMatched() const { return segmentisHcalomatched; } - bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } - bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } - // End MLR - short int NFlatHaloSegments_TrkMuUnVeto() const { return nFlatHaloSegments_TrkMuUnVeto; } - bool GetSegmentsInBothEndcaps_Loose_TrkMuUnVeto() const { return segments_in_both_endcaps_loose_TrkMuUnVeto; } - bool GetSegmentsInBothEndcaps_Loose_dTcut_TrkMuUnVeto() const { - return segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; - } - - // Get Reference to the Tracks - edm::RefVector& GetTracks() { return TheTrackRefs; } - const edm::RefVector& GetTracks() const { return TheTrackRefs; } - - // Set Number of Halo Triggers - void SetNumberOfHaloTriggers(int PlusZ, int MinusZ) { - nTriggers_PlusZ = PlusZ; - nTriggers_MinusZ = MinusZ; - } - void SetNumberOfHaloTriggers_TrkMuUnVeto(int PlusZ, int MinusZ) { - nTriggers_PlusZ_TrkMuUnVeto = PlusZ; - nTriggers_MinusZ_TrkMuUnVeto = MinusZ; - } - // Set number of chamber-level triggers with non-collision timing - void SetNOutOfTimeTriggers(short int PlusZ, short int MinusZ) { - nOutOfTimeTriggers_PlusZ = PlusZ; - nOutOfTimeTriggers_MinusZ = MinusZ; - } - // Set number of CSCRecHits with non-collision timing - void SetNOutOfTimeHits(short int num) { nOutOfTimeHits = num; } - // Set number of tracks with timing consistent with incoming particles - void SetNIncomingTracks(short int n_small_dT, short int n_small_beta, short int n_small_both) { - nTracks_Small_dT = n_small_dT; - nTracks_Small_beta = n_small_beta; - nTracks_Small_dT_Small_beta = n_small_both; - } - - // Set HLT Bit - void SetHLTBit(bool status) { HLTAccept = status; } - - // Get GlobalPoints of CSC tracking rechits nearest to the calorimeters - //std::vector& GetCSCTrackImpactPositions() const {return TheGlobalPositions;} - const std::vector& GetCSCTrackImpactPositions() const { return TheGlobalPositions; } - std::vector& GetCSCTrackImpactPositions() { return TheGlobalPositions; } - - // MLR - // Set # of CSCSegments that appear to be part of a halo muon - // If there is more than 1 muon, this is the number of segments in the halo muon - // with the largest number of segments that pass the cut. - void SetNFlatHaloSegments(short int nSegments) { nFlatHaloSegments = nSegments; } - void SetSegmentsBothEndcaps(bool b) { segments_in_both_endcaps = b; } - // End MLR - void SetNFlatHaloSegments_TrkMuUnVeto(short int nSegments) { nFlatHaloSegments_TrkMuUnVeto = nSegments; } - void SetSegmentsBothEndcaps_Loose_TrkMuUnVeto(bool b) { segments_in_both_endcaps_loose_TrkMuUnVeto = b; } - void SetSegmentsBothEndcaps_Loose_dTcut_TrkMuUnVeto(bool b) { - segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto = b; - } - void SetSegmentIsCaloMatched(bool b) { segmentiscalomatched = b; } - void SetSegmentIsHCaloMatched(bool b) { segmentisHcalomatched = b; } - void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } - void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } - - private: - edm::RefVector TheTrackRefs; - - // The GlobalPoints from constituent rechits nearest to the calorimeter of CSC tracks - std::vector TheGlobalPositions; - int nTriggers_PlusZ; - int nTriggers_MinusZ; - int nTriggers_PlusZ_TrkMuUnVeto; - int nTriggers_MinusZ_TrkMuUnVeto; - // CSC halo trigger reported by the HLT - bool HLTAccept; - - int nTracks_PlusZ; - int nTracks_MinusZ; - - // number of out-of-time chamber-level triggers (assumes the event triggered at the bx of the beam crossing) - short int nOutOfTimeTriggers_PlusZ; - short int nOutOfTimeTriggers_MinusZ; - // number of out-of-time CSCRecHit2Ds (assumes the event triggered at the bx of the beam crossing) - short int nOutOfTimeHits; - // number of cosmic muon outer (CSC) tracks with (T_segment_outer - T_segment_inner) < max_dt_muon_segment - short int nTracks_Small_dT; - // number of cosmic muon outer (CSC) tracks with free inverse beta < max_free_inverse_beta - short int nTracks_Small_beta; - // number of cosmic muon outer (CSC) tracks with both - // (T_segment_outer - T_segment_inner) < max_dt_muon_segment and free inverse beta < max_free_inverse_beta - short int nTracks_Small_dT_Small_beta; - - // MLR - // number of CSCSegments that are flat and have the same (r,phi) - short int nFlatHaloSegments; - bool segments_in_both_endcaps; - // end MLR - short int nFlatHaloSegments_TrkMuUnVeto; - bool segments_in_both_endcaps_loose_TrkMuUnVeto; - bool segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; - bool segmentiscalomatched; - bool segmentisHcalomatched; - bool segmentisEBcalomatched; - bool segmentisEEcalomatched; - }; + namespace io_v1 { + + class CSCHaloData { + public: + // Default constructor + CSCHaloData(); + + virtual ~CSCHaloData() {} + + // Number of HaloTriggers in +/- endcap + int NumberOfHaloTriggers(HaloData::Endcap z = HaloData::both) const; + int NumberOfHaloTriggers_TrkMuUnVeto(HaloData::Endcap z = HaloData::both) const; + int NHaloTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTriggers(z); } + + // Number of Halo Tracks in +/- endcap + int NumberOfHaloTracks(HaloData::Endcap z = HaloData::both) const; + int NHaloTracks(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTracks(z); } + + // Halo trigger bit from the HLT + bool CSCHaloHLTAccept() const { return HLTAccept; } + + // Number of chamber-level triggers with non-collision timing + short int NumberOfOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const; + short int NOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfOutOfTimeTriggers(z); } + // Number of CSCRecHits with non-collision timing + short int NumberOfOutTimeHits() const { return nOutOfTimeHits; } + short int NOutOfTimeHits() const { return nOutOfTimeHits; } + // Look at number of muons with timing consistent with incoming particles + short int NTracksSmalldT() const { return nTracks_Small_dT; } + short int NTracksSmallBeta() const { return nTracks_Small_beta; } + short int NTracksSmallBetaAndSmalldT() const { return nTracks_Small_dT_Small_beta; } + + // MLR + short int NFlatHaloSegments() const { return nFlatHaloSegments; } + bool GetSegmentsInBothEndcaps() const { return segments_in_both_endcaps; } + bool GetSegmentIsCaloMatched() const { return segmentiscalomatched; } + bool GetSegmentIsHCaloMatched() const { return segmentisHcalomatched; } + bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } + bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } + // End MLR + short int NFlatHaloSegments_TrkMuUnVeto() const { return nFlatHaloSegments_TrkMuUnVeto; } + bool GetSegmentsInBothEndcaps_Loose_TrkMuUnVeto() const { return segments_in_both_endcaps_loose_TrkMuUnVeto; } + bool GetSegmentsInBothEndcaps_Loose_dTcut_TrkMuUnVeto() const { + return segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; + } + + // Get Reference to the Tracks + edm::RefVector& GetTracks() { return TheTrackRefs; } + const edm::RefVector& GetTracks() const { return TheTrackRefs; } + + // Set Number of Halo Triggers + void SetNumberOfHaloTriggers(int PlusZ, int MinusZ) { + nTriggers_PlusZ = PlusZ; + nTriggers_MinusZ = MinusZ; + } + void SetNumberOfHaloTriggers_TrkMuUnVeto(int PlusZ, int MinusZ) { + nTriggers_PlusZ_TrkMuUnVeto = PlusZ; + nTriggers_MinusZ_TrkMuUnVeto = MinusZ; + } + // Set number of chamber-level triggers with non-collision timing + void SetNOutOfTimeTriggers(short int PlusZ, short int MinusZ) { + nOutOfTimeTriggers_PlusZ = PlusZ; + nOutOfTimeTriggers_MinusZ = MinusZ; + } + // Set number of CSCRecHits with non-collision timing + void SetNOutOfTimeHits(short int num) { nOutOfTimeHits = num; } + // Set number of tracks with timing consistent with incoming particles + void SetNIncomingTracks(short int n_small_dT, short int n_small_beta, short int n_small_both) { + nTracks_Small_dT = n_small_dT; + nTracks_Small_beta = n_small_beta; + nTracks_Small_dT_Small_beta = n_small_both; + } + + // Set HLT Bit + void SetHLTBit(bool status) { HLTAccept = status; } + + // Get GlobalPoints of CSC tracking rechits nearest to the calorimeters + //std::vector& GetCSCTrackImpactPositions() const {return TheGlobalPositions;} + const std::vector& GetCSCTrackImpactPositions() const { return TheGlobalPositions; } + std::vector& GetCSCTrackImpactPositions() { return TheGlobalPositions; } + + // MLR + // Set # of CSCSegments that appear to be part of a halo muon + // If there is more than 1 muon, this is the number of segments in the halo muon + // with the largest number of segments that pass the cut. + void SetNFlatHaloSegments(short int nSegments) { nFlatHaloSegments = nSegments; } + void SetSegmentsBothEndcaps(bool b) { segments_in_both_endcaps = b; } + // End MLR + void SetNFlatHaloSegments_TrkMuUnVeto(short int nSegments) { nFlatHaloSegments_TrkMuUnVeto = nSegments; } + void SetSegmentsBothEndcaps_Loose_TrkMuUnVeto(bool b) { segments_in_both_endcaps_loose_TrkMuUnVeto = b; } + void SetSegmentsBothEndcaps_Loose_dTcut_TrkMuUnVeto(bool b) { + segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto = b; + } + void SetSegmentIsCaloMatched(bool b) { segmentiscalomatched = b; } + void SetSegmentIsHCaloMatched(bool b) { segmentisHcalomatched = b; } + void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } + void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } + + private: + edm::RefVector TheTrackRefs; + + // The GlobalPoints from constituent rechits nearest to the calorimeter of CSC tracks + std::vector TheGlobalPositions; + int nTriggers_PlusZ; + int nTriggers_MinusZ; + int nTriggers_PlusZ_TrkMuUnVeto; + int nTriggers_MinusZ_TrkMuUnVeto; + // CSC halo trigger reported by the HLT + bool HLTAccept; + + int nTracks_PlusZ; + int nTracks_MinusZ; + + // number of out-of-time chamber-level triggers (assumes the event triggered at the bx of the beam crossing) + short int nOutOfTimeTriggers_PlusZ; + short int nOutOfTimeTriggers_MinusZ; + // number of out-of-time CSCRecHit2Ds (assumes the event triggered at the bx of the beam crossing) + short int nOutOfTimeHits; + // number of cosmic muon outer (CSC) tracks with (T_segment_outer - T_segment_inner) < max_dt_muon_segment + short int nTracks_Small_dT; + // number of cosmic muon outer (CSC) tracks with free inverse beta < max_free_inverse_beta + short int nTracks_Small_beta; + // number of cosmic muon outer (CSC) tracks with both + // (T_segment_outer - T_segment_inner) < max_dt_muon_segment and free inverse beta < max_free_inverse_beta + short int nTracks_Small_dT_Small_beta; + + // MLR + // number of CSCSegments that are flat and have the same (r,phi) + short int nFlatHaloSegments; + bool segments_in_both_endcaps; + // end MLR + short int nFlatHaloSegments_TrkMuUnVeto; + bool segments_in_both_endcaps_loose_TrkMuUnVeto; + bool segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; + bool segmentiscalomatched; + bool segmentisHcalomatched; + bool segmentisEBcalomatched; + bool segmentisEEcalomatched; + }; + + } // namespace io_v1 + using CSCHaloData = io_v1::CSCHaloData; } // namespace reco diff --git a/DataFormats/METReco/interface/CaloMET.h b/DataFormats/METReco/interface/CaloMET.h index df27993fd7141..3dd8692bb2932 100644 --- a/DataFormats/METReco/interface/CaloMET.h +++ b/DataFormats/METReco/interface/CaloMET.h @@ -18,69 +18,72 @@ #include "DataFormats/METReco/interface/CorrMETData.h" namespace reco { - class CaloMET : public MET { - public: - /* Constructors*/ - CaloMET(); - CaloMET(const SpecificCaloMETData& calo_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) - : MET(sumet_, fP4, fVertex), calo_data(calo_data_) {} - CaloMET(const SpecificCaloMETData& calo_data_, - double sumet_, - const std::vector& corr_, - const LorentzVector& fP4, - const Point& fVertex) - : MET(sumet_, corr_, fP4, fVertex), calo_data(calo_data_) {} - /* Default destructor*/ - ~CaloMET() override {} + namespace io_v1 { + class CaloMET : public MET { + public: + /* Constructors*/ + CaloMET(); + CaloMET(const SpecificCaloMETData& calo_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) + : MET(sumet_, fP4, fVertex), calo_data(calo_data_) {} + CaloMET(const SpecificCaloMETData& calo_data_, + double sumet_, + const std::vector& corr_, + const LorentzVector& fP4, + const Point& fVertex) + : MET(sumet_, corr_, fP4, fVertex), calo_data(calo_data_) {} + /* Default destructor*/ + ~CaloMET() override {} - /* Returns the maximum energy deposited in ECAL towers */ - double maxEtInEmTowers() const { return calo_data.MaxEtInEmTowers; }; - /* Returns the maximum energy deposited in HCAL towers */ - double maxEtInHadTowers() const { return calo_data.MaxEtInHadTowers; }; - /* Returns the event hadronic energy fraction */ - double etFractionHadronic() const { return calo_data.EtFractionHadronic; }; - /* Returns the event electromagnetic energy fraction */ - double emEtFraction() const { return calo_data.EtFractionEm; }; - /* Returns the event hadronic energy in HB */ - double hadEtInHB() const { return calo_data.HadEtInHB; }; - /* Returns the event hadronic energy in HO */ - double hadEtInHO() const { return calo_data.HadEtInHO; }; - /* Returns the event hadronic energy in HE */ - double hadEtInHE() const { return calo_data.HadEtInHE; }; - /* Returns the event hadronic energy in HF */ - double hadEtInHF() const { return calo_data.HadEtInHF; }; - /* Returns the event electromagnetic energy in EB */ - double emEtInEB() const { return calo_data.EmEtInEB; }; - /* Returns the event electromagnetic energy in EE */ - double emEtInEE() const { return calo_data.EmEtInEE; }; - /* Returns the event electromagnetic energy extracted from HF */ - double emEtInHF() const { return calo_data.EmEtInHF; }; - /* Returns the event MET Significance */ - double metSignificance() const { return this->significance(); }; - /* Returns the event SET in HF+ */ - double CaloSETInpHF() const { return calo_data.CaloSETInpHF; }; - /* Returns the event SET in HF- */ - double CaloSETInmHF() const { return calo_data.CaloSETInmHF; }; - /* Returns the event MET in HF+ */ - double CaloMETInpHF() const { return calo_data.CaloMETInpHF; }; - /* Returns the event MET in HF- */ - double CaloMETInmHF() const { return calo_data.CaloMETInmHF; }; - /* Returns the event MET-phi in HF+ */ - double CaloMETPhiInpHF() const { return calo_data.CaloMETPhiInpHF; }; - /* Returns the event MET-phi in HF- */ - double CaloMETPhiInmHF() const { return calo_data.CaloMETPhiInmHF; }; + /* Returns the maximum energy deposited in ECAL towers */ + double maxEtInEmTowers() const { return calo_data.MaxEtInEmTowers; }; + /* Returns the maximum energy deposited in HCAL towers */ + double maxEtInHadTowers() const { return calo_data.MaxEtInHadTowers; }; + /* Returns the event hadronic energy fraction */ + double etFractionHadronic() const { return calo_data.EtFractionHadronic; }; + /* Returns the event electromagnetic energy fraction */ + double emEtFraction() const { return calo_data.EtFractionEm; }; + /* Returns the event hadronic energy in HB */ + double hadEtInHB() const { return calo_data.HadEtInHB; }; + /* Returns the event hadronic energy in HO */ + double hadEtInHO() const { return calo_data.HadEtInHO; }; + /* Returns the event hadronic energy in HE */ + double hadEtInHE() const { return calo_data.HadEtInHE; }; + /* Returns the event hadronic energy in HF */ + double hadEtInHF() const { return calo_data.HadEtInHF; }; + /* Returns the event electromagnetic energy in EB */ + double emEtInEB() const { return calo_data.EmEtInEB; }; + /* Returns the event electromagnetic energy in EE */ + double emEtInEE() const { return calo_data.EmEtInEE; }; + /* Returns the event electromagnetic energy extracted from HF */ + double emEtInHF() const { return calo_data.EmEtInHF; }; + /* Returns the event MET Significance */ + double metSignificance() const { return this->significance(); }; + /* Returns the event SET in HF+ */ + double CaloSETInpHF() const { return calo_data.CaloSETInpHF; }; + /* Returns the event SET in HF- */ + double CaloSETInmHF() const { return calo_data.CaloSETInmHF; }; + /* Returns the event MET in HF+ */ + double CaloMETInpHF() const { return calo_data.CaloMETInpHF; }; + /* Returns the event MET in HF- */ + double CaloMETInmHF() const { return calo_data.CaloMETInmHF; }; + /* Returns the event MET-phi in HF+ */ + double CaloMETPhiInpHF() const { return calo_data.CaloMETPhiInpHF; }; + /* Returns the event MET-phi in HF- */ + double CaloMETPhiInmHF() const { return calo_data.CaloMETPhiInmHF; }; - //Set Met Significance - void SetMetSignificance(double metsig) { calo_data.METSignificance = metsig; } + //Set Met Significance + void SetMetSignificance(double metsig) { calo_data.METSignificance = metsig; } - // block accessors - SpecificCaloMETData getSpecific() const { return calo_data; } + // block accessors + SpecificCaloMETData getSpecific() const { return calo_data; } - private: - bool overlap(const Candidate&) const override; - // Data members - //Variables specific to to the CaloMET class - SpecificCaloMETData calo_data; - }; + private: + bool overlap(const Candidate&) const override; + // Data members + //Variables specific to to the CaloMET class + SpecificCaloMETData calo_data; + }; + } // namespace io_v1 + using CaloMET = io_v1::CaloMET; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/CaloMETFwd.h b/DataFormats/METReco/interface/CaloMETFwd.h index ca6d4a2edf37e..65157ff3178d4 100644 --- a/DataFormats/METReco/interface/CaloMETFwd.h +++ b/DataFormats/METReco/interface/CaloMETFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class CaloMET; + namespace io_v1 { + class CaloMET; + } + using CaloMET = io_v1::CaloMET; /// collection of CaloMET objects typedef std::vector CaloMETCollection; /// edm references diff --git a/DataFormats/METReco/interface/EcalHaloData.h b/DataFormats/METReco/interface/EcalHaloData.h index ac44b310aaf50..fc4acdf9c45ac 100644 --- a/DataFormats/METReco/interface/EcalHaloData.h +++ b/DataFormats/METReco/interface/EcalHaloData.h @@ -18,50 +18,53 @@ #include "DataFormats/METReco/interface/HaloClusterCandidateECAL.h" namespace reco { - class EcalHaloData { - public: - //Constructor - EcalHaloData(); - //Destructor - ~EcalHaloData() {} + namespace io_v1 { + class EcalHaloData { + public: + //Constructor + EcalHaloData(); + //Destructor + ~EcalHaloData() {} - // Number of Halo-like superclusters as a function of the roundness and angular cuts - //int NumberOfHaloSuperClusters(int iRoundness=2, int iAngle=2) const; - int NumberOfHaloSuperClusters(float roundness = 100., float angle = 4.0) const; + // Number of Halo-like superclusters as a function of the roundness and angular cuts + //int NumberOfHaloSuperClusters(int iRoundness=2, int iAngle=2) const; + int NumberOfHaloSuperClusters(float roundness = 100., float angle = 4.0) const; - // Return collection of 5-degree Phi Wedges built from Ecal RecHits - const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } - std::vector& GetPhiWedges() { return PhiWedgeCollection; } + // Return collection of 5-degree Phi Wedges built from Ecal RecHits + const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } + std::vector& GetPhiWedges() { return PhiWedgeCollection; } - // Get Reference to the SuperClusters - edm::RefVector& GetSuperClusters() { return TheSuperClusterRefs; } - const edm::RefVector& GetSuperClusters() const { return TheSuperClusterRefs; } + // Get Reference to the SuperClusters + edm::RefVector& GetSuperClusters() { return TheSuperClusterRefs; } + const edm::RefVector& GetSuperClusters() const { return TheSuperClusterRefs; } - // Store Shower Shape variables for SuperClusters - edm::ValueMap& GetShowerShapesRoundness() { return ShowerShapes_Roundness; } - const edm::ValueMap& GetShowerShapesRoundness() const { return ShowerShapes_Roundness; } + // Store Shower Shape variables for SuperClusters + edm::ValueMap& GetShowerShapesRoundness() { return ShowerShapes_Roundness; } + const edm::ValueMap& GetShowerShapesRoundness() const { return ShowerShapes_Roundness; } - edm::ValueMap& GetShowerShapesAngle() { return ShowerShapes_Angle; } - const edm::ValueMap& GetShowerShapesAngle() const { return ShowerShapes_Angle; } + edm::ValueMap& GetShowerShapesAngle() { return ShowerShapes_Angle; } + const edm::ValueMap& GetShowerShapesAngle() const { return ShowerShapes_Angle; } - const std::vector& getHaloClusterCandidatesEB() const { return thehaloclustercands_eb; } - std::vector& getHaloClusterCandidatesEB() { return thehaloclustercands_eb; } - const std::vector& getHaloClusterCandidatesEE() const { return thehaloclustercands_ee; } - std::vector& getHaloClusterCandidatesEE() { return thehaloclustercands_ee; } + const std::vector& getHaloClusterCandidatesEB() const { return thehaloclustercands_eb; } + std::vector& getHaloClusterCandidatesEB() { return thehaloclustercands_eb; } + const std::vector& getHaloClusterCandidatesEE() const { return thehaloclustercands_ee; } + std::vector& getHaloClusterCandidatesEE() { return thehaloclustercands_ee; } - void setHaloClusterCandidatesEB(const std::vector& x) { thehaloclustercands_eb = x; } - void setHaloClusterCandidatesEE(const std::vector& x) { thehaloclustercands_ee = x; } + void setHaloClusterCandidatesEB(const std::vector& x) { thehaloclustercands_eb = x; } + void setHaloClusterCandidatesEE(const std::vector& x) { thehaloclustercands_ee = x; } - private: - std::vector PhiWedgeCollection; - edm::RefVector TheSuperClusterRefs; + private: + std::vector PhiWedgeCollection; + edm::RefVector TheSuperClusterRefs; - edm::ValueMap ShowerShapes_Roundness; - edm::ValueMap ShowerShapes_Angle; + edm::ValueMap ShowerShapes_Roundness; + edm::ValueMap ShowerShapes_Angle; - std::vector thehaloclustercands_eb; - std::vector thehaloclustercands_ee; - }; + std::vector thehaloclustercands_eb; + std::vector thehaloclustercands_ee; + }; + } // namespace io_v1 + using EcalHaloData = io_v1::EcalHaloData; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/GenMET.h b/DataFormats/METReco/interface/GenMET.h index a3d0ff6bdbab6..5ace52a6791a2 100644 --- a/DataFormats/METReco/interface/GenMET.h +++ b/DataFormats/METReco/interface/GenMET.h @@ -17,68 +17,71 @@ #include "DataFormats/METReco/interface/MET.h" namespace reco { - class GenMET : public MET { - public: - /* Constructors*/ - GenMET(); - GenMET(const SpecificGenMETData& gen_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) - : MET(sumet_, fP4, fVertex), gen_data(gen_data_) {} - /* Default destructor*/ - ~GenMET() override {} - - //Get Neutral EM Et Fraction - double NeutralEMEtFraction() const { return gen_data.NeutralEMEtFraction; } - - //Get Neutral EM Et - double NeutralEMEt() const { return gen_data.NeutralEMEtFraction * sumEt(); } - - //Get Charged EM Et Fraction - double ChargedEMEtFraction() const { return gen_data.ChargedEMEtFraction; } - - //Get Charged EM Et - double ChargedEMEt() const { return gen_data.ChargedEMEtFraction * sumEt(); } - - //Get Neutral Had Et Fraction - double NeutralHadEtFraction() const { return gen_data.NeutralHadEtFraction; } - - //Get Neutral Had Et - double NeutralHadEt() const { return gen_data.NeutralHadEtFraction * sumEt(); } - - //Get Charged Had Et Fraction - double ChargedHadEtFraction() const { return gen_data.ChargedHadEtFraction; } - - //Get Charged Had Et - double ChargedHadEt() const { return gen_data.ChargedHadEtFraction * sumEt(); } - - //Get Muon Et Fraction - double MuonEtFraction() const { return gen_data.MuonEtFraction; } - - //Get Muon Et - double MuonEt() const { return gen_data.MuonEtFraction * sumEt(); } - - //Get Invisible Et Fraction - double InvisibleEtFraction() const { return gen_data.InvisibleEtFraction; } - - //Get Invisible Et - double InvisibleEt() const { return gen_data.InvisibleEtFraction * sumEt(); } - - // Old Accessors (to be removed as soon as possible) - /** Returns energy of electromagnetic particles*/ - double emEnergy() const { return gen_data.m_EmEnergy; }; - /** Returns energy of hadronic particles*/ - double hadEnergy() const { return gen_data.m_HadEnergy; }; - /** Returns invisible energy*/ - double invisibleEnergy() const { return gen_data.m_InvisibleEnergy; }; - /** Returns other energy (undecayed Sigmas etc.)*/ - double auxiliaryEnergy() const { return gen_data.m_AuxiliaryEnergy; }; - // block accessors - - // block accessors - private: - bool overlap(const Candidate&) const override; - // Data members - //Variables specific to to the GenMET class - SpecificGenMETData gen_data; - }; + namespace io_v1 { + class GenMET : public MET { + public: + /* Constructors*/ + GenMET(); + GenMET(const SpecificGenMETData& gen_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) + : MET(sumet_, fP4, fVertex), gen_data(gen_data_) {} + /* Default destructor*/ + ~GenMET() override {} + + //Get Neutral EM Et Fraction + double NeutralEMEtFraction() const { return gen_data.NeutralEMEtFraction; } + + //Get Neutral EM Et + double NeutralEMEt() const { return gen_data.NeutralEMEtFraction * sumEt(); } + + //Get Charged EM Et Fraction + double ChargedEMEtFraction() const { return gen_data.ChargedEMEtFraction; } + + //Get Charged EM Et + double ChargedEMEt() const { return gen_data.ChargedEMEtFraction * sumEt(); } + + //Get Neutral Had Et Fraction + double NeutralHadEtFraction() const { return gen_data.NeutralHadEtFraction; } + + //Get Neutral Had Et + double NeutralHadEt() const { return gen_data.NeutralHadEtFraction * sumEt(); } + + //Get Charged Had Et Fraction + double ChargedHadEtFraction() const { return gen_data.ChargedHadEtFraction; } + + //Get Charged Had Et + double ChargedHadEt() const { return gen_data.ChargedHadEtFraction * sumEt(); } + + //Get Muon Et Fraction + double MuonEtFraction() const { return gen_data.MuonEtFraction; } + + //Get Muon Et + double MuonEt() const { return gen_data.MuonEtFraction * sumEt(); } + + //Get Invisible Et Fraction + double InvisibleEtFraction() const { return gen_data.InvisibleEtFraction; } + + //Get Invisible Et + double InvisibleEt() const { return gen_data.InvisibleEtFraction * sumEt(); } + + // Old Accessors (to be removed as soon as possible) + /** Returns energy of electromagnetic particles*/ + double emEnergy() const { return gen_data.m_EmEnergy; }; + /** Returns energy of hadronic particles*/ + double hadEnergy() const { return gen_data.m_HadEnergy; }; + /** Returns invisible energy*/ + double invisibleEnergy() const { return gen_data.m_InvisibleEnergy; }; + /** Returns other energy (undecayed Sigmas etc.)*/ + double auxiliaryEnergy() const { return gen_data.m_AuxiliaryEnergy; }; + // block accessors + + // block accessors + private: + bool overlap(const Candidate&) const override; + // Data members + //Variables specific to to the GenMET class + SpecificGenMETData gen_data; + }; + } // namespace io_v1 + using GenMET = io_v1::GenMET; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/GenMETFwd.h b/DataFormats/METReco/interface/GenMETFwd.h index fd43865918b44..e6ae162012612 100644 --- a/DataFormats/METReco/interface/GenMETFwd.h +++ b/DataFormats/METReco/interface/GenMETFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class GenMET; + namespace io_v1 { + class GenMET; + } + using io_v1::GenMET; /// collection of GenMET objects typedef std::vector GenMETCollection; /// edm references diff --git a/DataFormats/METReco/interface/GlobalHaloData.h b/DataFormats/METReco/interface/GlobalHaloData.h index 1570bd51c3200..76e1aa3cad291 100644 --- a/DataFormats/METReco/interface/GlobalHaloData.h +++ b/DataFormats/METReco/interface/GlobalHaloData.h @@ -14,84 +14,87 @@ #include "DataFormats/METReco/interface/MET.h" namespace reco { - class GlobalHaloData { - public: - // Constructor - GlobalHaloData(); - // Destructor - ~GlobalHaloData() {} - - //A good cut-variable to isolate halo events with no overlapping physics from collisions - float METOverSumEt() const { return METOverSumEt_; } - - //Correction to CaloMET x-component - float DeltaMEx() const { return dMEx_; } - - //Correction to CaloMET y-component - float DeltaMEy() const { return dMEy_; } - - //Correction to SumEt - float DeltaSumEt() const { return dSumEt_; } - - //Get CaloMET Object corrected for BeamHalo - reco::CaloMET GetCorrectedCaloMET(const reco::CaloMET& RawMET) const; - - std::vector& GetMatchedHcalPhiWedges() { return HcalPhiWedges; } - const std::vector& GetMatchedHcalPhiWedges() const { return HcalPhiWedges; } - - std::vector& GetMatchedEcalPhiWedges() { return EcalPhiWedges; } - const std::vector& GetMatchedEcalPhiWedges() const { return EcalPhiWedges; } - - edm::RefVector& GetEBRechits() { return ecalebrhRefs; } - const edm::RefVector& GetEBRechits() const { return ecalebrhRefs; } - - edm::RefVector& GetEERechits() { return ecaleerhRefs; } - const edm::RefVector& GetEERechits() const { return ecaleerhRefs; } - - edm::RefVector& GetHBHERechits() { return hbherhRefs; } - const edm::RefVector& GetHBHERechits() const { return hbherhRefs; } - - bool GetSegmentIsHBCaloMatched() const { return segmentisHBcalomatched; } - bool GetSegmentIsHECaloMatched() const { return segmentisHEcalomatched; } - bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } - bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } - - bool GetHaloPatternFoundEB() const { return halopatternfoundEB; } - bool GetHaloPatternFoundEE() const { return halopatternfoundEE; } - bool GetHaloPatternFoundHB() const { return halopatternfoundHB; } - bool GetHaloPatternFoundHE() const { return halopatternfoundHE; } - - //Setters - void SetMETOverSumEt(float x) { METOverSumEt_ = x; } - void SetMETCorrections(float x, float y) { - dMEx_ = x; - dMEy_ = y; - } - - void SetSegmentIsHBCaloMatched(bool b) { segmentisHBcalomatched = b; } - void SetSegmentIsHECaloMatched(bool b) { segmentisHEcalomatched = b; } - void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } - void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } - void SetHaloPatternFoundEB(bool b) { halopatternfoundEB = b; } - void SetHaloPatternFoundEE(bool b) { halopatternfoundEE = b; } - void SetHaloPatternFoundHB(bool b) { halopatternfoundHB = b; } - void SetHaloPatternFoundHE(bool b) { halopatternfoundHE = b; } - - private: - float METOverSumEt_; - float dMEx_; - float dMEy_; - float dSumEt_; - - std::vector HcalPhiWedges; - std::vector EcalPhiWedges; - - bool segmentisEBcalomatched, segmentisEEcalomatched, segmentisHBcalomatched, segmentisHEcalomatched; - bool halopatternfoundEB, halopatternfoundEE, halopatternfoundHB, halopatternfoundHE; - - edm::RefVector ecalebrhRefs; - edm::RefVector ecaleerhRefs; - edm::RefVector hbherhRefs; - }; + namespace io_v1 { + class GlobalHaloData { + public: + // Constructor + GlobalHaloData(); + // Destructor + ~GlobalHaloData() {} + + //A good cut-variable to isolate halo events with no overlapping physics from collisions + float METOverSumEt() const { return METOverSumEt_; } + + //Correction to CaloMET x-component + float DeltaMEx() const { return dMEx_; } + + //Correction to CaloMET y-component + float DeltaMEy() const { return dMEy_; } + + //Correction to SumEt + float DeltaSumEt() const { return dSumEt_; } + + //Get CaloMET Object corrected for BeamHalo + reco::CaloMET GetCorrectedCaloMET(const reco::CaloMET& RawMET) const; + + std::vector& GetMatchedHcalPhiWedges() { return HcalPhiWedges; } + const std::vector& GetMatchedHcalPhiWedges() const { return HcalPhiWedges; } + + std::vector& GetMatchedEcalPhiWedges() { return EcalPhiWedges; } + const std::vector& GetMatchedEcalPhiWedges() const { return EcalPhiWedges; } + + edm::RefVector& GetEBRechits() { return ecalebrhRefs; } + const edm::RefVector& GetEBRechits() const { return ecalebrhRefs; } + + edm::RefVector& GetEERechits() { return ecaleerhRefs; } + const edm::RefVector& GetEERechits() const { return ecaleerhRefs; } + + edm::RefVector& GetHBHERechits() { return hbherhRefs; } + const edm::RefVector& GetHBHERechits() const { return hbherhRefs; } + + bool GetSegmentIsHBCaloMatched() const { return segmentisHBcalomatched; } + bool GetSegmentIsHECaloMatched() const { return segmentisHEcalomatched; } + bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } + bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } + + bool GetHaloPatternFoundEB() const { return halopatternfoundEB; } + bool GetHaloPatternFoundEE() const { return halopatternfoundEE; } + bool GetHaloPatternFoundHB() const { return halopatternfoundHB; } + bool GetHaloPatternFoundHE() const { return halopatternfoundHE; } + + //Setters + void SetMETOverSumEt(float x) { METOverSumEt_ = x; } + void SetMETCorrections(float x, float y) { + dMEx_ = x; + dMEy_ = y; + } + + void SetSegmentIsHBCaloMatched(bool b) { segmentisHBcalomatched = b; } + void SetSegmentIsHECaloMatched(bool b) { segmentisHEcalomatched = b; } + void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } + void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } + void SetHaloPatternFoundEB(bool b) { halopatternfoundEB = b; } + void SetHaloPatternFoundEE(bool b) { halopatternfoundEE = b; } + void SetHaloPatternFoundHB(bool b) { halopatternfoundHB = b; } + void SetHaloPatternFoundHE(bool b) { halopatternfoundHE = b; } + + private: + float METOverSumEt_; + float dMEx_; + float dMEy_; + float dSumEt_; + + std::vector HcalPhiWedges; + std::vector EcalPhiWedges; + + bool segmentisEBcalomatched, segmentisEEcalomatched, segmentisHBcalomatched, segmentisHEcalomatched; + bool halopatternfoundEB, halopatternfoundEE, halopatternfoundHB, halopatternfoundHE; + + edm::RefVector ecalebrhRefs; + edm::RefVector ecaleerhRefs; + edm::RefVector hbherhRefs; + }; + } // namespace io_v1 + using GlobalHaloData = io_v1::GlobalHaloData; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/HcalHaloData.h b/DataFormats/METReco/interface/HcalHaloData.h index 1ad3f6e86026c..eb61bd3f95887 100644 --- a/DataFormats/METReco/interface/HcalHaloData.h +++ b/DataFormats/METReco/interface/HcalHaloData.h @@ -34,36 +34,39 @@ struct HaloTowerStrip { }; namespace reco { + namespace io_v1 { - class HcalHaloData { - public: - //constructor - HcalHaloData(); - //destructor - ~HcalHaloData() {} + class HcalHaloData { + public: + //constructor + HcalHaloData(); + //destructor + ~HcalHaloData() {} - // Return collection of 5-degree Phi Wedges built from Hcal RecHits - const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } - std::vector& GetPhiWedges() { return PhiWedgeCollection; } + // Return collection of 5-degree Phi Wedges built from Hcal RecHits + const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } + std::vector& GetPhiWedges() { return PhiWedgeCollection; } - // Return collection of problematic strips (pairs of # of problematic HCAL cells and CaloTowerDetId) - const std::vector& getProblematicStrips() const { return problematicStripCollection; } - std::vector& getProblematicStrips() { return problematicStripCollection; } + // Return collection of problematic strips (pairs of # of problematic HCAL cells and CaloTowerDetId) + const std::vector& getProblematicStrips() const { return problematicStripCollection; } + std::vector& getProblematicStrips() { return problematicStripCollection; } - const std::vector& getHaloClusterCandidatesHB() const { return thehaloclustercands_hb; } - std::vector& getHaloClusterCandidatesHB() { return thehaloclustercands_hb; } + const std::vector& getHaloClusterCandidatesHB() const { return thehaloclustercands_hb; } + std::vector& getHaloClusterCandidatesHB() { return thehaloclustercands_hb; } - const std::vector& getHaloClusterCandidatesHE() const { return thehaloclustercands_he; } - std::vector& getHaloClusterCandidatesHE() { return thehaloclustercands_he; } + const std::vector& getHaloClusterCandidatesHE() const { return thehaloclustercands_he; } + std::vector& getHaloClusterCandidatesHE() { return thehaloclustercands_he; } - void setHaloClusterCandidatesHB(const std::vector& x) { thehaloclustercands_hb = x; }; - void setHaloClusterCandidatesHE(const std::vector& x) { thehaloclustercands_he = x; }; + void setHaloClusterCandidatesHB(const std::vector& x) { thehaloclustercands_hb = x; }; + void setHaloClusterCandidatesHE(const std::vector& x) { thehaloclustercands_he = x; }; - private: - std::vector PhiWedgeCollection; - std::vector problematicStripCollection; - std::vector thehaloclustercands_hb; - std::vector thehaloclustercands_he; - }; + private: + std::vector PhiWedgeCollection; + std::vector problematicStripCollection; + std::vector thehaloclustercands_hb; + std::vector thehaloclustercands_he; + }; + } // namespace io_v1 + using HcalHaloData = io_v1::HcalHaloData; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/MET.h b/DataFormats/METReco/interface/MET.h index 966797ea4a334..1de4a8282ea78 100644 --- a/DataFormats/METReco/interface/MET.h +++ b/DataFormats/METReco/interface/MET.h @@ -37,59 +37,62 @@ //____________________________________________________________________________|| namespace reco { typedef ROOT::Math::SMatrix METCovMatrix; + namespace io_v1 { - class MET : public RecoCandidate { - public: - MET(); - MET(const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); - MET(double sumet_, const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); - MET(double sumet_, - const std::vector& corr_, - const LorentzVector& p4_, - const Point& vtx_, - bool isWeighted = false); + class MET : public RecoCandidate { + public: + MET(); + MET(const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); + MET(double sumet_, const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); + MET(double sumet_, + const std::vector& corr_, + const LorentzVector& p4_, + const Point& vtx_, + bool isWeighted = false); - MET* clone() const override; + MET* clone() const override; - //________________________________________________________________________|| - //scalar sum of transverse energy over all objects - double sumEt() const { return sumet; } - //MET Significance = MET / std::sqrt(SumET) - double mEtSig() const { return (sumet ? (this->et() / std::sqrt(sumet)) : (0.0)); } - //real MET significance - double significance() const; - //longitudinal component of the vector sum of energy over all object - //(useful for data quality monitoring) - double e_longitudinal() const { return elongit; } + //________________________________________________________________________|| + //scalar sum of transverse energy over all objects + double sumEt() const { return sumet; } + //MET Significance = MET / std::sqrt(SumET) + double mEtSig() const { return (sumet ? (this->et() / std::sqrt(sumet)) : (0.0)); } + //real MET significance + double significance() const; + //longitudinal component of the vector sum of energy over all object + //(useful for data quality monitoring) + double e_longitudinal() const { return elongit; } - //________________________________________________________________________|| - //Define different methods for the corrections to individual MET elements - std::vector dmEx() const; - std::vector dmEy() const; - std::vector dsumEt() const; - std::vector mEtCorr() const { return corr; } + //________________________________________________________________________|| + //Define different methods for the corrections to individual MET elements + std::vector dmEx() const; + std::vector dmEy() const; + std::vector dsumEt() const; + std::vector mEtCorr() const { return corr; } - //________________________________________________________________________|| - void setSignificanceMatrix(const reco::METCovMatrix& matrix); - reco::METCovMatrix getSignificanceMatrix(void) const; + //________________________________________________________________________|| + void setSignificanceMatrix(const reco::METCovMatrix& matrix); + reco::METCovMatrix getSignificanceMatrix(void) const; - /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) - void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } - /// boolean if weights were applied by algorithm (e.g. PUPPI weights) - int isWeighted() const { return mIsWeighted; } + /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) + void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } + /// boolean if weights were applied by algorithm (e.g. PUPPI weights) + int isWeighted() const { return mIsWeighted; } - private: - bool overlap(const Candidate&) const override; - double sumet; - double elongit; - // bookkeeping for the significance - double signif_dxx; - double signif_dyy; - double signif_dyx; - double signif_dxy; - std::vector corr; - bool mIsWeighted; - }; + private: + bool overlap(const Candidate&) const override; + double sumet; + double elongit; + // bookkeeping for the significance + double signif_dxx; + double signif_dyy; + double signif_dyx; + double signif_dxy; + std::vector corr; + bool mIsWeighted; + }; + } // namespace io_v1 + using MET = io_v1::MET; } // namespace reco //____________________________________________________________________________|| diff --git a/DataFormats/METReco/interface/METFwd.h b/DataFormats/METReco/interface/METFwd.h index 10445de5ed3ad..9647033931584 100644 --- a/DataFormats/METReco/interface/METFwd.h +++ b/DataFormats/METReco/interface/METFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class MET; + namespace io_v1 { + class MET; + } + using MET = io_v1::MET; /// collection of MET objects typedef std::vector METCollection; /// edm references diff --git a/DataFormats/METReco/interface/PFMET.h b/DataFormats/METReco/interface/PFMET.h index beaedf91ad123..6321c0557dd47 100644 --- a/DataFormats/METReco/interface/PFMET.h +++ b/DataFormats/METReco/interface/PFMET.h @@ -15,66 +15,69 @@ date: 10/27/08 #include "DataFormats/METReco/interface/MET.h" #include "DataFormats/METReco/interface/SpecificPFMETData.h" namespace reco { - class PFMET : public MET { - public: - PFMET(); - PFMET(const SpecificPFMETData& pf_data_, - double sumet_, - const LorentzVector& fP4, - const Point& fVertex, - bool isWeighted = false) - : MET(sumet_, fP4, fVertex, isWeighted), pf_data(pf_data_) {} + namespace io_v1 { + class PFMET : public MET { + public: + PFMET(); + PFMET(const SpecificPFMETData& pf_data_, + double sumet_, + const LorentzVector& fP4, + const Point& fVertex, + bool isWeighted = false) + : MET(sumet_, fP4, fVertex, isWeighted), pf_data(pf_data_) {} - ~PFMET() override {} + ~PFMET() override {} - //getters - double photonEtFraction() const { return pf_data.NeutralEMFraction; } - double photonEt() const { return pf_data.NeutralEMFraction * sumEt(); } + //getters + double photonEtFraction() const { return pf_data.NeutralEMFraction; } + double photonEt() const { return pf_data.NeutralEMFraction * sumEt(); } - double neutralHadronEtFraction() const { return pf_data.NeutralHadFraction; } - double neutralHadronEt() const { return pf_data.NeutralHadFraction * sumEt(); } + double neutralHadronEtFraction() const { return pf_data.NeutralHadFraction; } + double neutralHadronEt() const { return pf_data.NeutralHadFraction * sumEt(); } - double electronEtFraction() const { return pf_data.ChargedEMFraction; } - double electronEt() const { return pf_data.ChargedEMFraction * sumEt(); } + double electronEtFraction() const { return pf_data.ChargedEMFraction; } + double electronEt() const { return pf_data.ChargedEMFraction * sumEt(); } - double chargedHadronEtFraction() const { return pf_data.ChargedHadFraction; } - double chargedHadronEt() const { return pf_data.ChargedHadFraction * sumEt(); } + double chargedHadronEtFraction() const { return pf_data.ChargedHadFraction; } + double chargedHadronEt() const { return pf_data.ChargedHadFraction * sumEt(); } - double muonEtFraction() const { return pf_data.MuonFraction; } - double muonEt() const { return pf_data.MuonFraction * sumEt(); } + double muonEtFraction() const { return pf_data.MuonFraction; } + double muonEt() const { return pf_data.MuonFraction * sumEt(); } - double HFHadronEtFraction() const { return pf_data.Type6Fraction; } - double HFHadronEt() const { return pf_data.Type6Fraction * sumEt(); } + double HFHadronEtFraction() const { return pf_data.Type6Fraction; } + double HFHadronEt() const { return pf_data.Type6Fraction * sumEt(); } - double HFEMEtFraction() const { return pf_data.Type7Fraction; } - double HFEMEt() const { return pf_data.Type7Fraction * sumEt(); } + double HFEMEtFraction() const { return pf_data.Type7Fraction; } + double HFEMEt() const { return pf_data.Type7Fraction * sumEt(); } - // Old accessors (should be removed in future) - double NeutralEMEtFraction() const { return pf_data.NeutralEMFraction; } - double NeutralEMEt() const { return pf_data.NeutralEMFraction * sumEt(); } - double NeutralHadEtFraction() const { return pf_data.NeutralHadFraction; } - double NeutralHadEt() const { return pf_data.NeutralHadFraction * sumEt(); } - double ChargedEMEtFraction() const { return pf_data.ChargedEMFraction; } - double ChargedEMEt() const { return pf_data.ChargedEMFraction * sumEt(); } - double ChargedHadEtFraction() const { return pf_data.ChargedHadFraction; } - double ChargedHadEt() const { return pf_data.ChargedHadFraction * sumEt(); } - double MuonEtFraction() const { return pf_data.MuonFraction; } - double MuonEt() const { return pf_data.MuonFraction * sumEt(); } - double Type6EtFraction() const { return pf_data.Type6Fraction; } - double Type6Et() const { return pf_data.Type6Fraction * sumEt(); } - double Type7EtFraction() const { return pf_data.Type7Fraction; } - double Type7Et() const { return pf_data.Type7Fraction * sumEt(); } - double NeutralEMFraction() const { return pf_data.NeutralEMFraction; } - double NeutralHadFraction() const { return pf_data.NeutralHadFraction; } - double ChargedEMFraction() const { return pf_data.ChargedEMFraction; } - double ChargedHadFraction() const { return pf_data.ChargedHadFraction; } - double MuonFraction() const { return pf_data.MuonFraction; } + // Old accessors (should be removed in future) + double NeutralEMEtFraction() const { return pf_data.NeutralEMFraction; } + double NeutralEMEt() const { return pf_data.NeutralEMFraction * sumEt(); } + double NeutralHadEtFraction() const { return pf_data.NeutralHadFraction; } + double NeutralHadEt() const { return pf_data.NeutralHadFraction * sumEt(); } + double ChargedEMEtFraction() const { return pf_data.ChargedEMFraction; } + double ChargedEMEt() const { return pf_data.ChargedEMFraction * sumEt(); } + double ChargedHadEtFraction() const { return pf_data.ChargedHadFraction; } + double ChargedHadEt() const { return pf_data.ChargedHadFraction * sumEt(); } + double MuonEtFraction() const { return pf_data.MuonFraction; } + double MuonEt() const { return pf_data.MuonFraction * sumEt(); } + double Type6EtFraction() const { return pf_data.Type6Fraction; } + double Type6Et() const { return pf_data.Type6Fraction * sumEt(); } + double Type7EtFraction() const { return pf_data.Type7Fraction; } + double Type7Et() const { return pf_data.Type7Fraction * sumEt(); } + double NeutralEMFraction() const { return pf_data.NeutralEMFraction; } + double NeutralHadFraction() const { return pf_data.NeutralHadFraction; } + double ChargedEMFraction() const { return pf_data.ChargedEMFraction; } + double ChargedHadFraction() const { return pf_data.ChargedHadFraction; } + double MuonFraction() const { return pf_data.MuonFraction; } - // block accessors - SpecificPFMETData getSpecific() const { return pf_data; } + // block accessors + SpecificPFMETData getSpecific() const { return pf_data; } - private: - SpecificPFMETData pf_data; - }; + private: + SpecificPFMETData pf_data; + }; + } // namespace io_v1 + using PFMET = io_v1::PFMET; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/PFMETFwd.h b/DataFormats/METReco/interface/PFMETFwd.h index 90be275bf24bc..db672b94715c7 100644 --- a/DataFormats/METReco/interface/PFMETFwd.h +++ b/DataFormats/METReco/interface/PFMETFwd.h @@ -9,7 +9,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class PFMET; + namespace io_v1 { + class PFMET; + } + using PFMET = io_v1::PFMET; /// collection of PFMET objects typedef std::vector PFMETCollection; /// edm references diff --git a/DataFormats/METReco/src/classes_def.xml b/DataFormats/METReco/src/classes_def.xml index 92980cf008e10..1dde59263de99 100644 --- a/DataFormats/METReco/src/classes_def.xml +++ b/DataFormats/METReco/src/classes_def.xml @@ -46,72 +46,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -133,25 +118,20 @@ - - - - - - - + + - - - + + + - - - - - + + + + + @@ -166,20 +146,15 @@ - - - + + - + - - - - - - + + - + @@ -188,30 +163,26 @@ - - + + - + - - - + + - + - - - - - + + - + - - + + diff --git a/DataFormats/MuonReco/interface/CaloMuon.h b/DataFormats/MuonReco/interface/CaloMuon.h index feaaad7c5ec4f..2f3526da66953 100644 --- a/DataFormats/MuonReco/interface/CaloMuon.h +++ b/DataFormats/MuonReco/interface/CaloMuon.h @@ -17,63 +17,67 @@ #include "DataFormats/TrackReco/interface/Track.h" namespace reco { + namespace io_v1 { - class CaloMuon { - public: - CaloMuon(); - virtual ~CaloMuon() {} + class CaloMuon { + public: + CaloMuon(); + virtual ~CaloMuon() {} - /// reference to Track reconstructed in the tracker only - virtual TrackRef innerTrack() const { return innerTrack_; } - virtual TrackRef track() const { return innerTrack(); } - /// set reference to Track - virtual void setInnerTrack(const TrackRef& t) { innerTrack_ = t; } - virtual void setTrack(const TrackRef& t) { setInnerTrack(t); } - /// energy deposition - bool isEnergyValid() const { return energyValid_; } - /// get energy deposition information - MuonEnergy calEnergy() const { return calEnergy_; } - /// set energy deposition information - void setCalEnergy(const MuonEnergy& calEnergy) { - calEnergy_ = calEnergy; - energyValid_ = true; - } + /// reference to Track reconstructed in the tracker only + virtual TrackRef innerTrack() const { return innerTrack_; } + virtual TrackRef track() const { return innerTrack(); } + /// set reference to Track + virtual void setInnerTrack(const TrackRef& t) { innerTrack_ = t; } + virtual void setTrack(const TrackRef& t) { setInnerTrack(t); } + /// energy deposition + bool isEnergyValid() const { return energyValid_; } + /// get energy deposition information + MuonEnergy calEnergy() const { return calEnergy_; } + /// set energy deposition information + void setCalEnergy(const MuonEnergy& calEnergy) { + calEnergy_ = calEnergy; + energyValid_ = true; + } - /// Muon hypothesis compatibility block - /// Relative likelihood based on ECAL, HCAL, HO energy defined as - /// L_muon/(L_muon+L_not_muon) - float caloCompatibility() const { return caloCompatibility_; } - void setCaloCompatibility(float input) { caloCompatibility_ = input; } - bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } + /// Muon hypothesis compatibility block + /// Relative likelihood based on ECAL, HCAL, HO energy defined as + /// L_muon/(L_muon+L_not_muon) + float caloCompatibility() const { return caloCompatibility_; } + void setCaloCompatibility(float input) { caloCompatibility_ = input; } + bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } - /// a bunch of useful accessors - int charge() const { return innerTrack_.get()->charge(); } - /// polar angle - double theta() const { return innerTrack_.get()->theta(); } - /// momentum vector magnitude - double p() const { return innerTrack_.get()->p(); } - /// track transverse momentum - double pt() const { return innerTrack_.get()->pt(); } - /// x coordinate of momentum vector - double px() const { return innerTrack_.get()->px(); } - /// y coordinate of momentum vector - double py() const { return innerTrack_.get()->py(); } - /// z coordinate of momentum vector - double pz() const { return innerTrack_.get()->pz(); } - /// azimuthal angle of momentum vector - double phi() const { return innerTrack_.get()->phi(); } - /// pseudorapidity of momentum vector - double eta() const { return innerTrack_.get()->eta(); } + /// a bunch of useful accessors + int charge() const { return innerTrack_.get()->charge(); } + /// polar angle + double theta() const { return innerTrack_.get()->theta(); } + /// momentum vector magnitude + double p() const { return innerTrack_.get()->p(); } + /// track transverse momentum + double pt() const { return innerTrack_.get()->pt(); } + /// x coordinate of momentum vector + double px() const { return innerTrack_.get()->px(); } + /// y coordinate of momentum vector + double py() const { return innerTrack_.get()->py(); } + /// z coordinate of momentum vector + double pz() const { return innerTrack_.get()->pz(); } + /// azimuthal angle of momentum vector + double phi() const { return innerTrack_.get()->phi(); } + /// pseudorapidity of momentum vector + double eta() const { return innerTrack_.get()->eta(); } - private: - /// reference to Track reconstructed in the tracker only - TrackRef innerTrack_; - /// energy deposition - MuonEnergy calEnergy_; - bool energyValid_; - /// muon hypothesis compatibility with observer calorimeter energy - float caloCompatibility_; - }; + private: + /// reference to Track reconstructed in the tracker only + TrackRef innerTrack_; + /// energy deposition + MuonEnergy calEnergy_; + bool energyValid_; + /// muon hypothesis compatibility with observer calorimeter energy + float caloCompatibility_; + }; + + } // namespace io_v1 + using CaloMuon = io_v1::CaloMuon; } // namespace reco diff --git a/DataFormats/MuonReco/interface/Muon.h b/DataFormats/MuonReco/interface/Muon.h index 6f19b0fa784d8..91a0f2a3c7f30 100644 --- a/DataFormats/MuonReco/interface/Muon.h +++ b/DataFormats/MuonReco/interface/Muon.h @@ -23,418 +23,421 @@ #include "DataFormats/TrackReco/interface/Track.h" namespace reco { + namespace io_v1 { + + class Muon : public RecoCandidate { + public: + Muon(); + /// constructor from values + Muon(Charge, const LorentzVector&, const Point& = Point(0, 0, 0)); + /// create a clone + Muon* clone() const override; + + /// map for Global Muon refitters + enum MuonTrackType { None, InnerTrack, OuterTrack, CombinedTrack, TPFMS, Picky, DYT }; + typedef std::map MuonTrackRefMap; + typedef std::pair MuonTrackTypePair; + + /// + /// ====================== TRACK BLOCK =========================== + /// + /// reference to Track reconstructed in the tracker only + using reco::RecoCandidate::track; + virtual TrackRef innerTrack() const { return innerTrack_; } + TrackRef track() const override { return innerTrack(); } + /// reference to Track reconstructed in the muon detector only + virtual TrackRef outerTrack() const { return outerTrack_; } + TrackRef standAloneMuon() const override { return outerTrack(); } + /// reference to Track reconstructed in both tracked and muon detector + virtual TrackRef globalTrack() const { return globalTrack_; } + TrackRef combinedMuon() const override { return globalTrack(); } + + virtual TrackRef tpfmsTrack() const { return muonTrackFromMap(TPFMS); } + virtual TrackRef pickyTrack() const { return muonTrackFromMap(Picky); } + virtual TrackRef dytTrack() const { return muonTrackFromMap(DYT); } + + const Track* bestTrack() const override { return muonTrack(bestTrackType_).get(); } + TrackBaseRef bestTrackRef() const override { return reco::TrackBaseRef(muonTrack(bestTrackType_)); } + virtual TrackRef muonBestTrack() const { return muonTrack(bestTrackType_); } + virtual MuonTrackType muonBestTrackType() const { return bestTrackType_; } + virtual TrackRef tunePMuonBestTrack() const { return muonTrack(bestTunePTrackType_); } + virtual MuonTrackType tunePMuonBestTrackType() const { return bestTunePTrackType_; } + + bool isAValidMuonTrack(const MuonTrackType& type) const; + TrackRef muonTrack(const MuonTrackType&) const; + + TrackRef muonTrackFromMap(const MuonTrackType& type) const { + MuonTrackRefMap::const_iterator iter = refittedTrackMap_.find(type); + if (iter != refittedTrackMap_.end()) + return iter->second; + else + return TrackRef(); + } - class Muon : public RecoCandidate { - public: - Muon(); - /// constructor from values - Muon(Charge, const LorentzVector&, const Point& = Point(0, 0, 0)); - /// create a clone - Muon* clone() const override; - - /// map for Global Muon refitters - enum MuonTrackType { None, InnerTrack, OuterTrack, CombinedTrack, TPFMS, Picky, DYT }; - typedef std::map MuonTrackRefMap; - typedef std::pair MuonTrackTypePair; - - /// - /// ====================== TRACK BLOCK =========================== - /// - /// reference to Track reconstructed in the tracker only - using reco::RecoCandidate::track; - virtual TrackRef innerTrack() const { return innerTrack_; } - TrackRef track() const override { return innerTrack(); } - /// reference to Track reconstructed in the muon detector only - virtual TrackRef outerTrack() const { return outerTrack_; } - TrackRef standAloneMuon() const override { return outerTrack(); } - /// reference to Track reconstructed in both tracked and muon detector - virtual TrackRef globalTrack() const { return globalTrack_; } - TrackRef combinedMuon() const override { return globalTrack(); } - - virtual TrackRef tpfmsTrack() const { return muonTrackFromMap(TPFMS); } - virtual TrackRef pickyTrack() const { return muonTrackFromMap(Picky); } - virtual TrackRef dytTrack() const { return muonTrackFromMap(DYT); } - - const Track* bestTrack() const override { return muonTrack(bestTrackType_).get(); } - TrackBaseRef bestTrackRef() const override { return reco::TrackBaseRef(muonTrack(bestTrackType_)); } - virtual TrackRef muonBestTrack() const { return muonTrack(bestTrackType_); } - virtual MuonTrackType muonBestTrackType() const { return bestTrackType_; } - virtual TrackRef tunePMuonBestTrack() const { return muonTrack(bestTunePTrackType_); } - virtual MuonTrackType tunePMuonBestTrackType() const { return bestTunePTrackType_; } - - bool isAValidMuonTrack(const MuonTrackType& type) const; - TrackRef muonTrack(const MuonTrackType&) const; - - TrackRef muonTrackFromMap(const MuonTrackType& type) const { - MuonTrackRefMap::const_iterator iter = refittedTrackMap_.find(type); - if (iter != refittedTrackMap_.end()) - return iter->second; - else - return TrackRef(); - } - - /// set reference to Track - virtual void setInnerTrack(const TrackRef& t); - virtual void setTrack(const TrackRef& t); - /// set reference to Track - virtual void setOuterTrack(const TrackRef& t); - virtual void setStandAlone(const TrackRef& t); - /// set reference to Track - virtual void setGlobalTrack(const TrackRef& t); - virtual void setCombined(const TrackRef& t); - // set reference to the Best Track - virtual void setBestTrack(MuonTrackType muonType) { bestTrackType_ = muonType; } - // set reference to the Best Track by PF - virtual void setTunePBestTrack(MuonTrackType muonType) { bestTunePTrackType_ = muonType; } - - void setMuonTrack(const MuonTrackType&, const TrackRef&); - - ///set reference to PFCandidate - /// - /// ====================== PF BLOCK =========================== - /// - - reco::Candidate::LorentzVector pfP4() const { return pfP4_; } - virtual void setPFP4(const reco::Candidate::LorentzVector& p4_); - - /// - /// ====================== ENERGY BLOCK =========================== - /// - /// energy deposition - bool isEnergyValid() const { return energyValid_; } - /// get energy deposition information - MuonEnergy calEnergy() const { return calEnergy_; } - /// set energy deposition information - void setCalEnergy(const MuonEnergy& calEnergy) { - calEnergy_ = calEnergy; - energyValid_ = true; - } - - /// - /// ====================== Quality BLOCK =========================== - /// - /// energy deposition - bool isQualityValid() const { return qualityValid_; } - /// get energy deposition information - MuonQuality combinedQuality() const { return combinedQuality_; } - /// set energy deposition information - void setCombinedQuality(const MuonQuality& combinedQuality) { - combinedQuality_ = combinedQuality; - qualityValid_ = true; - } - - /// - /// ====================== TIMING BLOCK =========================== - /// - /// timing information - bool isTimeValid() const { return (time_.nDof > 0); } - /// get DT/CSC combined timing information - MuonTime time() const { return time_; } - /// set DT/CSC combined timing information - void setTime(const MuonTime& time) { time_ = time; } - /// get RPC timing information - MuonTime rpcTime() const { return rpcTime_; } - /// set RPC timing information - void setRPCTime(const MuonTime& time) { rpcTime_ = time; } - - /// - /// ====================== MUON MATCH BLOCK =========================== - /// - bool isMatchesValid() const { return matchesValid_; } - /// get muon matching information - std::vector& matches() { return muMatches_; } - const std::vector& matches() const { return muMatches_; } - /// set muon matching information - void setMatches(const std::vector& matches) { - muMatches_ = matches; - matchesValid_ = true; - } - - /// - /// ====================== MUON COMPATIBILITY BLOCK =========================== - /// - /// Relative likelihood based on ECAL, HCAL, HO energy defined as - /// L_muon/(L_muon+L_not_muon) - float caloCompatibility() const { return caloCompatibility_; } - void setCaloCompatibility(float input) { caloCompatibility_ = input; } - bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } - - /// - /// ====================== ISOLATION BLOCK =========================== - /// - /// Summary of muon isolation information - const MuonIsolation& isolationR03() const { return isolationR03_; } - const MuonIsolation& isolationR05() const { return isolationR05_; } - - const MuonPFIsolation& pfIsolationR03() const { return pfIsolationR03_; } - const MuonPFIsolation& pfMeanDRIsoProfileR03() const { return pfIsoMeanDRR03_; } - const MuonPFIsolation& pfSumDRIsoProfileR03() const { return pfIsoSumDRR03_; } - const MuonPFIsolation& pfIsolationR04() const { return pfIsolationR04_; } - const MuonPFIsolation& pfMeanDRIsoProfileR04() const { return pfIsoMeanDRR04_; } - const MuonPFIsolation& pfSumDRIsoProfileR04() const { return pfIsoSumDRR04_; } - - void setIsolation(const MuonIsolation& isoR03, const MuonIsolation& isoR05); - bool isIsolationValid() const { return isolationValid_; } - void setPFIsolation(const std::string& label, const reco::MuonPFIsolation& deposit); - - bool isPFIsolationValid() const { return pfIsolationValid_; } - - /// define arbitration schemes - // WARNING: There can be not more than 7 arbritration types. If - // have more it will break the matching logic for types - // defined in MuonSegmentMatch - - enum ArbitrationType { - NoArbitration, - SegmentArbitration, - SegmentAndTrackArbitration, - SegmentAndTrackArbitrationCleaned, - RPCHitAndTrackArbitration, - GEMSegmentAndTrackArbitration, - ME0SegmentAndTrackArbitration, - GEMHitAndTrackArbitration - }; + /// set reference to Track + virtual void setInnerTrack(const TrackRef& t); + virtual void setTrack(const TrackRef& t); + /// set reference to Track + virtual void setOuterTrack(const TrackRef& t); + virtual void setStandAlone(const TrackRef& t); + /// set reference to Track + virtual void setGlobalTrack(const TrackRef& t); + virtual void setCombined(const TrackRef& t); + // set reference to the Best Track + virtual void setBestTrack(MuonTrackType muonType) { bestTrackType_ = muonType; } + // set reference to the Best Track by PF + virtual void setTunePBestTrack(MuonTrackType muonType) { bestTunePTrackType_ = muonType; } + + void setMuonTrack(const MuonTrackType&, const TrackRef&); + + ///set reference to PFCandidate + /// + /// ====================== PF BLOCK =========================== + /// + + reco::Candidate::LorentzVector pfP4() const { return pfP4_; } + virtual void setPFP4(const reco::Candidate::LorentzVector& p4_); + + /// + /// ====================== ENERGY BLOCK =========================== + /// + /// energy deposition + bool isEnergyValid() const { return energyValid_; } + /// get energy deposition information + MuonEnergy calEnergy() const { return calEnergy_; } + /// set energy deposition information + void setCalEnergy(const MuonEnergy& calEnergy) { + calEnergy_ = calEnergy; + energyValid_ = true; + } - /// - /// ====================== STANDARD SELECTORS =========================== - /// - // When adding new selectors, also update DataFormats/MuonReco/interface/MuonSelectors.h string to enum map - enum Selector { - CutBasedIdLoose = 0, - CutBasedIdMedium = 1, - CutBasedIdMediumPrompt = 2, // medium with IP cuts - CutBasedIdTight = 3, - CutBasedIdGlobalHighPt = 4, // high pt muon for Z',W' (better momentum resolution) - CutBasedIdTrkHighPt = 5, // high pt muon for boosted Z (better efficiency) - PFIsoVeryLoose = 6, // reliso<0.40 - PFIsoLoose = 7, // reliso<0.25 - PFIsoMedium = 8, // reliso<0.20 - PFIsoTight = 9, // reliso<0.15 - PFIsoVeryTight = 10, // reliso<0.10 - TkIsoLoose = 11, // reliso<0.10 - TkIsoTight = 12, // reliso<0.05 - SoftCutBasedId = 13, - SoftMvaId = 14, - MvaLoose = 15, - MvaMedium = 16, - MvaTight = 17, - MiniIsoLoose = 18, // reliso<0.40 - MiniIsoMedium = 19, // reliso<0.20 - MiniIsoTight = 20, // reliso<0.10 - MiniIsoVeryTight = 21, // reliso<0.05 - TriggerIdLoose = 22, // robust selector for HLT - InTimeMuon = 23, - PFIsoVeryVeryTight = 24, // reliso<0.05 - MultiIsoLoose = 25, // miniIso with ptRatio and ptRel - MultiIsoMedium = 26, // miniIso with ptRatio and ptRel - PuppiIsoLoose = 27, - PuppiIsoMedium = 28, - PuppiIsoTight = 29, - MvaVTight = 30, - MvaVVTight = 31, - LowPtMvaLoose = 32, - LowPtMvaMedium = 33, - MvaIDwpMedium = 34, - MvaIDwpTight = 35, - }; + /// + /// ====================== Quality BLOCK =========================== + /// + /// energy deposition + bool isQualityValid() const { return qualityValid_; } + /// get energy deposition information + MuonQuality combinedQuality() const { return combinedQuality_; } + /// set energy deposition information + void setCombinedQuality(const MuonQuality& combinedQuality) { + combinedQuality_ = combinedQuality; + qualityValid_ = true; + } - bool passed(uint64_t selection) const { return (selectors_ & selection) == selection; } - bool passed(Selector selection) const { return passed(static_cast(1UL << selection)); } - uint64_t selectors() const { return selectors_; } - void setSelectors(uint64_t selectors) { selectors_ = selectors; } - void setSelector(Selector selector, bool passed) { - auto selector64 = 1UL << selector; - if (passed) - selectors_ |= selector64; - else - selectors_ &= ~selector64; - } - - /// - /// ====================== USEFUL METHODs =========================== - /// - /// number of chambers (MuonChamberMatches include RPC rolls, GEM and ME0 segments) - int numberOfChambers() const { return muMatches_.size(); } - /// number of chambers CSC or DT matches only (MuonChamberMatches include RPC rolls) - int numberOfChambersCSCorDT() const; - /// get number of chambers with matched segments - int numberOfMatches(ArbitrationType type = SegmentAndTrackArbitration) const; - /// get number of stations with matched segments - /// just adds the bits returned by stationMask - int numberOfMatchedStations(ArbitrationType type = SegmentAndTrackArbitration) const; - /// expected number of stations with matching segments based on the absolute - /// distance from the edge of a chamber - unsigned int expectedNnumberOfMatchedStations(float minDistanceFromEdge = 10.0) const; - /// get bit map of stations with matched segments - /// bits 0-1-2-3 = DT stations 1-2-3-4 - /// bits 4-5-6-7 = CSC stations 1-2-3-4 - unsigned int stationMask(ArbitrationType type = SegmentAndTrackArbitration) const; - /// get bit map of stations with tracks within - /// given distance (in cm) of chamber edges - /// bit assignments are same as above - int numberOfMatchedRPCLayers(ArbitrationType type = RPCHitAndTrackArbitration) const; - unsigned int RPClayerMask(ArbitrationType type = RPCHitAndTrackArbitration) const; - unsigned int stationGapMaskDistance(float distanceCut = 10.) const; - /// same as above for given number of sigmas - unsigned int stationGapMaskPull(float sigmaCut = 3.) const; - /// # of digis in a given station layer - int nDigisInStation(int station, int muonSubdetId) const; - /// tag a shower in a given station layer - bool hasShowerInStation(int station, int muonSubdetId, int nDtDigisCut = 20, int nCscDigisCut = 36) const; - /// count the number of showers along a muon track - int numberOfShowers(int nDtDigisCut = 20, int nCscDigisCut = 36) const; - - /// muon type - type of the algorithm that reconstructed this muon - /// multiple algorithms can reconstruct the same muon - static const unsigned int GlobalMuon = 1 << 1; - static const unsigned int TrackerMuon = 1 << 2; - static const unsigned int StandAloneMuon = 1 << 3; - static const unsigned int CaloMuon = 1 << 4; - static const unsigned int PFMuon = 1 << 5; - static const unsigned int RPCMuon = 1 << 6; - static const unsigned int GEMMuon = 1 << 7; - static const unsigned int ME0Muon = 1 << 8; - - void setType(unsigned int type) { type_ = type; } - unsigned int type() const { return type_; } - - // override of method in base class reco::Candidate - bool isMuon() const override { return true; } - bool isGlobalMuon() const override { return type_ & GlobalMuon; } - bool isTrackerMuon() const override { return type_ & TrackerMuon; } - bool isStandAloneMuon() const override { return type_ & StandAloneMuon; } - bool isCaloMuon() const override { return type_ & CaloMuon; } - bool isPFMuon() const { return type_ & PFMuon; } //fix me ! Has to go to type - bool isRPCMuon() const { return type_ & RPCMuon; } - bool isGEMMuon() const { return type_ & GEMMuon; } - bool isME0Muon() const { return type_ & ME0Muon; } - - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to Track reconstructed in the tracker only - TrackRef innerTrack_; - /// reference to Track reconstructed in the muon detector only - TrackRef outerTrack_; - /// reference to Track reconstructed in both tracked and muon detector - TrackRef globalTrack_; - /// reference to the Global Track refitted with dedicated TeV reconstructors - MuonTrackRefMap refittedTrackMap_; - /// reference to the Track chosen to assign the momentum value to the muon - MuonTrackType bestTrackType_; - /// reference to the Track chosen to assign the momentum value to the muon by PF - MuonTrackType bestTunePTrackType_; - - /// energy deposition - MuonEnergy calEnergy_; - /// quality block - MuonQuality combinedQuality_; - /// Information on matching between tracks and segments - std::vector muMatches_; - /// timing - MuonTime time_; - MuonTime rpcTime_; - bool energyValid_; - bool matchesValid_; - bool isolationValid_; - bool pfIsolationValid_; - bool qualityValid_; - /// muon hypothesis compatibility with observer calorimeter energy - float caloCompatibility_; - /// Isolation information for two cones with dR=0.3 and dR=0.5 - MuonIsolation isolationR03_; - MuonIsolation isolationR05_; - - /// PF Isolation information for two cones with dR=0.3 and dR=0.4 - MuonPFIsolation pfIsolationR03_; - MuonPFIsolation pfIsoMeanDRR03_; - MuonPFIsolation pfIsoSumDRR03_; - MuonPFIsolation pfIsolationR04_; - MuonPFIsolation pfIsoMeanDRR04_; - MuonPFIsolation pfIsoSumDRR04_; - - /// muon type mask - unsigned int type_; - - //PF muon p4 - reco::Candidate::LorentzVector pfP4_; - - // FixMe: Still missing trigger information - - /// get vector of muon chambers for given station and detector - const std::vector chambers(int station, int muonSubdetId) const; - /// get pointers to best segment and corresponding chamber in vector of chambers - std::pair pair( - const std::vector&, ArbitrationType type = SegmentAndTrackArbitration) const; - /// selector bitmap - uint64_t selectors_; - - public: - /// get number of segments - int numberOfSegments(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - /// get deltas between (best) segment and track - /// If no chamber or no segment returns 999999 - float dX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float dY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float dDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float dDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float pullX(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - float pullY(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - float pullDxDz(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - float pullDyDz(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - /// get (best) segment information - /// If no segment returns 999999 - float segmentX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - /// get track information in chamber that contains (best) segment - /// If no segment, get track information in chamber that has the most negative distance between the track - /// and the nearest chamber edge (the chamber with the deepest track) - /// If no chamber returns 999999 - float trackEdgeX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackEdgeY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDist(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDistErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - - float t0(int n = 0) { - int i = 0; - for (auto& chamber : muMatches_) { - int segmentMatchesSize = (int)chamber.segmentMatches.size(); - if (i + segmentMatchesSize < n) { - i += segmentMatchesSize; - continue; + /// + /// ====================== TIMING BLOCK =========================== + /// + /// timing information + bool isTimeValid() const { return (time_.nDof > 0); } + /// get DT/CSC combined timing information + MuonTime time() const { return time_; } + /// set DT/CSC combined timing information + void setTime(const MuonTime& time) { time_ = time; } + /// get RPC timing information + MuonTime rpcTime() const { return rpcTime_; } + /// set RPC timing information + void setRPCTime(const MuonTime& time) { rpcTime_ = time; } + + /// + /// ====================== MUON MATCH BLOCK =========================== + /// + bool isMatchesValid() const { return matchesValid_; } + /// get muon matching information + std::vector& matches() { return muMatches_; } + const std::vector& matches() const { return muMatches_; } + /// set muon matching information + void setMatches(const std::vector& matches) { + muMatches_ = matches; + matchesValid_ = true; + } + + /// + /// ====================== MUON COMPATIBILITY BLOCK =========================== + /// + /// Relative likelihood based on ECAL, HCAL, HO energy defined as + /// L_muon/(L_muon+L_not_muon) + float caloCompatibility() const { return caloCompatibility_; } + void setCaloCompatibility(float input) { caloCompatibility_ = input; } + bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } + + /// + /// ====================== ISOLATION BLOCK =========================== + /// + /// Summary of muon isolation information + const MuonIsolation& isolationR03() const { return isolationR03_; } + const MuonIsolation& isolationR05() const { return isolationR05_; } + + const MuonPFIsolation& pfIsolationR03() const { return pfIsolationR03_; } + const MuonPFIsolation& pfMeanDRIsoProfileR03() const { return pfIsoMeanDRR03_; } + const MuonPFIsolation& pfSumDRIsoProfileR03() const { return pfIsoSumDRR03_; } + const MuonPFIsolation& pfIsolationR04() const { return pfIsolationR04_; } + const MuonPFIsolation& pfMeanDRIsoProfileR04() const { return pfIsoMeanDRR04_; } + const MuonPFIsolation& pfSumDRIsoProfileR04() const { return pfIsoSumDRR04_; } + + void setIsolation(const MuonIsolation& isoR03, const MuonIsolation& isoR05); + bool isIsolationValid() const { return isolationValid_; } + void setPFIsolation(const std::string& label, const reco::MuonPFIsolation& deposit); + + bool isPFIsolationValid() const { return pfIsolationValid_; } + + /// define arbitration schemes + // WARNING: There can be not more than 7 arbritration types. If + // have more it will break the matching logic for types + // defined in MuonSegmentMatch + + enum ArbitrationType { + NoArbitration, + SegmentArbitration, + SegmentAndTrackArbitration, + SegmentAndTrackArbitrationCleaned, + RPCHitAndTrackArbitration, + GEMSegmentAndTrackArbitration, + ME0SegmentAndTrackArbitration, + GEMHitAndTrackArbitration + }; + + /// + /// ====================== STANDARD SELECTORS =========================== + /// + // When adding new selectors, also update DataFormats/MuonReco/interface/MuonSelectors.h string to enum map + enum Selector { + CutBasedIdLoose = 0, + CutBasedIdMedium = 1, + CutBasedIdMediumPrompt = 2, // medium with IP cuts + CutBasedIdTight = 3, + CutBasedIdGlobalHighPt = 4, // high pt muon for Z',W' (better momentum resolution) + CutBasedIdTrkHighPt = 5, // high pt muon for boosted Z (better efficiency) + PFIsoVeryLoose = 6, // reliso<0.40 + PFIsoLoose = 7, // reliso<0.25 + PFIsoMedium = 8, // reliso<0.20 + PFIsoTight = 9, // reliso<0.15 + PFIsoVeryTight = 10, // reliso<0.10 + TkIsoLoose = 11, // reliso<0.10 + TkIsoTight = 12, // reliso<0.05 + SoftCutBasedId = 13, + SoftMvaId = 14, + MvaLoose = 15, + MvaMedium = 16, + MvaTight = 17, + MiniIsoLoose = 18, // reliso<0.40 + MiniIsoMedium = 19, // reliso<0.20 + MiniIsoTight = 20, // reliso<0.10 + MiniIsoVeryTight = 21, // reliso<0.05 + TriggerIdLoose = 22, // robust selector for HLT + InTimeMuon = 23, + PFIsoVeryVeryTight = 24, // reliso<0.05 + MultiIsoLoose = 25, // miniIso with ptRatio and ptRel + MultiIsoMedium = 26, // miniIso with ptRatio and ptRel + PuppiIsoLoose = 27, + PuppiIsoMedium = 28, + PuppiIsoTight = 29, + MvaVTight = 30, + MvaVVTight = 31, + LowPtMvaLoose = 32, + LowPtMvaMedium = 33, + MvaIDwpMedium = 34, + MvaIDwpTight = 35, + }; + + bool passed(uint64_t selection) const { return (selectors_ & selection) == selection; } + bool passed(Selector selection) const { return passed(static_cast(1UL << selection)); } + uint64_t selectors() const { return selectors_; } + void setSelectors(uint64_t selectors) { selectors_ = selectors; } + void setSelector(Selector selector, bool passed) { + auto selector64 = 1UL << selector; + if (passed) + selectors_ |= selector64; + else + selectors_ &= ~selector64; + } + + /// + /// ====================== USEFUL METHODs =========================== + /// + /// number of chambers (MuonChamberMatches include RPC rolls, GEM and ME0 segments) + int numberOfChambers() const { return muMatches_.size(); } + /// number of chambers CSC or DT matches only (MuonChamberMatches include RPC rolls) + int numberOfChambersCSCorDT() const; + /// get number of chambers with matched segments + int numberOfMatches(ArbitrationType type = SegmentAndTrackArbitration) const; + /// get number of stations with matched segments + /// just adds the bits returned by stationMask + int numberOfMatchedStations(ArbitrationType type = SegmentAndTrackArbitration) const; + /// expected number of stations with matching segments based on the absolute + /// distance from the edge of a chamber + unsigned int expectedNnumberOfMatchedStations(float minDistanceFromEdge = 10.0) const; + /// get bit map of stations with matched segments + /// bits 0-1-2-3 = DT stations 1-2-3-4 + /// bits 4-5-6-7 = CSC stations 1-2-3-4 + unsigned int stationMask(ArbitrationType type = SegmentAndTrackArbitration) const; + /// get bit map of stations with tracks within + /// given distance (in cm) of chamber edges + /// bit assignments are same as above + int numberOfMatchedRPCLayers(ArbitrationType type = RPCHitAndTrackArbitration) const; + unsigned int RPClayerMask(ArbitrationType type = RPCHitAndTrackArbitration) const; + unsigned int stationGapMaskDistance(float distanceCut = 10.) const; + /// same as above for given number of sigmas + unsigned int stationGapMaskPull(float sigmaCut = 3.) const; + /// # of digis in a given station layer + int nDigisInStation(int station, int muonSubdetId) const; + /// tag a shower in a given station layer + bool hasShowerInStation(int station, int muonSubdetId, int nDtDigisCut = 20, int nCscDigisCut = 36) const; + /// count the number of showers along a muon track + int numberOfShowers(int nDtDigisCut = 20, int nCscDigisCut = 36) const; + + /// muon type - type of the algorithm that reconstructed this muon + /// multiple algorithms can reconstruct the same muon + static const unsigned int GlobalMuon = 1 << 1; + static const unsigned int TrackerMuon = 1 << 2; + static const unsigned int StandAloneMuon = 1 << 3; + static const unsigned int CaloMuon = 1 << 4; + static const unsigned int PFMuon = 1 << 5; + static const unsigned int RPCMuon = 1 << 6; + static const unsigned int GEMMuon = 1 << 7; + static const unsigned int ME0Muon = 1 << 8; + + void setType(unsigned int type) { type_ = type; } + unsigned int type() const { return type_; } + + // override of method in base class reco::Candidate + bool isMuon() const override { return true; } + bool isGlobalMuon() const override { return type_ & GlobalMuon; } + bool isTrackerMuon() const override { return type_ & TrackerMuon; } + bool isStandAloneMuon() const override { return type_ & StandAloneMuon; } + bool isCaloMuon() const override { return type_ & CaloMuon; } + bool isPFMuon() const { return type_ & PFMuon; } //fix me ! Has to go to type + bool isRPCMuon() const { return type_ & RPCMuon; } + bool isGEMMuon() const { return type_ & GEMMuon; } + bool isME0Muon() const { return type_ & ME0Muon; } + + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to Track reconstructed in the tracker only + TrackRef innerTrack_; + /// reference to Track reconstructed in the muon detector only + TrackRef outerTrack_; + /// reference to Track reconstructed in both tracked and muon detector + TrackRef globalTrack_; + /// reference to the Global Track refitted with dedicated TeV reconstructors + MuonTrackRefMap refittedTrackMap_; + /// reference to the Track chosen to assign the momentum value to the muon + MuonTrackType bestTrackType_; + /// reference to the Track chosen to assign the momentum value to the muon by PF + MuonTrackType bestTunePTrackType_; + + /// energy deposition + MuonEnergy calEnergy_; + /// quality block + MuonQuality combinedQuality_; + /// Information on matching between tracks and segments + std::vector muMatches_; + /// timing + MuonTime time_; + MuonTime rpcTime_; + bool energyValid_; + bool matchesValid_; + bool isolationValid_; + bool pfIsolationValid_; + bool qualityValid_; + /// muon hypothesis compatibility with observer calorimeter energy + float caloCompatibility_; + /// Isolation information for two cones with dR=0.3 and dR=0.5 + MuonIsolation isolationR03_; + MuonIsolation isolationR05_; + + /// PF Isolation information for two cones with dR=0.3 and dR=0.4 + MuonPFIsolation pfIsolationR03_; + MuonPFIsolation pfIsoMeanDRR03_; + MuonPFIsolation pfIsoSumDRR03_; + MuonPFIsolation pfIsolationR04_; + MuonPFIsolation pfIsoMeanDRR04_; + MuonPFIsolation pfIsoSumDRR04_; + + /// muon type mask + unsigned int type_; + + //PF muon p4 + reco::Candidate::LorentzVector pfP4_; + + // FixMe: Still missing trigger information + + /// get vector of muon chambers for given station and detector + const std::vector chambers(int station, int muonSubdetId) const; + /// get pointers to best segment and corresponding chamber in vector of chambers + std::pair pair( + const std::vector&, ArbitrationType type = SegmentAndTrackArbitration) const; + /// selector bitmap + uint64_t selectors_; + + public: + /// get number of segments + int numberOfSegments(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + /// get deltas between (best) segment and track + /// If no chamber or no segment returns 999999 + float dX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float dY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float dDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float dDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float pullX(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + float pullY(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + float pullDxDz(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + float pullDyDz(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + /// get (best) segment information + /// If no segment returns 999999 + float segmentX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + /// get track information in chamber that contains (best) segment + /// If no segment, get track information in chamber that has the most negative distance between the track + /// and the nearest chamber edge (the chamber with the deepest track) + /// If no chamber returns 999999 + float trackEdgeX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackEdgeY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDist(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDistErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + + float t0(int n = 0) { + int i = 0; + for (auto& chamber : muMatches_) { + int segmentMatchesSize = (int)chamber.segmentMatches.size(); + if (i + segmentMatchesSize < n) { + i += segmentMatchesSize; + continue; + } + return chamber.segmentMatches[n - i].t0; } - return chamber.segmentMatches[n - i].t0; + return 0; } - return 0; - } - }; + }; + } // namespace io_v1 + using Muon = io_v1::Muon; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h b/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h index 0716eb833ad67..7af18504b01db 100644 --- a/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h +++ b/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h @@ -2,27 +2,30 @@ #define MuonReco_MuonCosmicCompatibility_h namespace reco { - struct MuonCosmicCompatibility { - /// combined cosmic-likeness: 0 == not cosmic-like - float cosmicCompatibility; - /// cosmic-likeness based on time: 0 == prompt-like - float timeCompatibility; - /// cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks - float backToBackCompatibility; - /// cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used) - float overlapCompatibility; - /// cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like - float ipCompatibility; - /// cosmic-likeness based on the event activity information: tracker track multiplicity and vertex quality. 0 == cosmic-like - float vertexCompatibility; + namespace io_v1 { + struct MuonCosmicCompatibility { + /// combined cosmic-likeness: 0 == not cosmic-like + float cosmicCompatibility; + /// cosmic-likeness based on time: 0 == prompt-like + float timeCompatibility; + /// cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks + float backToBackCompatibility; + /// cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used) + float overlapCompatibility; + /// cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like + float ipCompatibility; + /// cosmic-likeness based on the event activity information: tracker track multiplicity and vertex quality. 0 == cosmic-like + float vertexCompatibility; - MuonCosmicCompatibility() - : cosmicCompatibility(0), - timeCompatibility(0), - backToBackCompatibility(0), - overlapCompatibility(0), - ipCompatibility(0), - vertexCompatibility(0) {} - }; + MuonCosmicCompatibility() + : cosmicCompatibility(0), + timeCompatibility(0), + backToBackCompatibility(0), + overlapCompatibility(0), + ipCompatibility(0), + vertexCompatibility(0) {} + }; + } // namespace io_v1 + using MuonCosmicCompatibility = io_v1::MuonCosmicCompatibility; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonFwd.h b/DataFormats/MuonReco/interface/MuonFwd.h index fa351f8363016..401745a5e8f72 100644 --- a/DataFormats/MuonReco/interface/MuonFwd.h +++ b/DataFormats/MuonReco/interface/MuonFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Muon; + namespace io_v1 { + class Muon; + } + using Muon = io_v1::Muon; /// collection of Muon objects typedef std::vector MuonCollection; /// presistent reference to a Muon @@ -19,12 +22,16 @@ namespace reco { typedef MuonRefVector::iterator muon_iterator; /// Links between the three tracks which can define a muon - class MuonTrackLinks; - + namespace io_v1 { + class MuonTrackLinks; + } + using MuonTrackLinks = io_v1::MuonTrackLinks; /// collection of MuonTrackLinks typedef std::vector MuonTrackLinksCollection; - - class CaloMuon; + namespace io_v1 { + class CaloMuon; + } + using CaloMuon = io_v1::CaloMuon; /// collection of Muon objects typedef std::vector CaloMuonCollection; } // namespace reco diff --git a/DataFormats/MuonReco/interface/MuonMETCorrectionData.h b/DataFormats/MuonReco/interface/MuonMETCorrectionData.h index cb38bd46d980d..73067e7bbc753 100644 --- a/DataFormats/MuonReco/interface/MuonMETCorrectionData.h +++ b/DataFormats/MuonReco/interface/MuonMETCorrectionData.h @@ -4,37 +4,40 @@ #include namespace reco { - class MuonMETCorrectionData { - public: - enum Type { - NotUsed = 0, - CombinedTrackUsed = 1, - GlobalTrackUsed = 1, - InnerTrackUsed = 2, - TrackUsed = 2, - OuterTrackUsed = 3, - StandAloneTrackUsed = 3, - TreatedAsPion = 4, - MuonP4V4QUsed = 5, - MuonCandidateValuesUsed = 5 - }; + namespace io_v1 { + class MuonMETCorrectionData { + public: + enum Type { + NotUsed = 0, + CombinedTrackUsed = 1, + GlobalTrackUsed = 1, + InnerTrackUsed = 2, + TrackUsed = 2, + OuterTrackUsed = 3, + StandAloneTrackUsed = 3, + TreatedAsPion = 4, + MuonP4V4QUsed = 5, + MuonCandidateValuesUsed = 5 + }; - MuonMETCorrectionData() : type_(0), corrX_(0), corrY_(0) {} - MuonMETCorrectionData(Type type, float corrX, float corrY) : type_(type), corrX_(corrX), corrY_(corrY) {} + MuonMETCorrectionData() : type_(0), corrX_(0), corrY_(0) {} + MuonMETCorrectionData(Type type, float corrX, float corrY) : type_(type), corrX_(corrX), corrY_(corrY) {} - Type type() { return Type(type_); } - float corrX() { return corrX_; } - float corrY() { return corrY_; } - float x() { return corrX_; } - float y() { return corrY_; } - float pt() { return sqrt(x() * x() + y() * y()); } + Type type() { return Type(type_); } + float corrX() { return corrX_; } + float corrY() { return corrY_; } + float x() { return corrX_; } + float y() { return corrY_; } + float pt() { return sqrt(x() * x() + y() * y()); } - protected: - int type_; - float corrX_; - float corrY_; - }; + protected: + int type_; + float corrX_; + float corrY_; + }; + } // namespace io_v1 + using MuonMETCorrectionData = io_v1::MuonMETCorrectionData; } // namespace reco #endif //MuonReco_MuonMETCorrectionData_h diff --git a/DataFormats/MuonReco/interface/MuonShower.h b/DataFormats/MuonReco/interface/MuonShower.h index 79e92c746c542..45f3f39269b70 100644 --- a/DataFormats/MuonReco/interface/MuonShower.h +++ b/DataFormats/MuonReco/interface/MuonShower.h @@ -4,17 +4,20 @@ #include namespace reco { - struct MuonShower { - /// number of all the muon RecHits per chamber crossed by a track (1D hits) - std::vector nStationHits; - /// number of the muon RecHits used by segments per chamber crossed by a track - std::vector nStationCorrelatedHits; - /// the transverse size of the hit cluster - std::vector stationShowerSizeT; - /// the radius of the cone containing the all the hits around the track - std::vector stationShowerDeltaR; + namespace io_v1 { + struct MuonShower { + /// number of all the muon RecHits per chamber crossed by a track (1D hits) + std::vector nStationHits; + /// number of the muon RecHits used by segments per chamber crossed by a track + std::vector nStationCorrelatedHits; + /// the transverse size of the hit cluster + std::vector stationShowerSizeT; + /// the radius of the cone containing the all the hits around the track + std::vector stationShowerDeltaR; - MuonShower() : nStationHits(0), nStationCorrelatedHits(0), stationShowerSizeT(0), stationShowerDeltaR(0) {} - }; + MuonShower() : nStationHits(0), nStationCorrelatedHits(0), stationShowerSizeT(0), stationShowerDeltaR(0) {} + }; + } // namespace io_v1 + using MuonShower = io_v1::MuonShower; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonSimInfo.h b/DataFormats/MuonReco/interface/MuonSimInfo.h index 819c5c87e618d..7d09d57fb630a 100644 --- a/DataFormats/MuonReco/interface/MuonSimInfo.h +++ b/DataFormats/MuonReco/interface/MuonSimInfo.h @@ -71,31 +71,35 @@ namespace reco { }; - class MuonSimInfo { - public: - MuonSimInfo(); - typedef math::XYZPointD Point; ///< point in the space - typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector - MuonSimType primaryClass; - ExtendedMuonSimType extendedClass; - int flavour; - int pdgId; // pdg ID of matching tracking particle - int g4processType; // Geant process producing the particle - int motherPdgId; - int motherFlavour; - int motherStatus; // Status of the first gen particle - int grandMotherPdgId; - int grandMotherFlavour; - int heaviestMotherFlavour; - int tpId; - int tpEvent; - int tpBX; // bunch crossing - int charge; - LorentzVector p4; - Point vertex; - Point motherVertex; - float tpAssoQuality; - }; + namespace io_v1 { + + class MuonSimInfo { + public: + MuonSimInfo(); + typedef math::XYZPointD Point; ///< point in the space + typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector + MuonSimType primaryClass; + ExtendedMuonSimType extendedClass; + int flavour; + int pdgId; // pdg ID of matching tracking particle + int g4processType; // Geant process producing the particle + int motherPdgId; + int motherFlavour; + int motherStatus; // Status of the first gen particle + int grandMotherPdgId; + int grandMotherFlavour; + int heaviestMotherFlavour; + int tpId; + int tpEvent; + int tpBX; // bunch crossing + int charge; + LorentzVector p4; + Point vertex; + Point motherVertex; + float tpAssoQuality; + }; + } // namespace io_v1 + using MuonSimInfo = io_v1::MuonSimInfo; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonTimeExtra.h b/DataFormats/MuonReco/interface/MuonTimeExtra.h index 545f754715aca..4459e0ac6a1c8 100644 --- a/DataFormats/MuonReco/interface/MuonTimeExtra.h +++ b/DataFormats/MuonReco/interface/MuonTimeExtra.h @@ -11,73 +11,76 @@ */ namespace reco { + namespace io_v1 { - class MuonTimeExtra { - public: - MuonTimeExtra(); + class MuonTimeExtra { + public: + MuonTimeExtra(); - enum Direction { OutsideIn = -1, Undefined = 0, InsideOut = 1 }; + enum Direction { OutsideIn = -1, Undefined = 0, InsideOut = 1 }; - /// number of measurements used in timing calculation - int nDof() const { return nDof_; }; - void setNDof(const int nDof) { nDof_ = nDof; }; + /// number of measurements used in timing calculation + int nDof() const { return nDof_; }; + void setNDof(const int nDof) { nDof_ = nDof; }; - /// 1/beta for prompt particle hypothesis - /// (time is constraint to the bunch crossing time) - float inverseBeta() const { return inverseBeta_; }; - float inverseBetaErr() const { return inverseBetaErr_; }; - void setInverseBeta(const float iBeta) { inverseBeta_ = iBeta; }; - void setInverseBetaErr(const float iBetaErr) { inverseBetaErr_ = iBetaErr; }; + /// 1/beta for prompt particle hypothesis + /// (time is constraint to the bunch crossing time) + float inverseBeta() const { return inverseBeta_; }; + float inverseBetaErr() const { return inverseBetaErr_; }; + void setInverseBeta(const float iBeta) { inverseBeta_ = iBeta; }; + void setInverseBetaErr(const float iBetaErr) { inverseBetaErr_ = iBetaErr; }; - /// unconstrained 1/beta (time is free) - /// Sign convention: - /// positive - outward moving particle - /// negative - inward moving particle - float freeInverseBeta() const { return freeInverseBeta_; }; - float freeInverseBetaErr() const { return freeInverseBetaErr_; }; - void setFreeInverseBeta(const float iBeta) { freeInverseBeta_ = iBeta; }; - void setFreeInverseBetaErr(const float iBetaErr) { freeInverseBetaErr_ = iBetaErr; }; + /// unconstrained 1/beta (time is free) + /// Sign convention: + /// positive - outward moving particle + /// negative - inward moving particle + float freeInverseBeta() const { return freeInverseBeta_; }; + float freeInverseBetaErr() const { return freeInverseBetaErr_; }; + void setFreeInverseBeta(const float iBeta) { freeInverseBeta_ = iBeta; }; + void setFreeInverseBetaErr(const float iBetaErr) { freeInverseBetaErr_ = iBetaErr; }; - /// time of arrival at the IP for the Beta=1 hypothesis - /// a) particle is moving from inside out - float timeAtIpInOut() const { return timeAtIpInOut_; }; - float timeAtIpInOutErr() const { return timeAtIpInOutErr_; }; - void setTimeAtIpInOut(const float timeIp) { timeAtIpInOut_ = timeIp; }; - void setTimeAtIpInOutErr(const float timeErr) { timeAtIpInOutErr_ = timeErr; }; - /// b) particle is moving from outside in - float timeAtIpOutIn() const { return timeAtIpOutIn_; }; - float timeAtIpOutInErr() const { return timeAtIpOutInErr_; }; - void setTimeAtIpOutIn(const float timeIp) { timeAtIpOutIn_ = timeIp; }; - void setTimeAtIpOutInErr(const float timeErr) { timeAtIpOutInErr_ = timeErr; }; + /// time of arrival at the IP for the Beta=1 hypothesis + /// a) particle is moving from inside out + float timeAtIpInOut() const { return timeAtIpInOut_; }; + float timeAtIpInOutErr() const { return timeAtIpInOutErr_; }; + void setTimeAtIpInOut(const float timeIp) { timeAtIpInOut_ = timeIp; }; + void setTimeAtIpInOutErr(const float timeErr) { timeAtIpInOutErr_ = timeErr; }; + /// b) particle is moving from outside in + float timeAtIpOutIn() const { return timeAtIpOutIn_; }; + float timeAtIpOutInErr() const { return timeAtIpOutInErr_; }; + void setTimeAtIpOutIn(const float timeIp) { timeAtIpOutIn_ = timeIp; }; + void setTimeAtIpOutInErr(const float timeErr) { timeAtIpOutInErr_ = timeErr; }; - /// direction estimation based on time dispersion - Direction direction() const { - if (nDof_ < 2) - return Undefined; - if (timeAtIpInOutErr_ > timeAtIpOutInErr_) - return OutsideIn; - return InsideOut; - } + /// direction estimation based on time dispersion + Direction direction() const { + if (nDof_ < 2) + return Undefined; + if (timeAtIpInOutErr_ > timeAtIpOutInErr_) + return OutsideIn; + return InsideOut; + } - private: - /// number of measurements used in timing calculation - int nDof_; + private: + /// number of measurements used in timing calculation + int nDof_; - /// 1/beta for prompt particle hypothesis - float inverseBeta_; - float inverseBetaErr_; + /// 1/beta for prompt particle hypothesis + float inverseBeta_; + float inverseBetaErr_; - /// unconstrained 1/beta (time is free) - float freeInverseBeta_; - float freeInverseBetaErr_; + /// unconstrained 1/beta (time is free) + float freeInverseBeta_; + float freeInverseBetaErr_; - /// time of arrival at the IP for the Beta=1 hypothesis - float timeAtIpInOut_; - float timeAtIpInOutErr_; - float timeAtIpOutIn_; - float timeAtIpOutInErr_; - }; + /// time of arrival at the IP for the Beta=1 hypothesis + float timeAtIpInOut_; + float timeAtIpInOutErr_; + float timeAtIpOutIn_; + float timeAtIpOutInErr_; + }; + } // namespace io_v1 + using MuonTimeExtra = io_v1::MuonTimeExtra; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h b/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h index 4ccab26f7eeec..f0cdc5714e479 100644 --- a/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h +++ b/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/ValueMap.h" namespace reco { - class MuonTimeExtra; + namespace io_v1 { + class MuonTimeExtra; + } + using MuonTimeExtra = io_v1::MuonTimeExtra; /// collection of MuonTimeExtra objects /* typedef std::vector MuonTimeExtraCollection; diff --git a/DataFormats/MuonReco/interface/MuonTrackLinks.h b/DataFormats/MuonReco/interface/MuonTrackLinks.h index 4e2d08cd17320..c9bb9c3593aa7 100644 --- a/DataFormats/MuonReco/interface/MuonTrackLinks.h +++ b/DataFormats/MuonReco/interface/MuonTrackLinks.h @@ -12,49 +12,52 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" namespace reco { + namespace io_v1 { - class MuonTrackLinks { - public: - /// Default Constructor - MuonTrackLinks() {} + class MuonTrackLinks { + public: + /// Default Constructor + MuonTrackLinks() {} - /// Constructor - MuonTrackLinks(reco::TrackRef tk, reco::TrackRef sta, reco::TrackRef glb) - : theTkTrack(tk), theStaTrack(sta), theGlbTrack(glb) {} + /// Constructor + MuonTrackLinks(reco::TrackRef tk, reco::TrackRef sta, reco::TrackRef glb) + : theTkTrack(tk), theStaTrack(sta), theGlbTrack(glb) {} - /// Destructor - virtual ~MuonTrackLinks() {} + /// Destructor + virtual ~MuonTrackLinks() {} - // Operations + // Operations - /// get the tracker's track which match with the stand alone muon tracks - inline reco::TrackRef trackerTrack() const { return theTkTrack; } + /// get the tracker's track which match with the stand alone muon tracks + inline reco::TrackRef trackerTrack() const { return theTkTrack; } - /// get the track built with the muon spectrometer alone - inline reco::TrackRef standAloneTrack() const { return theStaTrack; } + /// get the track built with the muon spectrometer alone + inline reco::TrackRef standAloneTrack() const { return theStaTrack; } - /// get the combined track - inline reco::TrackRef globalTrack() const { return theGlbTrack; } + /// get the combined track + inline reco::TrackRef globalTrack() const { return theGlbTrack; } - /// set the ref to tracker's track - inline void setTrackerTrack(reco::TrackRef tk) { theTkTrack = tk; } + /// set the ref to tracker's track + inline void setTrackerTrack(reco::TrackRef tk) { theTkTrack = tk; } - /// set the ref to stand alone track - inline void setStandAloneTrack(reco::TrackRef sta) { theStaTrack = sta; } + /// set the ref to stand alone track + inline void setStandAloneTrack(reco::TrackRef sta) { theStaTrack = sta; } - /// set the ref to combined track - inline void setGlobalTrack(reco::TrackRef glb) { theGlbTrack = glb; } + /// set the ref to combined track + inline void setGlobalTrack(reco::TrackRef glb) { theGlbTrack = glb; } - protected: - private: - /// ref to tracker's track which match with the stand alone muon tracks - reco::TrackRef theTkTrack; + protected: + private: + /// ref to tracker's track which match with the stand alone muon tracks + reco::TrackRef theTkTrack; - /// ref to the track built with the muon spectrometer alone - reco::TrackRef theStaTrack; + /// ref to the track built with the muon spectrometer alone + reco::TrackRef theStaTrack; - /// ref to the combined track - reco::TrackRef theGlbTrack; - }; + /// ref to the combined track + reco::TrackRef theGlbTrack; + }; + } // namespace io_v1 + using MuonTrackLinks = io_v1::MuonTrackLinks; } // namespace reco #endif diff --git a/DataFormats/MuonReco/src/classes_def.xml b/DataFormats/MuonReco/src/classes_def.xml index e3b31d25bd10f..72d188c92a51f 100644 --- a/DataFormats/MuonReco/src/classes_def.xml +++ b/DataFormats/MuonReco/src/classes_def.xml @@ -8,37 +8,37 @@ not be used as version numbers. By convention, CMS will use 3 as the initial version number of a class which has never been stored before. --> - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + + + + + - - + + - + - + @@ -80,40 +80,40 @@ initial version number of a class which has never been stored before. - + - - + + - - + + - + - + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - + @@ -132,33 +132,33 @@ initial version number of a class which has never been stored before. - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + @@ -190,24 +190,24 @@ initial version number of a class which has never been stored before. - - - - + + + + - - + + - - - - + + + + diff --git a/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h b/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h index 9ca9bce8832c5..0e2b5bc2c8e98 100644 --- a/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h +++ b/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h @@ -31,549 +31,551 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateEGammaExtraFwd.h" #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" namespace reco { - /**\class PFCandidate + namespace io_v1 { + /**\class PFCandidate \brief Particle reconstructed by the particle flow algorithm. \author Colin Bernet \date February 2007 */ - class PFCandidate : public CompositeCandidate { - public: - /// particle types - enum ParticleType { - X = 0, // undefined - h, // charged hadron - e, // electron - mu, // muon - gamma, // photon - h0, // neutral hadron - h_HF, // HF tower identified as a hadron - egamma_HF // HF tower identified as an EM particle - }; - - enum Flags { - NORMAL = 0, - E_PHI_SMODULES, - E_ETA_0, - E_ETA_MODULES, - E_BARREL_ENDCAP, - E_PRESHOWER_EDGE, - E_PRESHOWER, - E_ENDCAP_EDGE, - H_ETA_0, - H_BARREL_ENDCAP, - H_ENDCAP_VFCAL, - H_VFCAL_EDGE, - T_TO_DISP, - T_FROM_DISP, - T_FROM_V0, - T_FROM_GAMMACONV, - GAMMA_TO_GAMMACONV - }; - - enum PFVertexType { - kCandVertex = 0, - kTrkVertex = 1, - kComMuonVertex = 2, - kSAMuonVertex = 3, - kTrkMuonVertex = 4, - kGSFVertex = 5, - kTPFMSMuonVertex = 6, - kPickyMuonVertex = 7, - kDYTMuonVertex = 8 - }; - - /// default constructor - PFCandidate(); - - /// constructor from a reference (keeps track of source relationship) - PFCandidate(const PFCandidatePtr& sourcePtr); - - /* PFCandidate( Charge q, */ - /* const LorentzVector & p4, */ - /* ParticleType particleId, */ - /* reco::PFBlockRef blockRef ); */ - PFCandidate(Charge q, const LorentzVector& p4, ParticleType particleId); - - /// copy constructor - PFCandidate(const PFCandidate&); - - /// destructor - ~PFCandidate() override; - - PFCandidate& operator=(PFCandidate const&); - - /// return a clone - PFCandidate* clone() const override; - - /* /// set source ref */ - /* void setSourceRef(const PFCandidateRef& ref) { sourceRef_ = ref; } */ - - /* size_type numberOfSourceCandidateRefs() const {return 1;} */ - - /* CandidateBaseRef sourceCandidateRef( size_type i ) const { */ - /* return CandidateBaseRef(sourceRef_); */ - /* } */ - - using reco::Candidate::setSourceCandidatePtr; - void setSourceCandidatePtr(const PFCandidatePtr& ptr) { sourcePtr_ = ptr; } - - size_t numberOfSourceCandidatePtrs() const override { return 1; } + class PFCandidate : public CompositeCandidate { + public: + /// particle types + enum ParticleType { + X = 0, // undefined + h, // charged hadron + e, // electron + mu, // muon + gamma, // photon + h0, // neutral hadron + h_HF, // HF tower identified as a hadron + egamma_HF // HF tower identified as an EM particle + }; + + enum Flags { + NORMAL = 0, + E_PHI_SMODULES, + E_ETA_0, + E_ETA_MODULES, + E_BARREL_ENDCAP, + E_PRESHOWER_EDGE, + E_PRESHOWER, + E_ENDCAP_EDGE, + H_ETA_0, + H_BARREL_ENDCAP, + H_ENDCAP_VFCAL, + H_VFCAL_EDGE, + T_TO_DISP, + T_FROM_DISP, + T_FROM_V0, + T_FROM_GAMMACONV, + GAMMA_TO_GAMMACONV + }; + + enum PFVertexType { + kCandVertex = 0, + kTrkVertex = 1, + kComMuonVertex = 2, + kSAMuonVertex = 3, + kTrkMuonVertex = 4, + kGSFVertex = 5, + kTPFMSMuonVertex = 6, + kPickyMuonVertex = 7, + kDYTMuonVertex = 8 + }; + + /// default constructor + PFCandidate(); + + /// constructor from a reference (keeps track of source relationship) + PFCandidate(const PFCandidatePtr& sourcePtr); + + /* PFCandidate( Charge q, */ + /* const LorentzVector & p4, */ + /* ParticleType particleId, */ + /* reco::PFBlockRef blockRef ); */ + PFCandidate(Charge q, const LorentzVector& p4, ParticleType particleId); + + /// copy constructor + PFCandidate(const PFCandidate&); + + /// destructor + ~PFCandidate() override; + + PFCandidate& operator=(PFCandidate const&); + + /// return a clone + PFCandidate* clone() const override; + + /* /// set source ref */ + /* void setSourceRef(const PFCandidateRef& ref) { sourceRef_ = ref; } */ + + /* size_type numberOfSourceCandidateRefs() const {return 1;} */ + + /* CandidateBaseRef sourceCandidateRef( size_type i ) const { */ + /* return CandidateBaseRef(sourceRef_); */ + /* } */ + + using reco::Candidate::setSourceCandidatePtr; + void setSourceCandidatePtr(const PFCandidatePtr& ptr) { sourcePtr_ = ptr; } + + size_t numberOfSourceCandidatePtrs() const override { return 1; } + + CandidatePtr sourceCandidatePtr(size_type i) const override { return sourcePtr_; } + + /// returns the pdg id corresponding to the particle type. + /// the particle type could be removed at some point to gain some space. + /// low priority + int translateTypeToPdgId(ParticleType type) const; + ParticleType translatePdgIdToType(int pdgid) const; + + /// set Particle Type + void setParticleType(ParticleType type); + + /// add an element to the current PFCandidate + /* void addElement( const reco::PFBlockElement* element ); */ + + /// add element in block + void addElementInBlock(const reco::PFBlockRef& blockref, unsigned elementIndex); + + /// set track reference + void setTrackRef(const reco::TrackRef& ref); + + /// return a reference to the corresponding track, if charged. + /// otherwise, return a null reference + reco::TrackRef trackRef() const; + + /// return a pointer to the best track, if available. + /// otherwise, return a null pointer + const reco::Track* bestTrack() const override { + if ((abs(pdgId()) == 11 || pdgId() == 22) && gsfTrackRef().isNonnull() && gsfTrackRef().isAvailable()) + return &(*gsfTrackRef()); + else if (trackRef().isNonnull() && trackRef().isAvailable()) + return &(*trackRef()); + else + return nullptr; + } + /// uncertainty on dz + float dzError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dzError(); + else + return 0; + } + /// uncertainty on dxy + float dxyError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dxyError(); + else + return 0; + } - CandidatePtr sourceCandidatePtr(size_type i) const override { return sourcePtr_; } + /// set gsftrack reference + void setGsfTrackRef(const reco::GsfTrackRef& ref); - /// returns the pdg id corresponding to the particle type. - /// the particle type could be removed at some point to gain some space. - /// low priority - int translateTypeToPdgId(ParticleType type) const; - ParticleType translatePdgIdToType(int pdgid) const; + /// return a reference to the corresponding GSF track, if an electron. + /// otherwise, return a null reference + reco::GsfTrackRef gsfTrackRef() const; - /// set Particle Type - void setParticleType(ParticleType type); + /// set muon reference + void setMuonRef(const reco::MuonRef& ref); - /// add an element to the current PFCandidate - /* void addElement( const reco::PFBlockElement* element ); */ + /// return a reference to the corresponding muon, if a muon. + /// otherwise, return a null reference + reco::MuonRef muonRef() const; - /// add element in block - void addElementInBlock(const reco::PFBlockRef& blockref, unsigned elementIndex); + /// set displaced vertex reference + void setDisplacedVertexRef(const reco::PFDisplacedVertexRef& ref, Flags flag); - /// set track reference - void setTrackRef(const reco::TrackRef& ref); + /// return a reference to the corresponding displaced vertex, + /// otherwise, return a null reference + reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const; - /// return a reference to the corresponding track, if charged. - /// otherwise, return a null reference - reco::TrackRef trackRef() const; + /// set ref to original reco conversion + void setConversionRef(const reco::ConversionRef& ref); - /// return a pointer to the best track, if available. - /// otherwise, return a null pointer - const reco::Track* bestTrack() const override { - if ((abs(pdgId()) == 11 || pdgId() == 22) && gsfTrackRef().isNonnull() && gsfTrackRef().isAvailable()) - return &(*gsfTrackRef()); - else if (trackRef().isNonnull() && trackRef().isAvailable()) - return &(*trackRef()); - else - return nullptr; - } - /// uncertainty on dz - float dzError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dzError(); - else - return 0; - } - /// uncertainty on dxy - float dxyError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dxyError(); - else - return 0; - } + /// return a reference to the original conversion + reco::ConversionRef conversionRef() const; - /// set gsftrack reference - void setGsfTrackRef(const reco::GsfTrackRef& ref); + /// set ref to original reco conversion + void setV0Ref(const reco::VertexCompositeCandidateRef& ref); - /// return a reference to the corresponding GSF track, if an electron. - /// otherwise, return a null reference - reco::GsfTrackRef gsfTrackRef() const; + /// return a reference to the original conversion + reco::VertexCompositeCandidateRef v0Ref() const; - /// set muon reference - void setMuonRef(const reco::MuonRef& ref); + /// return a reference to the corresponding GsfElectron if any + reco::GsfElectronRef gsfElectronRef() const; - /// return a reference to the corresponding muon, if a muon. - /// otherwise, return a null reference - reco::MuonRef muonRef() const; + /// return a reference to the electron extra + reco::PFCandidateElectronExtraRef electronExtraRef() const; - /// set displaced vertex reference - void setDisplacedVertexRef(const reco::PFDisplacedVertexRef& ref, Flags flag); + /// set corrected Ecal energy + void setEcalEnergy(float eeRaw, float eeCorr) { + rawEcalEnergy_ = eeRaw; + ecalERatio_ = std::abs(eeRaw) < 1.e-6 ? 1.0 : eeCorr / eeRaw; + } - /// return a reference to the corresponding displaced vertex, - /// otherwise, return a null reference - reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const; + /// return corrected Ecal energy + double ecalEnergy() const { return ecalERatio_ * rawEcalEnergy_; } - /// set ref to original reco conversion - void setConversionRef(const reco::ConversionRef& ref); + /// return corrected Ecal energy + double rawEcalEnergy() const { return rawEcalEnergy_; } - /// return a reference to the original conversion - reco::ConversionRef conversionRef() const; + /// set corrected Hcal energy + void setHcalEnergy(float ehRaw, float ehCorr) { + rawHcalEnergy_ = ehRaw; + hcalERatio_ = std::abs(ehRaw) < 1.e-6 ? 1.0 : ehCorr / ehRaw; + } - /// set ref to original reco conversion - void setV0Ref(const reco::VertexCompositeCandidateRef& ref); + /// return corrected Hcal energy + double hcalEnergy() const { return hcalERatio_ * rawHcalEnergy_; } - /// return a reference to the original conversion - reco::VertexCompositeCandidateRef v0Ref() const; + /// return raw Hcal energy + double rawHcalEnergy() const { return rawHcalEnergy_; } - /// return a reference to the corresponding GsfElectron if any - reco::GsfElectronRef gsfElectronRef() const; + /// set corrected Hcal energy + void setHoEnergy(float eoRaw, float eoCorr) { + rawHoEnergy_ = eoRaw; + hoERatio_ = std::abs(eoRaw) < 1.e-6 ? 1.0 : eoCorr / eoRaw; + } - /// return a reference to the electron extra - reco::PFCandidateElectronExtraRef electronExtraRef() const; + /// return corrected Hcal energy + double hoEnergy() const { return hoERatio_ * rawHoEnergy_; } - /// set corrected Ecal energy - void setEcalEnergy(float eeRaw, float eeCorr) { - rawEcalEnergy_ = eeRaw; - ecalERatio_ = std::abs(eeRaw) < 1.e-6 ? 1.0 : eeCorr / eeRaw; - } + /// return raw Hcal energy + double rawHoEnergy() const { return rawHoEnergy_; } - /// return corrected Ecal energy - double ecalEnergy() const { return ecalERatio_ * rawEcalEnergy_; } + /// set GsfElectronRef + void setGsfElectronRef(const reco::GsfElectronRef& ref); - /// return corrected Ecal energy - double rawEcalEnergy() const { return rawEcalEnergy_; } + void setSuperClusterRef(const reco::SuperClusterRef& scRef); - /// set corrected Hcal energy - void setHcalEnergy(float ehRaw, float ehCorr) { - rawHcalEnergy_ = ehRaw; - hcalERatio_ = std::abs(ehRaw) < 1.e-6 ? 1.0 : ehCorr / ehRaw; - } + /// return a reference to the corresponding SuperCluster if any + reco::SuperClusterRef superClusterRef() const; - /// return corrected Hcal energy - double hcalEnergy() const { return hcalERatio_ * rawHcalEnergy_; } + /// set ref to the corresponding reco::Photon if any + void setPhotonRef(const reco::PhotonRef& phRef); - /// return raw Hcal energy - double rawHcalEnergy() const { return rawHcalEnergy_; } + /// return a reference to the corresponding Photon if any + reco::PhotonRef photonRef() const; - /// set corrected Hcal energy - void setHoEnergy(float eoRaw, float eoCorr) { - rawHoEnergy_ = eoRaw; - hoERatio_ = std::abs(eoRaw) < 1.e-6 ? 1.0 : eoCorr / eoRaw; - } + /// set the PF Photon Extra Ref + void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef& ref); - /// return corrected Hcal energy - double hoEnergy() const { return hoERatio_ * rawHoEnergy_; } + /// return a reference to the photon extra + reco::PFCandidatePhotonExtraRef photonExtraRef() const; - /// return raw Hcal energy - double rawHoEnergy() const { return rawHoEnergy_; } + /// set the PF EGamma Extra Ref + void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef& ref); - /// set GsfElectronRef - void setGsfElectronRef(const reco::GsfElectronRef& ref); + /// return a reference to the EGamma extra + reco::PFCandidateEGammaExtraRef egammaExtraRef() const; - void setSuperClusterRef(const reco::SuperClusterRef& scRef); + /// set corrected PS1 energy + void setPs1Energy(float e1) { ps1Energy_ = e1; } - /// return a reference to the corresponding SuperCluster if any - reco::SuperClusterRef superClusterRef() const; + /// return corrected PS1 energy + double pS1Energy() const { return ps1Energy_; } - /// set ref to the corresponding reco::Photon if any - void setPhotonRef(const reco::PhotonRef& phRef); + /// set corrected PS2 energy + void setPs2Energy(float e2) { ps2Energy_ = e2; } - /// return a reference to the corresponding Photon if any - reco::PhotonRef photonRef() const; + /// return corrected PS2 energy + double pS2Energy() const { return ps2Energy_; } - /// set the PF Photon Extra Ref - void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef& ref); + /// particle momentum *= rescaleFactor + void rescaleMomentum(double rescaleFactor); - /// return a reference to the photon extra - reco::PFCandidatePhotonExtraRef photonExtraRef() const; + /// set a given flag + void setFlag(Flags theFlag, bool value); - /// set the PF EGamma Extra Ref - void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef& ref); + /// return a given flag + bool flag(Flags theFlag) const; - /// return a reference to the EGamma extra - reco::PFCandidateEGammaExtraRef egammaExtraRef() const; + /// set uncertainty on momentum + void setDeltaP(double dp) { deltaP_ = dp; } - /// set corrected PS1 energy - void setPs1Energy(float e1) { ps1Energy_ = e1; } + /// uncertainty on 3-momentum + double deltaP() const { return deltaP_; } - /// return corrected PS1 energy - double pS1Energy() const { return ps1Energy_; } + // int pdgId() const { return translateTypeToPdgId( particleId_ ); } - /// set corrected PS2 energy - void setPs2Energy(float e2) { ps2Energy_ = e2; } + /// set mva for electron-pion discrimination. + /// For charged particles, this variable is set + /// to 0 for particles that are not preided + /// to 1 otherwise + /// For neutral particles, it is set to the default value - /// return corrected PS2 energy - double pS2Energy() const { return ps2Energy_; } + void set_mva_Isolated(float mvaI) { mva_Isolated_ = mvaI; } + // mva for isolated electrons + float mva_Isolated() const { return mva_Isolated_; } - /// particle momentum *= rescaleFactor - void rescaleMomentum(double rescaleFactor); + void set_mva_e_pi(float mvaNI) { mva_e_pi_ = mvaNI; } + /// mva for electron-pion discrimination + float mva_e_pi() const { return mva_e_pi_; } - /// set a given flag - void setFlag(Flags theFlag, bool value); + /// set mva for electron-muon discrimination + void set_mva_e_mu(float mva) { mva_e_mu_ = mva; } - /// return a given flag - bool flag(Flags theFlag) const; + /// mva for electron-muon discrimination + float mva_e_mu() const { return mva_e_mu_; } - /// set uncertainty on momentum - void setDeltaP(double dp) { deltaP_ = dp; } + /// set mva for pi-muon discrimination + void set_mva_pi_mu(float mva) { mva_pi_mu_ = mva; } - /// uncertainty on 3-momentum - double deltaP() const { return deltaP_; } + /// mva for pi-muon discrimination + float mva_pi_mu() const { return mva_pi_mu_; } - // int pdgId() const { return translateTypeToPdgId( particleId_ ); } + /// set mva for gamma detection + void set_mva_nothing_gamma(float mva) { mva_nothing_gamma_ = mva; } - /// set mva for electron-pion discrimination. - /// For charged particles, this variable is set - /// to 0 for particles that are not preided - /// to 1 otherwise - /// For neutral particles, it is set to the default value + /// mva for gamma detection + float mva_nothing_gamma() const { return mva_nothing_gamma_; } - void set_mva_Isolated(float mvaI) { mva_Isolated_ = mvaI; } - // mva for isolated electrons - float mva_Isolated() const { return mva_Isolated_; } + /// set mva for neutral hadron detection + void set_mva_nothing_nh(float mva) { mva_nothing_nh_ = mva; } - void set_mva_e_pi(float mvaNI) { mva_e_pi_ = mvaNI; } - /// mva for electron-pion discrimination - float mva_e_pi() const { return mva_e_pi_; } + /// mva for neutral hadron detection + float mva_nothing_nh() const { return mva_nothing_nh_; } - /// set mva for electron-muon discrimination - void set_mva_e_mu(float mva) { mva_e_mu_ = mva; } + /// set mva for neutral hadron - gamma discrimination + void set_mva_gamma_nh(float mva) { mva_gamma_nh_ = mva; } - /// mva for electron-muon discrimination - float mva_e_mu() const { return mva_e_mu_; } + // set DNN for electron PFID + // mva for ele PFID DNN sigIsolated class + float dnn_e_sigIsolated() const { return dnn_e_sigIsolated_; } + void set_dnn_e_sigIsolated(float mva) { dnn_e_sigIsolated_ = mva; } - /// set mva for pi-muon discrimination - void set_mva_pi_mu(float mva) { mva_pi_mu_ = mva; } + // mva for ele PFID DNN sigNonIsolated class + float dnn_e_sigNonIsolated() const { return dnn_e_sigNonIsolated_; } + void set_dnn_e_sigNonIsolated(float mva) { dnn_e_sigNonIsolated_ = mva; } - /// mva for pi-muon discrimination - float mva_pi_mu() const { return mva_pi_mu_; } + // mva for ele PFID DNN bkgNonIsolated class + float dnn_e_bkgNonIsolated() const { return dnn_e_bkgNonIsolated_; } + void set_dnn_e_bkgNonIsolated(float mva) { dnn_e_bkgNonIsolated_ = mva; } - /// set mva for gamma detection - void set_mva_nothing_gamma(float mva) { mva_nothing_gamma_ = mva; } + // mva for ele PFID DNN bkgTau class + float dnn_e_bkgTau() const { return dnn_e_bkgTau_; } + void set_dnn_e_bkgTau(float mva) { dnn_e_bkgTau_ = mva; } - /// mva for gamma detection - float mva_nothing_gamma() const { return mva_nothing_gamma_; } + // mva for ele PFID DNN bkgPhoton class + float dnn_e_bkgPhoton() const { return dnn_e_bkgPhoton_; } + void set_dnn_e_bkgPhoton(float mva) { dnn_e_bkgPhoton_ = mva; } - /// set mva for neutral hadron detection - void set_mva_nothing_nh(float mva) { mva_nothing_nh_ = mva; } + // set DNN for gamma PFID + float dnn_gamma() const { return dnn_gamma_; } + void set_dnn_gamma(float mva) { dnn_gamma_ = mva; } - /// mva for neutral hadron detection - float mva_nothing_nh() const { return mva_nothing_nh_; } + /// mva for neutral hadron - gamma discrimination + float mva_gamma_nh() const { return mva_gamma_nh_; } - /// set mva for neutral hadron - gamma discrimination - void set_mva_gamma_nh(float mva) { mva_gamma_nh_ = mva; } + /// set position at ECAL entrance + void setPositionAtECALEntrance(const math::XYZPointF& pos) { positionAtECALEntrance_ = pos; } - // set DNN for electron PFID - // mva for ele PFID DNN sigIsolated class - float dnn_e_sigIsolated() const { return dnn_e_sigIsolated_; } - void set_dnn_e_sigIsolated(float mva) { dnn_e_sigIsolated_ = mva; } + /// set the PF Electron Extra Ref + void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef& ref); - // mva for ele PFID DNN sigNonIsolated class - float dnn_e_sigNonIsolated() const { return dnn_e_sigNonIsolated_; } - void set_dnn_e_sigNonIsolated(float mva) { dnn_e_sigNonIsolated_ = mva; } + /// set the Best Muon Track Ref + void setMuonTrackType(const reco::Muon::MuonTrackType& type) { muonTrackType_ = type; } - // mva for ele PFID DNN bkgNonIsolated class - float dnn_e_bkgNonIsolated() const { return dnn_e_bkgNonIsolated_; } - void set_dnn_e_bkgNonIsolated(float mva) { dnn_e_bkgNonIsolated_ = mva; } + /// get the Best Muon Track Ref - // mva for ele PFID DNN bkgTau class - float dnn_e_bkgTau() const { return dnn_e_bkgTau_; } - void set_dnn_e_bkgTau(float mva) { dnn_e_bkgTau_ = mva; } + const reco::Muon::MuonTrackType bestMuonTrackType() const { return muonTrackType_; } - // mva for ele PFID DNN bkgPhoton class - float dnn_e_bkgPhoton() const { return dnn_e_bkgPhoton_; } - void set_dnn_e_bkgPhoton(float mva) { dnn_e_bkgPhoton_ = mva; } + /// \return position at ECAL entrance + const math::XYZPointF& positionAtECALEntrance() const { return positionAtECALEntrance_; } - // set DNN for gamma PFID - float dnn_gamma() const { return dnn_gamma_; } - void set_dnn_gamma(float mva) { dnn_gamma_ = mva; } + /// particle identification code + /// \todo use Particle::pdgId_ and remove this data member + virtual ParticleType particleId() const { return translatePdgIdToType(pdgId()); } - /// mva for neutral hadron - gamma discrimination - float mva_gamma_nh() const { return mva_gamma_nh_; } + /// return indices of elements used in the block + /* const std::vector& elementIndices() const { */ + /* return elementIndices_; */ + /* } */ + /// return elements + /* const edm::OwnVector< reco::PFBlockElement >& elements() const */ + /* {return elements_;} */ - /// set position at ECAL entrance - void setPositionAtECALEntrance(const math::XYZPointF& pos) { positionAtECALEntrance_ = pos; } + /// return elements in blocks + typedef std::pair ElementInBlock; + typedef std::vector ElementsInBlocks; - /// set the PF Electron Extra Ref - void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef& ref); + typedef edm::RefVector Blocks; + typedef std::vector Elements; - /// set the Best Muon Track Ref - void setMuonTrackType(const reco::Muon::MuonTrackType& type) { muonTrackType_ = type; } + const ElementsInBlocks& elementsInBlocks() const; - /// get the Best Muon Track Ref + static constexpr float bigMva_ = -999.; - const reco::Muon::MuonTrackType bestMuonTrackType() const { return muonTrackType_; } + friend std::ostream& operator<<(std::ostream& out, const PFCandidate& c); - /// \return position at ECAL entrance - const math::XYZPointF& positionAtECALEntrance() const { return positionAtECALEntrance_; } + const Point& vertex() const override; + double vx() const override { return vertex().x(); } + double vy() const override { return vertex().y(); } + double vz() const override { return vertex().z(); } - /// particle identification code - /// \todo use Particle::pdgId_ and remove this data member - virtual ParticleType particleId() const { return translatePdgIdToType(pdgId()); } + /// do we have a valid time information + bool isTimeValid() const { return timeError_ >= 0.f; } + /// \return the timing + float time() const { return time_; } + /// \return the timing uncertainty + float timeError() const { return timeError_; } + /// \set the timing information + void setTime(float time, float timeError = 0.f) { + time_ = time; + timeError_ = timeError; + } - /// return indices of elements used in the block - /* const std::vector& elementIndices() const { */ - /* return elementIndices_; */ - /* } */ - /// return elements - /* const edm::OwnVector< reco::PFBlockElement >& elements() const */ - /* {return elements_;} */ + /// fraction of hcal energy at a given depth (depth = 1 .. 7) + float hcalDepthEnergyFraction(unsigned int depth) const { return hcalDepthEnergyFractions_[depth - 1]; } + /// fraction of hcal energy at a given depth (index 0..6 for depth 1..7) + const std::array& hcalDepthEnergyFractions() const { return hcalDepthEnergyFractions_; } + /// set the fraction of hcal energy as function of depth (index 0..6 for depth 1..7) + void setHcalDepthEnergyFractions(const std::array& fracs) { hcalDepthEnergyFractions_ = fracs; } - /// return elements in blocks - typedef std::pair ElementInBlock; - typedef std::vector ElementsInBlocks; + private: + //function used before PR #31456, retained for backwards compatibility with old AOD where the vertex was not embedded + const math::XYZPoint& vertexLegacy(PFCandidate::PFVertexType vertexType) const; - typedef edm::RefVector Blocks; - typedef std::vector Elements; + /// Polymorphic overlap + bool overlap(const Candidate&) const override; - const ElementsInBlocks& elementsInBlocks() const; + void setFlag(unsigned shift, unsigned flag, bool value); - static constexpr float bigMva_ = -999.; - - friend std::ostream& operator<<(std::ostream& out, const PFCandidate& c); - - const Point& vertex() const override; - double vx() const override { return vertex().x(); } - double vy() const override { return vertex().y(); } - double vz() const override { return vertex().z(); } - - /// do we have a valid time information - bool isTimeValid() const { return timeError_ >= 0.f; } - /// \return the timing - float time() const { return time_; } - /// \return the timing uncertainty - float timeError() const { return timeError_; } - /// \set the timing information - void setTime(float time, float timeError = 0.f) { - time_ = time; - timeError_ = timeError; - } - - /// fraction of hcal energy at a given depth (depth = 1 .. 7) - float hcalDepthEnergyFraction(unsigned int depth) const { return hcalDepthEnergyFractions_[depth - 1]; } - /// fraction of hcal energy at a given depth (index 0..6 for depth 1..7) - const std::array& hcalDepthEnergyFractions() const { return hcalDepthEnergyFractions_; } - /// set the fraction of hcal energy as function of depth (index 0..6 for depth 1..7) - void setHcalDepthEnergyFractions(const std::array& fracs) { hcalDepthEnergyFractions_ = fracs; } - - private: - //function used before PR #31456, retained for backwards compatibility with old AOD where the vertex was not embedded - const math::XYZPoint& vertexLegacy(PFCandidate::PFVertexType vertexType) const; - - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - void setFlag(unsigned shift, unsigned flag, bool value); - - bool flag(unsigned shift, unsigned flag) const; + bool flag(unsigned shift, unsigned flag) const; #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) - mutable std::atomic elementsInBlocks_; + mutable std::atomic elementsInBlocks_; #else - mutable ElementsInBlocks* elementsInBlocks_; + mutable ElementsInBlocks* elementsInBlocks_; #endif - Blocks blocksStorage_; - Elements elementsStorage_; + Blocks blocksStorage_; + Elements elementsStorage_; - /// reference to the source PFCandidate, if any - /* PFCandidateRef sourceRef_; */ - PFCandidatePtr sourcePtr_; + /// reference to the source PFCandidate, if any + /* PFCandidateRef sourceRef_; */ + PFCandidatePtr sourcePtr_; - ///Reference to the best track if it is a muon - ///pF is allowed to switch the default muon track - reco::Muon::MuonTrackType muonTrackType_; + ///Reference to the best track if it is a muon + ///pF is allowed to switch the default muon track + reco::Muon::MuonTrackType muonTrackType_; - /// corrected ECAL energy ratio (corrected/raw) - float ecalERatio_; + /// corrected ECAL energy ratio (corrected/raw) + float ecalERatio_; - /// corrected HCAL energy ratio (corrected/raw) - float hcalERatio_; + /// corrected HCAL energy ratio (corrected/raw) + float hcalERatio_; - /// corrected HO energy ratio (corrected/raw) - float hoERatio_; + /// corrected HO energy ratio (corrected/raw) + float hoERatio_; - /// raw ECAL energy - float rawEcalEnergy_; + /// raw ECAL energy + float rawEcalEnergy_; - /// raw HCAL energy - float rawHcalEnergy_; + /// raw HCAL energy + float rawHcalEnergy_; - /// raw HO energy - float rawHoEnergy_; + /// raw HO energy + float rawHoEnergy_; - /// corrected PS1 energy - float ps1Energy_; + /// corrected PS1 energy + float ps1Energy_; - /// corrected PS2 energy - float ps2Energy_; + /// corrected PS2 energy + float ps2Energy_; - /// all flags, packed (ecal regional, hcal regional, tracking) - unsigned flags_; + /// all flags, packed (ecal regional, hcal regional, tracking) + unsigned flags_; - /// uncertainty on 3-momentum - float deltaP_; + /// uncertainty on 3-momentum + float deltaP_; - //legacy vertex type to read AOD created before PR #31456 - PFVertexType vertexType_; + //legacy vertex type to read AOD created before PR #31456 + PFVertexType vertexType_; - // mva for isolated electrons - float mva_Isolated_; + // mva for isolated electrons + float mva_Isolated_; - /// mva for electron-pion discrimination - float mva_e_pi_; + /// mva for electron-pion discrimination + float mva_e_pi_; - /// mva for electron-muon discrimination - float mva_e_mu_; + /// mva for electron-muon discrimination + float mva_e_mu_; - /// mva for pi-muon discrimination - float mva_pi_mu_; + /// mva for pi-muon discrimination + float mva_pi_mu_; - /// mva for gamma detection - float mva_nothing_gamma_; + /// mva for gamma detection + float mva_nothing_gamma_; - /// mva for neutral hadron detection - float mva_nothing_nh_; + /// mva for neutral hadron detection + float mva_nothing_nh_; - /// mva for neutral hadron - gamma discrimination - float mva_gamma_nh_; + /// mva for neutral hadron - gamma discrimination + float mva_gamma_nh_; - /// DNN for electron PFid: isolated signal - float dnn_e_sigIsolated_; + /// DNN for electron PFid: isolated signal + float dnn_e_sigIsolated_; - /// DNN for electron PFid: non-isolated signal - float dnn_e_sigNonIsolated_; + /// DNN for electron PFid: non-isolated signal + float dnn_e_sigNonIsolated_; - /// DNN for electron PFid: non-isolated bkg - float dnn_e_bkgNonIsolated_; + /// DNN for electron PFid: non-isolated bkg + float dnn_e_bkgNonIsolated_; - /// DNN for electron PFid: tau bkg - float dnn_e_bkgTau_; + /// DNN for electron PFid: tau bkg + float dnn_e_bkgTau_; - /// DNN for electron PFid: photon bkg - float dnn_e_bkgPhoton_; + /// DNN for electron PFid: photon bkg + float dnn_e_bkgPhoton_; - // DNN for gamma PFid - float dnn_gamma_; + // DNN for gamma PFid + float dnn_gamma_; - /// position at ECAL entrance, from the PFRecTrack - math::XYZPointF positionAtECALEntrance_; + /// position at ECAL entrance, from the PFRecTrack + math::XYZPointF positionAtECALEntrance_; - //more efficiently stored refs - void storeRefInfo(unsigned int iMask, - unsigned int iBit, - bool iIsValid, - const edm::RefCore& iCore, - size_t iKey, - const edm::EDProductGetter*); - bool getRefInfo( - unsigned int iMask, unsigned int iBit, edm::ProductID& oProdID, size_t& oIndex, size_t& aIndex) const; + //more efficiently stored refs + void storeRefInfo(unsigned int iMask, + unsigned int iBit, + bool iIsValid, + const edm::RefCore& iCore, + size_t iKey, + const edm::EDProductGetter*); + bool getRefInfo( + unsigned int iMask, unsigned int iBit, edm::ProductID& oProdID, size_t& oIndex, size_t& aIndex) const; - const edm::EDProductGetter* getter_; //transient - unsigned short storedRefsBitPattern_; - std::vector refsInfo_; - std::vector refsCollectionCache_; + const edm::EDProductGetter* getter_; //transient + unsigned short storedRefsBitPattern_; + std::vector refsInfo_; + std::vector refsCollectionCache_; - /// timing information (valid if timeError_ >= 0) - float time_; - /// timing information uncertainty (<0 if timing not available) - float timeError_; + /// timing information (valid if timeError_ >= 0) + float time_; + /// timing information uncertainty (<0 if timing not available) + float timeError_; - std::array hcalDepthEnergyFractions_; - }; - - /// particle ID component tag - struct PFParticleIdTag {}; + std::array hcalDepthEnergyFractions_; + }; - /// get default PFBlockRef component - /// as: pfcand->get(); - /* GET_DEFAULT_CANDIDATE_COMPONENT( PFCandidate, PFBlockRef, block ); */ + /// get default PFBlockRef component + /// as: pfcand->get(); + /* GET_DEFAULT_CANDIDATE_COMPONENT( PFCandidate, PFBlockRef, block ); */ - /// get int component - /// as: pfcand->get(); - GET_CANDIDATE_COMPONENT(PFCandidate, PFCandidate::ParticleType, particleId, PFParticleIdTag); + /// get int component + /// as: pfcand->get(); - std::ostream& operator<<(std::ostream& out, const PFCandidate& c); + std::ostream& operator<<(std::ostream& out, const PFCandidate& c); + } // namespace io_v1 + using PFCandidate = io_v1::PFCandidate; + /// particle ID component tag + struct PFParticleIdTag {}; + GET_CANDIDATE_COMPONENT(PFCandidate, PFCandidate::ParticleType, particleId, PFParticleIdTag); } // namespace reco #endif diff --git a/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h b/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h index b331f3867ebf2..e4532db72d94c 100644 --- a/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h +++ b/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h @@ -9,8 +9,10 @@ #include "DataFormats/Common/interface/FwdPtr.h" namespace reco { - class PFCandidate; - + namespace io_v1 { + class PFCandidate; + } + using PFCandidate = io_v1::PFCandidate; /// collection of PFCandidates typedef std::vector PFCandidateCollection; diff --git a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc index 8763e0a2324c2..df65c44b1b3f7 100644 --- a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc +++ b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc @@ -312,7 +312,7 @@ void PFCandidate::setFlag(Flags theFlag, bool value) { bool PFCandidate::flag(Flags theFlag) const { return (flags_ >> theFlag) & 1; } -ostream& reco::operator<<(ostream& out, const PFCandidate& c) { +ostream& reco::io_v1::operator<<(ostream& out, const PFCandidate& c) { if (!out) return out; diff --git a/DataFormats/ParticleFlowCandidate/src/classes_def.xml b/DataFormats/ParticleFlowCandidate/src/classes_def.xml index e35a386ef2964..0933eefe648b8 100644 --- a/DataFormats/ParticleFlowCandidate/src/classes_def.xml +++ b/DataFormats/ParticleFlowCandidate/src/classes_def.xml @@ -1,69 +1,53 @@ - - - - - - - - - - - - + + - + - + - + - - - + + + - - - + + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - - - - - + + @@ -72,14 +56,8 @@ - - - - - - - - + + @@ -89,7 +67,7 @@ - + @@ -97,7 +75,7 @@ - + @@ -109,7 +87,7 @@ - + @@ -135,34 +113,34 @@ - - - - + + + + - + - - - - - + + + + + - - - + + + - - - - + + + + - + diff --git a/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h b/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h index 46b2818177396..0c4af5b6186fe 100644 --- a/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h +++ b/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h @@ -9,29 +9,32 @@ #include "DataFormats/ParticleFlowReco/interface/PFCluster.h" namespace reco { - class HGCalMultiCluster : public reco::PFCluster { - public: - typedef edm::PtrVector::const_iterator component_iterator; - typedef edm::PtrVector ClusterCollection; + namespace io_v1 { + class HGCalMultiCluster : public reco::PFCluster { + public: + typedef edm::PtrVector::const_iterator component_iterator; + typedef edm::PtrVector ClusterCollection; - HGCalMultiCluster() : PFCluster() { this->setLayer(PFLayer::HGCAL); } + HGCalMultiCluster() : PFCluster() { this->setLayer(PFLayer::HGCAL); } - HGCalMultiCluster(double energy, double x, double y, double z, ClusterCollection& thecls); + HGCalMultiCluster(double energy, double x, double y, double z, ClusterCollection& thecls); - void push_back(const edm::Ptr& b) { myclusters.push_back(b); } + void push_back(const edm::Ptr& b) { myclusters.push_back(b); } - const edm::PtrVector& clusters() const { return myclusters; } + const edm::PtrVector& clusters() const { return myclusters; } - unsigned int size() const { return myclusters.size(); } - component_iterator begin() const { return myclusters.begin(); } - component_iterator end() const { return myclusters.end(); } + unsigned int size() const { return myclusters.size(); } + component_iterator begin() const { return myclusters.begin(); } + component_iterator end() const { return myclusters.end(); } - bool operator>(const HGCalMultiCluster& rhs) const { return (energy() > rhs.energy()); } + bool operator>(const HGCalMultiCluster& rhs) const { return (energy() > rhs.energy()); } - private: - edm::PtrVector myclusters; - }; + private: + edm::PtrVector myclusters; + }; + } // namespace io_v1 + using HGCalMultiCluster = io_v1::HGCalMultiCluster; typedef std::vector HGCalMultiClusterCollection; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlock.h b/DataFormats/ParticleFlowReco/interface/PFBlock.h index f4a9e109d8636..49d0769dfc895 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlock.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlock.h @@ -12,9 +12,10 @@ #include "DataFormats/Common/interface/OwnVector.h" namespace reco { + namespace io_v1 { - /// \brief Block of elements - /*! + /// \brief Block of elements + /*! \author Colin Bernet \date January 2006 @@ -23,86 +24,88 @@ namespace reco { - a set of links between these elements */ - class PFBlock { - public: - struct Link { - Link() : distance(-1), test(0) {} - Link(float d, char t) : distance(d), test(t) {} - float distance; - char test; - }; + class PFBlock { + public: + struct Link { + Link() : distance(-1), test(0) {} + Link(float d, char t) : distance(d), test(t) {} + float distance; + char test; + }; - typedef edm::OwnVector::const_iterator IE; - /* typedef std::vector< reco::PFBlockLink >::const_iterator IL; */ + typedef edm::OwnVector::const_iterator IE; + /* typedef std::vector< reco::PFBlockLink >::const_iterator IL; */ - // typedef std::vector< std::vector > LinkData; - typedef std::map LinkData; + // typedef std::vector< std::vector > LinkData; + typedef std::map LinkData; - enum LinkTest { LINKTEST_RECHIT, LINKTEST_NLINKTEST, LINKTEST_ALL }; + enum LinkTest { LINKTEST_RECHIT, LINKTEST_NLINKTEST, LINKTEST_ALL }; - PFBlock() {} - // PFBlock(const PFBlock& other); + PFBlock() {} + // PFBlock(const PFBlock& other); - /// add an element to the current PFBlock - /// the block will keep a copy. - void addElement(reco::PFBlockElement* element); + /// add an element to the current PFBlock + /// the block will keep a copy. + void addElement(reco::PFBlockElement* element); - void bookLinkData(); + void bookLinkData(); - /// makes the correspondance between a 2d element matrix and - /// the 1D vector which is the most compact way to store the matrix - bool matrix2vector(unsigned i, unsigned j, unsigned& index) const; + /// makes the correspondance between a 2d element matrix and + /// the 1D vector which is the most compact way to store the matrix + bool matrix2vector(unsigned i, unsigned j, unsigned& index) const; - /// set a link between elements of indices i1 and i2, of "distance" dist - /// the link is set in the linkData vector provided as an argument. - /// As indicated by the 'const' statement, 'this' is not modified. - void setLink(unsigned i1, unsigned i2, double dist, LinkData& linkData, LinkTest test = LINKTEST_RECHIT) const; + /// set a link between elements of indices i1 and i2, of "distance" dist + /// the link is set in the linkData vector provided as an argument. + /// As indicated by the 'const' statement, 'this' is not modified. + void setLink(unsigned i1, unsigned i2, double dist, LinkData& linkData, LinkTest test = LINKTEST_RECHIT) const; - /// lock an element ( unlink it from the others ) - /// Colin: this function is misleading - /// void lock(unsigned i, LinkData& linkData ) const; + /// lock an element ( unlink it from the others ) + /// Colin: this function is misleading + /// void lock(unsigned i, LinkData& linkData ) const; - /// fills a map with the elements associated to element i. - /// elements are sorted by increasing distance. - /// if specified, only the elements of type "type" will be considered - /// if specified, only the link calculated from a certain "test" will - /// be considered: distance test, etc.. - void associatedElements(unsigned i, - const LinkData& linkData, - std::multimap& sortedAssociates, - reco::PFBlockElement::Type type = PFBlockElement::NONE, - LinkTest test = LINKTEST_RECHIT) const; + /// fills a map with the elements associated to element i. + /// elements are sorted by increasing distance. + /// if specified, only the elements of type "type" will be considered + /// if specified, only the link calculated from a certain "test" will + /// be considered: distance test, etc.. + void associatedElements(unsigned i, + const LinkData& linkData, + std::multimap& sortedAssociates, + reco::PFBlockElement::Type type = PFBlockElement::NONE, + LinkTest test = LINKTEST_RECHIT) const; - /// \return distance of link - double dist(unsigned ie1, unsigned ie2, const LinkData& linkData, LinkTest test) const { - return dist(ie1, ie2, linkData); - } + /// \return distance of link + double dist(unsigned ie1, unsigned ie2, const LinkData& linkData, LinkTest test) const { + return dist(ie1, ie2, linkData); + } - /// \return distance of link - double dist(unsigned ie1, unsigned ie2, const LinkData& linkData) const; + /// \return distance of link + double dist(unsigned ie1, unsigned ie2, const LinkData& linkData) const; - /// \return elements - const edm::OwnVector& elements() const { return elements_; } + /// \return elements + const edm::OwnVector& elements() const { return elements_; } - /// \return link data - const LinkData& linkData() const { return linkData_; } + /// \return link data + const LinkData& linkData() const { return linkData_; } - /// \return link data - LinkData& linkData() { return linkData_; } + /// \return link data + LinkData& linkData() { return linkData_; } - private: - /// \return size of linkData_, calculated from the number of elements - unsigned linkDataSize() const; + private: + /// \return size of linkData_, calculated from the number of elements + unsigned linkDataSize() const; - /// link data (permanent) - LinkData linkData_; + /// link data (permanent) + LinkData linkData_; - /// all elements - edm::OwnVector elements_; - }; + /// all elements + edm::OwnVector elements_; + }; - std::ostream& operator<<(std::ostream& out, const PFBlock& co); + std::ostream& operator<<(std::ostream& out, const PFBlock& co); + } // namespace io_v1 + using PFBlock = io_v1::PFBlock; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h index 5c39051b30860..c620f6b67d8e1 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h @@ -7,7 +7,10 @@ /* #include "DataFormats/Common/interface/RefProd.h" */ namespace reco { - class PFBlock; + namespace io_v1 { + class PFBlock; + } + using PFBlock = io_v1::PFBlock; /// collection of PFBlock objects typedef std::vector PFBlockCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PFCluster.h b/DataFormats/ParticleFlowReco/interface/PFCluster.h index fed7e807557ee..a27217ab47c0c 100644 --- a/DataFormats/ParticleFlowReco/interface/PFCluster.h +++ b/DataFormats/ParticleFlowReco/interface/PFCluster.h @@ -18,8 +18,9 @@ class PFClusterAlgo; namespace reco { + namespace io_v1 { - /**\class PFCluster + /**\class PFCluster \brief Particle flow cluster, see clustering algorithm in PFClusterAlgo A particle flow cluster is defined by its energy and position, which are @@ -39,129 +40,131 @@ namespace reco { \author Colin Bernet \date July 2006 */ - class PFCluster : public CaloCluster { - public: - typedef std::vector>> EEtoPSAssociation; - // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, - // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase - // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. - typedef ROOT::Math::PositionVector3D> REPPoint; + class PFCluster : public CaloCluster { + public: + typedef std::vector>> EEtoPSAssociation; + // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D> REPPoint; - PFCluster() : CaloCluster(CaloCluster::particleFlow), time_(-99.0), layer_(PFLayer::NONE) {} + PFCluster() : CaloCluster(CaloCluster::particleFlow), time_(-99.0), layer_(PFLayer::NONE) {} - /// constructor - PFCluster(PFLayer::Layer layer, double energy, double x, double y, double z); + /// constructor + PFCluster(PFLayer::Layer layer, double energy, double x, double y, double z); - /// resets clusters parameters - void reset(); + /// resets clusters parameters + void reset(); - /// reset only hits and fractions - void resetHitsAndFractions(); + /// reset only hits and fractions + void resetHitsAndFractions(); - /// add a given fraction of the rechit - void addRecHitFraction(const reco::PFRecHitFraction& frac); + /// add a given fraction of the rechit + void addRecHitFraction(const reco::PFRecHitFraction& frac); - /// vector of rechit fractions - const std::vector& recHitFractions() const { return rechits_; } + /// vector of rechit fractions + const std::vector& recHitFractions() const { return rechits_; } - /// set layer - void setLayer(PFLayer::Layer layer); + /// set layer + void setLayer(PFLayer::Layer layer); - /// cluster layer, see PFLayer.h in this directory - PFLayer::Layer layer() const; + /// cluster layer, see PFLayer.h in this directory + PFLayer::Layer layer() const; - /// cluster energy - double energy() const { return energy_; } + /// cluster energy + double energy() const { return energy_; } - /// \return cluster time - float time() const { return time_; } - /// \return the timing uncertainty - float timeError() const { return timeError_; } + /// \return cluster time + float time() const { return time_; } + /// \return the timing uncertainty + float timeError() const { return timeError_; } - /// cluster depth - double depth() const { return depth_; } + /// cluster depth + double depth() const { return depth_; } - void setTime(float time, float timeError = 0) { - time_ = time; - timeError_ = timeError; - } - void setTimeError(float timeError) { timeError_ = timeError; } - void setDepth(double depth) { depth_ = depth; } + void setTime(float time, float timeError = 0) { + time_ = time; + timeError_ = timeError; + } + void setTimeError(float timeError) { timeError_ = timeError; } + void setDepth(double depth) { depth_ = depth; } - /// cluster position: rho, eta, phi - const REPPoint& positionREP() const { return posrep_; } + /// cluster position: rho, eta, phi + const REPPoint& positionREP() const { return posrep_; } - /// computes posrep_ once and for all - void calculatePositionREP() { posrep_.SetCoordinates(position_.Rho(), position_.Eta(), position_.Phi()); } + /// computes posrep_ once and for all + void calculatePositionREP() { posrep_.SetCoordinates(position_.Rho(), position_.Eta(), position_.Phi()); } - /// \todo move to PFClusterTools - static double getDepthCorrection(double energy, bool isBelowPS = false, bool isHadron = false); + /// \todo move to PFClusterTools + static double getDepthCorrection(double energy, bool isBelowPS = false, bool isHadron = false); - /// some classes to make this fit into a template footprint - /// for RecoPFClusterRefCandidate so we can make jets and MET - /// out of PFClusters. + /// some classes to make this fit into a template footprint + /// for RecoPFClusterRefCandidate so we can make jets and MET + /// out of PFClusters. - /// dummy charge - double charge() const { return 0; } + /// dummy charge + double charge() const { return 0; } - /// transverse momentum, massless approximation - double pt() const { return (energy() * sin(position_.theta())); } + /// transverse momentum, massless approximation + double pt() const { return (energy() * sin(position_.theta())); } - /// angle - double theta() const { return position_.theta(); } + /// angle + double theta() const { return position_.theta(); } - /// dummy vertex access - math::XYZPoint const& vertex() const { return dummyVtx_; } - double vx() const { return vertex().x(); } - double vy() const { return vertex().y(); } - double vz() const { return vertex().z(); } + /// dummy vertex access + math::XYZPoint const& vertex() const { return dummyVtx_; } + double vx() const { return vertex().x(); } + double vy() const { return vertex().y(); } + double vz() const { return vertex().z(); } #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) - template - void pruneUsing(pruner prune) { - // remove_if+erase algo applied to both vectors... - auto iter = std::find_if_not(rechits_.begin(), rechits_.end(), prune); - if (iter == rechits_.end()) - return; - auto first = iter - rechits_.begin(); - for (auto i = first; ++i < int(rechits_.size());) { - if (prune(rechits_[i])) { - rechits_[first] = std::move(rechits_[i]); - hitsAndFractions_[first] = std::move(hitsAndFractions_[i]); - ++first; + template + void pruneUsing(pruner prune) { + // remove_if+erase algo applied to both vectors... + auto iter = std::find_if_not(rechits_.begin(), rechits_.end(), prune); + if (iter == rechits_.end()) + return; + auto first = iter - rechits_.begin(); + for (auto i = first; ++i < int(rechits_.size());) { + if (prune(rechits_[i])) { + rechits_[first] = std::move(rechits_[i]); + hitsAndFractions_[first] = std::move(hitsAndFractions_[i]); + ++first; + } } + rechits_.erase(rechits_.begin() + first, rechits_.end()); + hitsAndFractions_.erase(hitsAndFractions_.begin() + first, hitsAndFractions_.end()); } - rechits_.erase(rechits_.begin() + first, rechits_.end()); - hitsAndFractions_.erase(hitsAndFractions_.begin() + first, hitsAndFractions_.end()); - } #endif - private: - /// vector of rechit fractions (transient) - std::vector rechits_; + private: + /// vector of rechit fractions (transient) + std::vector rechits_; - /// cluster position: rho, eta, phi (transient) - REPPoint posrep_; + /// cluster position: rho, eta, phi (transient) + REPPoint posrep_; - /// Michalis: add timing and depth information - float time_; - float timeError_{0}; - double depth_{0}; + /// Michalis: add timing and depth information + float time_; + float timeError_{0}; + double depth_{0}; - /// transient layer - PFLayer::Layer layer_; + /// transient layer + PFLayer::Layer layer_; - /// depth corrections - static const constexpr double depthCorA_ = 0.89; - static const constexpr double depthCorB_ = 7.3; - static const constexpr double depthCorAp_ = 0.89; - static const constexpr double depthCorBp_ = 4.0; + /// depth corrections + static const constexpr double depthCorA_ = 0.89; + static const constexpr double depthCorB_ = 7.3; + static const constexpr double depthCorAp_ = 0.89; + static const constexpr double depthCorBp_ = 4.0; - static const math::XYZPoint dummyVtx_; - }; + static const math::XYZPoint dummyVtx_; + }; - std::ostream& operator<<(std::ostream& out, const PFCluster& cluster); + std::ostream& operator<<(std::ostream& out, const PFCluster& cluster); + } // namespace io_v1 + using PFCluster = io_v1::PFCluster; } // namespace reco #endif // DataFormats_ParticleFlowReco_PFCluster_h diff --git a/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h index d3bce22b1acc6..4d5c0bcf56336 100644 --- a/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class PFCluster; + namespace io_v1 { + class PFCluster; + } + using PFCluster = io_v1::PFCluster; /// collection of PFCluster objects typedef std::vector PFClusterCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PFConversion.h b/DataFormats/ParticleFlowReco/interface/PFConversion.h index 66f9f0d1e35b2..327f1fcbdde20 100644 --- a/DataFormats/ParticleFlowReco/interface/PFConversion.h +++ b/DataFormats/ParticleFlowReco/interface/PFConversion.h @@ -9,8 +9,6 @@ #include #include -class Conversion; - namespace reco { /**\class PFConversion diff --git a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h index 5be48b21c198e..fa3d3fa475a13 100644 --- a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h +++ b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h @@ -10,9 +10,10 @@ #include namespace reco { + namespace io_v1 { - /// \brief Block of elements - /*! + /// \brief Block of elements + /*! \author Maxime Gouzevitch \date November 2009 @@ -20,247 +21,251 @@ namespace reco { tracks's hit-vertex distances, tracks types and the expected vertex type. */ - class PFDisplacedVertex : public Vertex { - public: - /// Information on the distance between track's hits and the Vertex - typedef std::pair PFTrackHitInfo; - typedef std::pair PFTrackHitFullInfo; - - /// Mass hypothesis enum - enum M_Hypo { M_CUSTOM, M_MASSLESS, M_PION, M_KAON, M_LAMBDA }; - - /// Classification of tracks according to the position with respect - /// to the Vertex. A Merged track is a track which has at least - /// two hits before and two hits after the vertex. It may come from - /// a primary track merged with a low quality secondary track. - enum VertexTrackType { T_NOT_FROM_VERTEX, T_TO_VERTEX, T_FROM_VERTEX, T_MERGED }; - - /// Classification of vertex according to different parameters such as the - /// Number of tracks, the invariant mass etc... - enum VertexType { - ANY = 0, - FAKE = 1, - LOOPER = 2, - NUCL = 10, - NUCL_LOOSE = 11, - NUCL_KINK = 12, - CONVERSION = 20, - CONVERSION_LOOSE = 21, - CONVERTED_BREMM = 22, - K0_DECAY = 30, - LAMBDA_DECAY = 31, - LAMBDABAR_DECAY = 32, - KPLUS_DECAY = 40, - KMINUS_DECAY = 41, - KPLUS_DECAY_LOOSE = 42, - KMINUS_DECAY_LOOSE = 43, - BSM_VERTEX = 100 - }; - - /// Default constructor - PFDisplacedVertex(); - - /// Constructor from the reco::Vertex - PFDisplacedVertex(reco::Vertex&); - - /// Add a new track to the vertex - void addElement(const TrackBaseRef& r, - const Track& refTrack, - const PFTrackHitFullInfo& hitInfo, - VertexTrackType trackType = T_NOT_FROM_VERTEX, - float w = 1.0); - - /// Clean the tracks collection and all the associated collections - void cleanTracks(); - - /// Set the type of this vertex - void setVertexType(VertexType vertexType) { vertexType_ = vertexType; } - - /// Estimate the direction of the vertex. This function produced a unitary vector. - /// It is calculated the axis linking the primary vertex of the event pvtx to this vertex - void setPrimaryDirection(const math::XYZPoint& pvtx); - - /// Get the type of this vertex - VertexType vertexType() { return vertexType_; } - - const std::vector trackHitFullInfos() const { return trackHitFullInfos_; } - - const std::vector trackTypes() const { return trackTypes_; } - - /// -------- Provide useful information -------- /// - - /// If a primary track was identified - const bool isTherePrimaryTracks() const { return isThereKindTracks(T_TO_VERTEX); } - - /// If a merged track was identified - const bool isThereMergedTracks() const { return isThereKindTracks(T_MERGED); } - - /// If a secondary track was identified - const bool isThereSecondaryTracks() const { return isThereKindTracks(T_FROM_VERTEX); } + class PFDisplacedVertex : public Vertex { + public: + /// Information on the distance between track's hits and the Vertex + typedef std::pair PFTrackHitInfo; + typedef std::pair PFTrackHitFullInfo; + + /// Mass hypothesis enum + enum M_Hypo { M_CUSTOM, M_MASSLESS, M_PION, M_KAON, M_LAMBDA }; + + /// Classification of tracks according to the position with respect + /// to the Vertex. A Merged track is a track which has at least + /// two hits before and two hits after the vertex. It may come from + /// a primary track merged with a low quality secondary track. + enum VertexTrackType { T_NOT_FROM_VERTEX, T_TO_VERTEX, T_FROM_VERTEX, T_MERGED }; + + /// Classification of vertex according to different parameters such as the + /// Number of tracks, the invariant mass etc... + enum VertexType { + ANY = 0, + FAKE = 1, + LOOPER = 2, + NUCL = 10, + NUCL_LOOSE = 11, + NUCL_KINK = 12, + CONVERSION = 20, + CONVERSION_LOOSE = 21, + CONVERTED_BREMM = 22, + K0_DECAY = 30, + LAMBDA_DECAY = 31, + LAMBDABAR_DECAY = 32, + KPLUS_DECAY = 40, + KMINUS_DECAY = 41, + KPLUS_DECAY_LOOSE = 42, + KMINUS_DECAY_LOOSE = 43, + BSM_VERTEX = 100 + }; + + /// Default constructor + PFDisplacedVertex(); + + /// Constructor from the reco::Vertex + PFDisplacedVertex(reco::Vertex&); + + /// Add a new track to the vertex + void addElement(const TrackBaseRef& r, + const Track& refTrack, + const PFTrackHitFullInfo& hitInfo, + VertexTrackType trackType = T_NOT_FROM_VERTEX, + float w = 1.0); + + /// Clean the tracks collection and all the associated collections + void cleanTracks(); + + /// Set the type of this vertex + void setVertexType(VertexType vertexType) { vertexType_ = vertexType; } + + /// Estimate the direction of the vertex. This function produced a unitary vector. + /// It is calculated the axis linking the primary vertex of the event pvtx to this vertex + void setPrimaryDirection(const math::XYZPoint& pvtx); + + /// Get the type of this vertex + VertexType vertexType() { return vertexType_; } + + const std::vector trackHitFullInfos() const { return trackHitFullInfos_; } + + const std::vector trackTypes() const { return trackTypes_; } + + /// -------- Provide useful information -------- /// + + /// If a primary track was identified + const bool isTherePrimaryTracks() const { return isThereKindTracks(T_TO_VERTEX); } + + /// If a merged track was identified + const bool isThereMergedTracks() const { return isThereKindTracks(T_MERGED); } + + /// If a secondary track was identified + const bool isThereSecondaryTracks() const { return isThereKindTracks(T_FROM_VERTEX); } + + /// If there is a track which was not identified + const bool isThereNotFromVertexTracks() const { return isThereKindTracks(T_NOT_FROM_VERTEX); } + + /// Is a primary track was identified + const bool isPrimaryTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_TO_VERTEX); + } + + /// Is a secondary track was identified + const bool isSecondaryTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_FROM_VERTEX); + } + + /// Is a secondary track was identified + const bool isMergedTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_MERGED); + } + + const PFTrackHitFullInfo trackHitFullInfo(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return trackHitFullInfos_[itrk]; + } + + /// Is primary or merged track + const bool isIncomingTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_MERGED) || isTrack(itrk, T_TO_VERTEX); + } + + /// Is secondary track + const bool isOutgoingTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_FROM_VERTEX); + } + + /// Number of primary tracks was identified + const int nPrimaryTracks() const { return nKindTracks(T_TO_VERTEX); } + + /// Number of merged tracks was identified + const int nMergedTracks() const { return nKindTracks(T_MERGED); } + + /// Number of secondary tracks was identified + const int nSecondaryTracks() const { return nKindTracks(T_FROM_VERTEX); } + + /// Number of tracks which was not identified + const int nNotFromVertexTracks() const { return nKindTracks(T_NOT_FROM_VERTEX); } + + /// Number of tracks + const int nTracks() const { return trackTypes_.size(); } - /// If there is a track which was not identified - const bool isThereNotFromVertexTracks() const { return isThereKindTracks(T_NOT_FROM_VERTEX); } + // const reco::VertexTrackType vertexTrackType(reco::TrackBaseRef tkRef) const; - /// Is a primary track was identified - const bool isPrimaryTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_TO_VERTEX); - } + /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those + /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" + /// the value of custom shall be then provided in mass variable + const math::XYZTLorentzVector secondaryMomentum(std::string massHypo = "PI", + bool useRefitted = true, + double mass = 0.0) const { + return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); + } - /// Is a secondary track was identified - const bool isSecondaryTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_FROM_VERTEX); - } - - /// Is a secondary track was identified - const bool isMergedTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_MERGED); - } - - const PFTrackHitFullInfo trackHitFullInfo(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return trackHitFullInfos_[itrk]; - } - - /// Is primary or merged track - const bool isIncomingTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_MERGED) || isTrack(itrk, T_TO_VERTEX); - } - - /// Is secondary track - const bool isOutgoingTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_FROM_VERTEX); - } - - /// Number of primary tracks was identified - const int nPrimaryTracks() const { return nKindTracks(T_TO_VERTEX); } - - /// Number of merged tracks was identified - const int nMergedTracks() const { return nKindTracks(T_MERGED); } - - /// Number of secondary tracks was identified - const int nSecondaryTracks() const { return nKindTracks(T_FROM_VERTEX); } - - /// Number of tracks which was not identified - const int nNotFromVertexTracks() const { return nKindTracks(T_NOT_FROM_VERTEX); } - - /// Number of tracks - const int nTracks() const { return trackTypes_.size(); } - - // const reco::VertexTrackType vertexTrackType(reco::TrackBaseRef tkRef) const; - - /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those - /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" - /// the value of custom shall be then provided in mass variable - const math::XYZTLorentzVector secondaryMomentum(std::string massHypo = "PI", + /// Momentum of primary or merged track calculated with a mass hypothesis. + const math::XYZTLorentzVector primaryMomentum(std::string massHypo = "PI", bool useRefitted = true, double mass = 0.0) const { - return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); - } - - /// Momentum of primary or merged track calculated with a mass hypothesis. - const math::XYZTLorentzVector primaryMomentum(std::string massHypo = "PI", - bool useRefitted = true, - double mass = 0.0) const { - return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); - } + return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); + } - /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those - /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" - /// the value of custom shall be then provided in mass variable - const math::XYZTLorentzVector secondaryMomentum(M_Hypo massHypo, bool useRefitted = true, double mass = 0.0) const { - return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); - } + /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those + /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" + /// the value of custom shall be then provided in mass variable + const math::XYZTLorentzVector secondaryMomentum(M_Hypo massHypo, + bool useRefitted = true, + double mass = 0.0) const { + return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); + } - /// Momentum of primary or merged track calculated with a mass hypothesis. - const math::XYZTLorentzVector primaryMomentum(M_Hypo massHypo, bool useRefitted = true, double mass = 0.0) const { - return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); - } + /// Momentum of primary or merged track calculated with a mass hypothesis. + const math::XYZTLorentzVector primaryMomentum(M_Hypo massHypo, bool useRefitted = true, double mass = 0.0) const { + return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); + } - void calcKinematics() { - defaultPrimaryMomentum_ = momentum("PI", T_TO_VERTEX, false, 0.0); - defaultSecondaryMomentum_ = momentum("PI", T_FROM_VERTEX, true, 0.0); - } + void calcKinematics() { + defaultPrimaryMomentum_ = momentum("PI", T_TO_VERTEX, false, 0.0); + defaultSecondaryMomentum_ = momentum("PI", T_FROM_VERTEX, true, 0.0); + } - const double secondaryPt() const { return defaultPrimaryMomentum_.Pt(); } + const double secondaryPt() const { return defaultPrimaryMomentum_.Pt(); } - /// Momentum of primary or merged track calculated with a mass hypothesis. - const double primaryPt() const { return defaultSecondaryMomentum_.Pt(); } + /// Momentum of primary or merged track calculated with a mass hypothesis. + const double primaryPt() const { return defaultSecondaryMomentum_.Pt(); } - /// Total Charge - const int totalCharge() const; + /// Total Charge + const int totalCharge() const; - /// Angle PrimaryVertex-DisplacedVertex (or primary track if there is) - /// And secondary momentum - const double angle_io() const; + /// Angle PrimaryVertex-DisplacedVertex (or primary track if there is) + /// And secondary momentum + const double angle_io() const; - /// Primary Direction - const math::XYZVector primaryDirection() const; + /// Primary Direction + const math::XYZVector primaryDirection() const; - bool isFake() const { return vertexType_ == FAKE; } - bool isLooper() const { return vertexType_ == LOOPER; } - bool isNucl() const { return vertexType_ == NUCL; } - bool isNucl_Loose() const { return vertexType_ == NUCL_LOOSE; } - bool isNucl_Kink() const { return vertexType_ == NUCL_KINK; } - bool isConv() const { return vertexType_ == CONVERSION; } - bool isConv_Loose() const { return vertexType_ == CONVERSION_LOOSE; } - bool isConvertedBremm() const { return vertexType_ == CONVERTED_BREMM; } - bool isK0() const { return vertexType_ == K0_DECAY; } - bool isLambda() const { return vertexType_ == LAMBDA_DECAY; } - bool isLambdaBar() const { return vertexType_ == LAMBDABAR_DECAY; } - bool isKplus() const { return vertexType_ == KPLUS_DECAY; } - bool isKminus() const { return vertexType_ == KMINUS_DECAY; } - bool isKplus_Loose() const { return vertexType_ == KPLUS_DECAY_LOOSE; } - bool isKminus_Loose() const { return vertexType_ == KMINUS_DECAY_LOOSE; } - bool isBSM() const { return vertexType_ == BSM_VERTEX; } + bool isFake() const { return vertexType_ == FAKE; } + bool isLooper() const { return vertexType_ == LOOPER; } + bool isNucl() const { return vertexType_ == NUCL; } + bool isNucl_Loose() const { return vertexType_ == NUCL_LOOSE; } + bool isNucl_Kink() const { return vertexType_ == NUCL_KINK; } + bool isConv() const { return vertexType_ == CONVERSION; } + bool isConv_Loose() const { return vertexType_ == CONVERSION_LOOSE; } + bool isConvertedBremm() const { return vertexType_ == CONVERTED_BREMM; } + bool isK0() const { return vertexType_ == K0_DECAY; } + bool isLambda() const { return vertexType_ == LAMBDA_DECAY; } + bool isLambdaBar() const { return vertexType_ == LAMBDABAR_DECAY; } + bool isKplus() const { return vertexType_ == KPLUS_DECAY; } + bool isKminus() const { return vertexType_ == KMINUS_DECAY; } + bool isKplus_Loose() const { return vertexType_ == KPLUS_DECAY_LOOSE; } + bool isKminus_Loose() const { return vertexType_ == KMINUS_DECAY_LOOSE; } + bool isBSM() const { return vertexType_ == BSM_VERTEX; } - std::string nameVertexType() const; + std::string nameVertexType() const; - /// cout function - void Dump(std::ostream& out = std::cout) const; + /// cout function + void Dump(std::ostream& out = std::cout) const; - private: - /// --------- TOOLS -------------- /// + private: + /// --------- TOOLS -------------- /// - /// Common tool used to know if there are tracks of a given Kind - const bool isThereKindTracks(VertexTrackType) const; + /// Common tool used to know if there are tracks of a given Kind + const bool isThereKindTracks(VertexTrackType) const; - /// Common tool used to get the number of tracks of a given Kind - const int nKindTracks(VertexTrackType) const; + /// Common tool used to get the number of tracks of a given Kind + const int nKindTracks(VertexTrackType) const; - /// Common tool to calculate the momentum vector of tracks with a given Kind - const math::XYZTLorentzVector momentum(std::string, VertexTrackType, bool, double mass) const; + /// Common tool to calculate the momentum vector of tracks with a given Kind + const math::XYZTLorentzVector momentum(std::string, VertexTrackType, bool, double mass) const; - /// Common tool to calculate the momentum vector of tracks with a given Kind - const math::XYZTLorentzVector momentum(M_Hypo massHypo, VertexTrackType, bool, double mass) const; + /// Common tool to calculate the momentum vector of tracks with a given Kind + const math::XYZTLorentzVector momentum(M_Hypo massHypo, VertexTrackType, bool, double mass) const; - /// Get the mass with a given hypothesis - const double getMass2(M_Hypo, double) const; + /// Get the mass with a given hypothesis + const double getMass2(M_Hypo, double) const; - const size_t trackPosition(const reco::TrackBaseRef& originalTrack) const; + const size_t trackPosition(const reco::TrackBaseRef& originalTrack) const; - const bool isTrack(size_t itrk, VertexTrackType T) const { return trackTypes_[itrk] == T; } + const bool isTrack(size_t itrk, VertexTrackType T) const { return trackTypes_[itrk] == T; } - /// -------- MEMBERS -------- /// + /// -------- MEMBERS -------- /// - /// This vertex type - VertexType vertexType_; + /// This vertex type + VertexType vertexType_; - /// Types of the tracks associated to the vertex - std::vector trackTypes_; + /// Types of the tracks associated to the vertex + std::vector trackTypes_; - /// Information on the distance between track's hits and the Vertex - std::vector trackHitFullInfos_; + /// Information on the distance between track's hits and the Vertex + std::vector trackHitFullInfos_; - math::XYZVector primaryDirection_; + math::XYZVector primaryDirection_; - math::XYZTLorentzVector defaultPrimaryMomentum_; - math::XYZTLorentzVector defaultSecondaryMomentum_; - }; + math::XYZTLorentzVector defaultPrimaryMomentum_; + math::XYZTLorentzVector defaultSecondaryMomentum_; + }; + } // namespace io_v1 + using PFDisplacedVertex = io_v1::PFDisplacedVertex; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h index 3d2127192922d..a52fd7413a57d 100644 --- a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h @@ -7,7 +7,10 @@ /* #include "DataFormats/Common/interface/RefProd.h" */ namespace reco { - class PFDisplacedVertex; + namespace io_v1 { + class PFDisplacedVertex; + } + using PFDisplacedVertex = io_v1::PFDisplacedVertex; /// collection of PFDisplacedVertex objects typedef std::vector PFDisplacedVertexCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PFRecHit.h b/DataFormats/ParticleFlowReco/interface/PFRecHit.h index 1061eac96cce5..656d695b06a47 100644 --- a/DataFormats/ParticleFlowReco/interface/PFRecHit.h +++ b/DataFormats/ParticleFlowReco/interface/PFRecHit.h @@ -20,8 +20,9 @@ #include "Geometry/CaloGeometry/interface/CaloCellGeometryMayOwnPtr.h" namespace reco { + namespace io_v1 { - /**\class PFRecHit + /**\class PFRecHit \brief Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClusterAlgo \author Colin Bernet @@ -29,143 +30,148 @@ namespace reco { Feb 2014 [Michalis: 8 years later!Modifying the class to be able to generalize the neighbours for 3D calorimeters ] */ - class PFRecHit { - public: - using PositionType = GlobalPoint::BasicVectorType; - using REPPoint = RhoEtaPhi; - using RepCorners = CaloCellGeometry::RepCorners; - using REPPointVector = RepCorners; - using CornersVec = CaloCellGeometry::CornersVec; - - struct Neighbours { - using Pointer = unsigned int const*; - Neighbours() {} - Neighbours(Pointer ib, unsigned int n) : b(ib), e(ib + n) {} - Pointer b, e; - Pointer begin() const { return b; } - Pointer end() const { return e; } - unsigned int size() const { return e - b; } - }; + class PFRecHit { + public: + using PositionType = GlobalPoint::BasicVectorType; + using REPPoint = RhoEtaPhi; + using RepCorners = CaloCellGeometry::RepCorners; + using REPPointVector = RepCorners; + using CornersVec = CaloCellGeometry::CornersVec; + + struct Neighbours { + using Pointer = unsigned int const*; + Neighbours() {} + Neighbours(Pointer ib, unsigned int n) : b(ib), e(ib + n) {} + Pointer b, e; + Pointer begin() const { return b; } + Pointer end() const { return e; } + unsigned int size() const { return e - b; } + }; - enum { NONE = 0 }; - /// default constructor. Sets energy and position to zero - PFRecHit() {} + enum { NONE = 0 }; + /// default constructor. Sets energy and position to zero + PFRecHit() {} - PFRecHit( - CaloCellGeometryMayOwnPtr caloCell, unsigned int detId, PFLayer::Layer layer, float energy, uint32_t flags = 0) - : caloCell_(std::move(caloCell)), detId_(detId), layer_(layer), energy_(energy), flags_(flags) {} + PFRecHit(CaloCellGeometryMayOwnPtr caloCell, + unsigned int detId, + PFLayer::Layer layer, + float energy, + uint32_t flags = 0) + : caloCell_(std::move(caloCell)), detId_(detId), layer_(layer), energy_(energy), flags_(flags) {} - /// copy - PFRecHit(const PFRecHit& other) = default; - PFRecHit(PFRecHit&& other) = default; - PFRecHit& operator=(const PFRecHit& other) = default; - PFRecHit& operator=(PFRecHit&& other) = default; + /// copy + PFRecHit(const PFRecHit& other) = default; + PFRecHit(PFRecHit&& other) = default; + PFRecHit& operator=(const PFRecHit& other) = default; + PFRecHit& operator=(PFRecHit&& other) = default; - /// destructor - ~PFRecHit() = default; + /// destructor + ~PFRecHit() = default; - void setEnergy(float energy) { energy_ = energy; } + void setEnergy(float energy) { energy_ = energy; } - void addNeighbour(short x, short y, short z, unsigned int); - unsigned int getNeighbour(short x, short y, short z) const; - void setTime(double time) { time_ = time; } - void setDepth(int depth) { depth_ = depth; } - void clearNeighbours() { - neighbours_.clear(); - neighbourInfos_.clear(); - neighbours4_ = neighbours8_ = 0; - } + void addNeighbour(short x, short y, short z, unsigned int); + unsigned int getNeighbour(short x, short y, short z) const; + void setTime(double time) { time_ = time; } + void setDepth(int depth) { depth_ = depth; } + void clearNeighbours() { + neighbours_.clear(); + neighbourInfos_.clear(); + neighbours4_ = neighbours8_ = 0; + } - Neighbours neighbours4() const { return buildNeighbours(neighbours4_); } - Neighbours neighbours8() const { return buildNeighbours(neighbours8_); } + Neighbours neighbours4() const { return buildNeighbours(neighbours4_); } + Neighbours neighbours8() const { return buildNeighbours(neighbours8_); } - Neighbours neighbours() const { return buildNeighbours(neighbours_.size()); } + Neighbours neighbours() const { return buildNeighbours(neighbours_.size()); } - const std::vector& neighbourInfos() { return neighbourInfos_; } + const std::vector& neighbourInfos() { return neighbourInfos_; } - /// calo cell - CaloCellGeometry const& caloCell() const { return *(caloCell_.get()); } - bool hasCaloCell() const { return (caloCell_ != nullptr); } + /// calo cell + CaloCellGeometry const& caloCell() const { return *(caloCell_.get()); } + bool hasCaloCell() const { return (caloCell_ != nullptr); } - /// rechit detId - unsigned detId() const { return detId_; } + /// rechit detId + unsigned detId() const { return detId_; } - /// rechit layer - PFLayer::Layer layer() const { return layer_; } + /// rechit layer + PFLayer::Layer layer() const { return layer_; } - /// rechit energy - float energy() const { return energy_; } + /// rechit energy + float energy() const { return energy_; } - /// timing for cleaned hits - float time() const { return time_; } + /// timing for cleaned hits + float time() const { return time_; } - /// depth for segemntation - int depth() const { return depth_; } + /// depth for segemntation + int depth() const { return depth_; } - /// rechit momentum transverse to the beam, squared. - double pt2() const { return energy_ * energy_ * (position().perp2() / position().mag2()); } + /// rechit momentum transverse to the beam, squared. + double pt2() const { return energy_ * energy_ * (position().perp2() / position().mag2()); } - // Detector-dependent status flag - uint32_t flags() const { return flags_; } + // Detector-dependent status flag + uint32_t flags() const { return flags_; } - // - void setFlags(uint32_t flags) { flags_ = flags; } + // + void setFlags(uint32_t flags) { flags_ = flags; } - /// rechit cell centre x, y, z - PositionType const& position() const { return caloCell().getPosition().basicVector(); } + /// rechit cell centre x, y, z + PositionType const& position() const { return caloCell().getPosition().basicVector(); } - RhoEtaPhi const& positionREP() const { return caloCell().repPos(); } + RhoEtaPhi const& positionREP() const { return caloCell().repPos(); } - /// rechit corners - CornersVec const& getCornersXYZ() const { return caloCell().getCorners(); } + /// rechit corners + CornersVec const& getCornersXYZ() const { return caloCell().getCorners(); } - RepCorners const& getCornersREP() const { return caloCell().getCornersREP(); } + RepCorners const& getCornersREP() const { return caloCell().getCornersREP(); } - /// comparison >= operator - bool operator>=(const PFRecHit& rhs) const { return (energy_ >= rhs.energy_); } + /// comparison >= operator + bool operator>=(const PFRecHit& rhs) const { return (energy_ >= rhs.energy_); } - /// comparison > operator - bool operator>(const PFRecHit& rhs) const { return (energy_ > rhs.energy_); } + /// comparison > operator + bool operator>(const PFRecHit& rhs) const { return (energy_ > rhs.energy_); } - /// comparison <= operator - bool operator<=(const PFRecHit& rhs) const { return (energy_ <= rhs.energy_); } + /// comparison <= operator + bool operator<=(const PFRecHit& rhs) const { return (energy_ <= rhs.energy_); } - /// comparison < operator - bool operator<(const PFRecHit& rhs) const { return (energy_ < rhs.energy_); } + /// comparison < operator + bool operator<(const PFRecHit& rhs) const { return (energy_ < rhs.energy_); } - private: - Neighbours buildNeighbours(unsigned int n) const { return Neighbours(neighbours_.data(), n); } + private: + Neighbours buildNeighbours(unsigned int n) const { return Neighbours(neighbours_.data(), n); } - /// cell geometry - CaloCellGeometryMayOwnPtr caloCell_; + /// cell geometry + CaloCellGeometryMayOwnPtr caloCell_; - ///cell detid - unsigned int detId_ = 0; + ///cell detid + unsigned int detId_ = 0; - /// rechit layer - PFLayer::Layer layer_ = PFLayer::NONE; + /// rechit layer + PFLayer::Layer layer_ = PFLayer::NONE; - /// rechit energy - float energy_ = 0; + /// rechit energy + float energy_ = 0; - /// time - float time_ = -1; + /// time + float time_ = -1; - /// depth - int depth_ = 0; + /// depth + int depth_ = 0; - /// indices to existing neighbours (1 common side) - std::vector neighbours_; - std::vector neighbourInfos_; + /// indices to existing neighbours (1 common side) + std::vector neighbours_; + std::vector neighbourInfos_; - //Caching the neighbours4/8 per request of Lindsey - unsigned int neighbours4_ = 0; - unsigned int neighbours8_ = 0; + //Caching the neighbours4/8 per request of Lindsey + unsigned int neighbours4_ = 0; + unsigned int neighbours8_ = 0; - // Detector-dependent hit status flag - uint32_t flags_ = 0; - }; + // Detector-dependent hit status flag + uint32_t flags_ = 0; + }; + } // namespace io_v1 + using PFRecHit = io_v1::PFRecHit; } // namespace reco std::ostream& operator<<(std::ostream& out, const reco::PFRecHit& hit); diff --git a/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h b/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h index 7300c34d5edd7..ffabb8816df18 100644 --- a/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class PFRecHit; + namespace io_v1 { + class PFRecHit; + } + using PFRecHit = io_v1::PFRecHit; /// collection of PFRecHit objects typedef std::vector PFRecHitCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PreId.h b/DataFormats/ParticleFlowReco/interface/PreId.h index adce7f0e7c423..78a9ef659afd5 100644 --- a/DataFormats/ParticleFlowReco/interface/PreId.h +++ b/DataFormats/ParticleFlowReco/interface/PreId.h @@ -10,114 +10,117 @@ #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h" namespace reco { - class PreId { - public: - enum MatchingType { NONE = 0, ECALMATCH = 1, ESMATCH = 2, TRACKFILTERING = 3, MVA = 4, FINAL = 10 }; - - public: - PreId(unsigned nselection = 1) - : trackRef_(reco::TrackRef()), - clusterRef_(reco::PFClusterRef()), - matchingEop_(-999.), - EcalPos_(math::XYZPoint()), - meanShower_(math::XYZPoint()), - gsfChi2_(-999.), - dpt_(0.), - chi2Ratio_(0.) { - matching_.resize(nselection, false); - mva_.resize(nselection, -999.); - geomMatching_.resize(5, -999.); - } - void setTrack(reco::TrackRef trackref) { trackRef_ = trackref; } - - void setECALMatchingProperties(PFClusterRef clusterRef, - const math::XYZPoint &ecalpos, - const math::XYZPoint &meanShower, - float deta, - float dphi, - float chieta, - float chiphi, - float chi2, - float eop) { - clusterRef_ = clusterRef; - EcalPos_ = ecalpos; - meanShower_ = meanShower; - geomMatching_[0] = deta; - geomMatching_[1] = dphi; - geomMatching_[2] = chieta; - geomMatching_[3] = chiphi; - geomMatching_[4] = chi2; - matchingEop_ = eop; - } - - void setTrackProperties(float newchi2, float chi2ratio, float dpt) { - gsfChi2_ = newchi2; - chi2Ratio_ = chi2ratio; - dpt_ = dpt; - } - - void setFinalDecision(bool accepted, unsigned n = 0) { setMatching(FINAL, accepted, n); } - void setECALMatching(bool accepted, unsigned n = 0) { setMatching(ECALMATCH, accepted, n); } - void setESMatching(bool accepted, unsigned n = 0) { setMatching(ESMATCH, accepted, n); } - void setTrackFiltering(bool accepted, unsigned n = 0) { setMatching(TRACKFILTERING, accepted, n); } - void setMVA(bool accepted, float mva, unsigned n = 0) { - setMatching(MVA, accepted, n); - if (n < mva_.size()) - mva_[n] = mva; - } - - void setMatching(MatchingType type, bool result, unsigned n = 0); - bool matching(MatchingType type, unsigned n = 0) const { - if (n < matching_.size()) { - return matching_[n] & (1 << type); + namespace io_v1 { + class PreId { + public: + enum MatchingType { NONE = 0, ECALMATCH = 1, ESMATCH = 2, TRACKFILTERING = 3, MVA = 4, FINAL = 10 }; + + public: + PreId(unsigned nselection = 1) + : trackRef_(reco::TrackRef()), + clusterRef_(reco::PFClusterRef()), + matchingEop_(-999.), + EcalPos_(math::XYZPoint()), + meanShower_(math::XYZPoint()), + gsfChi2_(-999.), + dpt_(0.), + chi2Ratio_(0.) { + matching_.resize(nselection, false); + mva_.resize(nselection, -999.); + geomMatching_.resize(5, -999.); } - return false; - } - - /// Access methods - inline const std::vector &geomMatching() const { return geomMatching_; } - inline float eopMatch() const { return matchingEop_; } - inline float pt() const { return trackRef_->pt(); } - inline float eta() const { return trackRef_->eta(); } - inline float kfChi2() const { return trackRef_->normalizedChi2(); } - inline float kfNHits() const { return trackRef_->found(); } - - const math::XYZPoint &ecalPos() const { return EcalPos_; } - const math::XYZPoint &meanShower() const { return meanShower_; } - - inline float chi2Ratio() const { return chi2Ratio_; } - inline float gsfChi2() const { return gsfChi2_; } - - inline bool ecalMatching(unsigned n = 0) const { return matching(ECALMATCH, n); } - inline bool esMatching(unsigned n = 0) const { return matching(ESMATCH, n); } - inline bool trackFiltered(unsigned n = 0) const { return matching(TRACKFILTERING, n); } - inline bool mvaSelected(unsigned n = 0) const { return matching(MVA, n); } - inline bool preIded(unsigned n = 0) const { return matching(FINAL, n); } - - float mva(unsigned n = 0) const; - inline float dpt() const { return dpt_; } - reco::TrackRef trackRef() const { return trackRef_; } - PFClusterRef clusterRef() const { return clusterRef_; } - - private: - reco::TrackRef trackRef_; - PFClusterRef clusterRef_; - - std::vector geomMatching_; - float matchingEop_; - math::XYZPoint EcalPos_; - math::XYZPoint meanShower_; - - float gsfChi2_; - float dpt_; - float chi2Ratio_; - std::vector mva_; - - // bool goodpreid_; - // bool TkId_; - // bool EcalMatching_; - // bool PSMatching_; - std::vector matching_; - }; + void setTrack(reco::TrackRef trackref) { trackRef_ = trackref; } + + void setECALMatchingProperties(PFClusterRef clusterRef, + const math::XYZPoint &ecalpos, + const math::XYZPoint &meanShower, + float deta, + float dphi, + float chieta, + float chiphi, + float chi2, + float eop) { + clusterRef_ = clusterRef; + EcalPos_ = ecalpos; + meanShower_ = meanShower; + geomMatching_[0] = deta; + geomMatching_[1] = dphi; + geomMatching_[2] = chieta; + geomMatching_[3] = chiphi; + geomMatching_[4] = chi2; + matchingEop_ = eop; + } + + void setTrackProperties(float newchi2, float chi2ratio, float dpt) { + gsfChi2_ = newchi2; + chi2Ratio_ = chi2ratio; + dpt_ = dpt; + } + + void setFinalDecision(bool accepted, unsigned n = 0) { setMatching(FINAL, accepted, n); } + void setECALMatching(bool accepted, unsigned n = 0) { setMatching(ECALMATCH, accepted, n); } + void setESMatching(bool accepted, unsigned n = 0) { setMatching(ESMATCH, accepted, n); } + void setTrackFiltering(bool accepted, unsigned n = 0) { setMatching(TRACKFILTERING, accepted, n); } + void setMVA(bool accepted, float mva, unsigned n = 0) { + setMatching(MVA, accepted, n); + if (n < mva_.size()) + mva_[n] = mva; + } + + void setMatching(MatchingType type, bool result, unsigned n = 0); + bool matching(MatchingType type, unsigned n = 0) const { + if (n < matching_.size()) { + return matching_[n] & (1 << type); + } + return false; + } + + /// Access methods + inline const std::vector &geomMatching() const { return geomMatching_; } + inline float eopMatch() const { return matchingEop_; } + inline float pt() const { return trackRef_->pt(); } + inline float eta() const { return trackRef_->eta(); } + inline float kfChi2() const { return trackRef_->normalizedChi2(); } + inline float kfNHits() const { return trackRef_->found(); } + + const math::XYZPoint &ecalPos() const { return EcalPos_; } + const math::XYZPoint &meanShower() const { return meanShower_; } + + inline float chi2Ratio() const { return chi2Ratio_; } + inline float gsfChi2() const { return gsfChi2_; } + + inline bool ecalMatching(unsigned n = 0) const { return matching(ECALMATCH, n); } + inline bool esMatching(unsigned n = 0) const { return matching(ESMATCH, n); } + inline bool trackFiltered(unsigned n = 0) const { return matching(TRACKFILTERING, n); } + inline bool mvaSelected(unsigned n = 0) const { return matching(MVA, n); } + inline bool preIded(unsigned n = 0) const { return matching(FINAL, n); } + + float mva(unsigned n = 0) const; + inline float dpt() const { return dpt_; } + reco::TrackRef trackRef() const { return trackRef_; } + PFClusterRef clusterRef() const { return clusterRef_; } + + private: + reco::TrackRef trackRef_; + PFClusterRef clusterRef_; + + std::vector geomMatching_; + float matchingEop_; + math::XYZPoint EcalPos_; + math::XYZPoint meanShower_; + + float gsfChi2_; + float dpt_; + float chi2Ratio_; + std::vector mva_; + + // bool goodpreid_; + // bool TkId_; + // bool EcalMatching_; + // bool PSMatching_; + std::vector matching_; + }; + } // namespace io_v1 + using PreId = io_v1::PreId; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PreIdFwd.h b/DataFormats/ParticleFlowReco/interface/PreIdFwd.h index 153e100e2ac67..2dd12a34bb57b 100644 --- a/DataFormats/ParticleFlowReco/interface/PreIdFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PreIdFwd.h @@ -3,7 +3,10 @@ #include #include "DataFormats/Common/interface/Ref.h" namespace reco { - class PreId; + namespace io_v1 { + class PreId; + } + using PreId = io_v1::PreId; typedef std::vector PreIdCollection; typedef edm::Ref PreIdRef; } // namespace reco diff --git a/DataFormats/ParticleFlowReco/src/PFBlock.cc b/DataFormats/ParticleFlowReco/src/PFBlock.cc index 4fed1990d5883..bc0f879cf2af6 100644 --- a/DataFormats/ParticleFlowReco/src/PFBlock.cc +++ b/DataFormats/ParticleFlowReco/src/PFBlock.cc @@ -132,7 +132,7 @@ double PFBlock::dist(unsigned ie1, unsigned ie2, const LinkData& linkData) const return Dist; } -ostream& reco::operator<<(ostream& out, const reco::PFBlock& block) { +ostream& reco::io_v1::operator<<(ostream& out, const reco::PFBlock& block) { if (!out) return out; const edm::OwnVector& elements = block.elements(); diff --git a/DataFormats/ParticleFlowReco/src/PFCluster.cc b/DataFormats/ParticleFlowReco/src/PFCluster.cc index b1cde8be83b7e..b792116e4733b 100644 --- a/DataFormats/ParticleFlowReco/src/PFCluster.cc +++ b/DataFormats/ParticleFlowReco/src/PFCluster.cc @@ -4,6 +4,7 @@ using namespace std; using namespace reco; +using namespace reco::io_v1; const math::XYZPoint PFCluster::dummyVtx_(0, 0, 0); @@ -60,7 +61,7 @@ PFLayer::Layer PFCluster::layer() const { return PFLayer::fromCaloID(caloID()); } -std::ostream& reco::operator<<(std::ostream& out, const PFCluster& cluster) { +std::ostream& reco::io_v1::operator<<(std::ostream& out, const PFCluster& cluster) { if (!out) return out; diff --git a/DataFormats/ParticleFlowReco/src/classes_def_1.xml b/DataFormats/ParticleFlowReco/src/classes_def_1.xml index b00898de82920..70a1528a29701 100644 --- a/DataFormats/ParticleFlowReco/src/classes_def_1.xml +++ b/DataFormats/ParticleFlowReco/src/classes_def_1.xml @@ -12,8 +12,8 @@ - - + + @@ -21,8 +21,8 @@ - - + + @@ -32,14 +32,14 @@ - + - + diff --git a/DataFormats/ParticleFlowReco/src/classes_def_2.xml b/DataFormats/ParticleFlowReco/src/classes_def_2.xml index a0beb18f551dc..7da5424d59bdf 100644 --- a/DataFormats/ParticleFlowReco/src/classes_def_2.xml +++ b/DataFormats/ParticleFlowReco/src/classes_def_2.xml @@ -1,77 +1,54 @@ - - - - - - - - - + + - - + + - - + + - - - + + + - - - + + + - - + + - - - - + + - - - - - - - - - - - - - - - + + - - - - + + + - + @@ -97,7 +74,7 @@ - + @@ -105,7 +82,7 @@ - + @@ -145,29 +122,19 @@ - + - - - - - - - + + - - - - - - - + + - - + + - - - + + + - - + + - - + + - + - - - - - - - - - - - - - + - + @@ -53,10 +41,8 @@ - - - - + + @@ -94,81 +80,25 @@ - + - - - - - - + + - - >(onfile.p4Jet_); ]]> - - - >(onfile.p4CorrJet_); ]]> - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.dxy_PCA_); ]]> - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.pvPos_); ]]> - - - - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.flightLength_); ]]> - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.svPos_); ]]> - - - - - - - - - - - + + - - - - - - - - - getPflowIsolationVariables(); - pfIsoVar.sumEcalClusterEt = onfile.ecalPFClusIso_; - pfIsoVar.sumHcalClusterEt = onfile.hcalPFClusIso_; - newObj->setPflowIsolationVariables(pfIsoVar);]]> - - + @@ -182,16 +112,9 @@ - - - + + - - - - - - @@ -200,37 +123,23 @@ - - - - + + - - - - + + - - - - + + - - - - - - - - + + - + - - - - + + @@ -238,33 +147,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -298,59 +182,13 @@ - - - - - ::max()*(logintpack::unpack8logClosed(onfile.packedPuppiweight_,-2,0,64)/2. + 0.5); - ]]> - - - ::max()*(logintpack::unpack8logClosed(onfile.packedPuppiweightNoLepDiff_+onfile.packedPuppiweight_,-2,0,64)/2. - logintpack::unpack8logClosed(onfile.packedPuppiweight_,-2,0,64)/2.); - ]]> - - - - - - - - - - + + + + - - - - @@ -496,17 +334,17 @@ - - - - - - + + + + + + - - - - + + + + @@ -523,7 +361,7 @@ - + diff --git a/DataFormats/PatCandidates/src/classes_def_other.xml b/DataFormats/PatCandidates/src/classes_def_other.xml index fece4f788d6f3..13fd3a977742f 100644 --- a/DataFormats/PatCandidates/src/classes_def_other.xml +++ b/DataFormats/PatCandidates/src/classes_def_other.xml @@ -24,22 +24,22 @@ - + - - + + - - + + diff --git a/DataFormats/PatCandidates/src/classes_def_trigger.xml b/DataFormats/PatCandidates/src/classes_def_trigger.xml index d6ccc0be3df01..52f494b9f860c 100644 --- a/DataFormats/PatCandidates/src/classes_def_trigger.xml +++ b/DataFormats/PatCandidates/src/classes_def_trigger.xml @@ -1,10 +1,8 @@ - - - - + + @@ -17,7 +15,7 @@ - + @@ -26,12 +24,8 @@ - - - - - - + + @@ -42,7 +36,7 @@ - + diff --git a/DataFormats/PatCandidates/src/classes_def_user.xml b/DataFormats/PatCandidates/src/classes_def_user.xml index d96ba14a31ad3..be1f940889f37 100644 --- a/DataFormats/PatCandidates/src/classes_def_user.xml +++ b/DataFormats/PatCandidates/src/classes_def_user.xml @@ -38,9 +38,9 @@ - + - + diff --git a/DataFormats/ProtonReco/interface/ForwardProton.h b/DataFormats/ProtonReco/interface/ForwardProton.h index 84563ce96e0fc..4948ef4f37af8 100644 --- a/DataFormats/ProtonReco/interface/ForwardProton.h +++ b/DataFormats/ProtonReco/interface/ForwardProton.h @@ -16,157 +16,160 @@ #include "DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h" namespace reco { - class ForwardProton { - public: - /// parameter dimension - enum { dimension = 5 }; - /// indices to the covariance matrix - enum struct Index { xi, th_x, vtx_x, th_y, vtx_y, num_indices = dimension }; - /// dimension-parameter covariance matrix - typedef math::ErrorF::type CovarianceMatrix; - /// spatial vector - typedef math::XYZVectorF Vector; - /// point in the space - typedef math::XYZPointF Point; - /// type of reconstruction applied for this track - enum class ReconstructionMethod { invalid = -1, singleRP, multiRP }; - - public: - /// default constructor - ForwardProton(); - /// constructor from refit parameters, fitted vertex and momentum, and longitudinal fractional momentum loss - ForwardProton(double chi2, - double ndof, - const Point& vtx, - const Vector& momentum, - float xi, - const CovarianceMatrix& cov, - ReconstructionMethod method, - const CTPPSLocalTrackLiteRefVector& local_tracks, - bool valid, - const float time = 0., - const float time_err = 0.); - - /// fitted vertex position - const Point& vertex() const { return vertex_; } - /// fitted vertex horizontal position - float vx() const { return vertex_.x(); } - /// fitted vertex vertical position - float vy() const { return vertex_.y(); } - /// vertex longitudinal position (conventionally set to 0) - float vz() const { return vertex_.z(); } - /// fitted track direction - const Vector& momentum() const { return momentum_; } - /// scalar norm of fitted track momentum - float p() const { return momentum_.r(); } - /// scalar fitted track transverse momentum - float pt() const { return momentum_.rho(); } - /// fitted track momentum horizontal component - float px() const { return momentum_.x(); } - /// fitted track momentum vertical component - float py() const { return momentum_.y(); } - /// fitted track momentum longitudinal component - float pz() const { return momentum_.z(); } - - /// chi-squared of the fit - float chi2() const { return chi2_; } - /// number of degrees of freedom for the track fit - unsigned int ndof() const { return ndof_; } - /// chi-squared divided by ndof (or chi-squared * 1e6 if ndof is zero) - float normalizedChi2() const { return (ndof_ != 0) ? chi2_ / ndof_ : chi2_ * 1.e6; } - - /// longitudinal fractional momentum loss - float xi() const { return xi_; } - /// vertical scattering angle, in rad - float thetaX() const { return px() / p(); } - /// horizontal scattering angle, in rad - float thetaY() const { return py() / p(); } - - // vertex position can be obtained via TrackBase::vx() and vy() functions - - /// return the uncertainty on a given component - double error(Index i) const { return sqrt(covariance_((unsigned int)i, (unsigned int)i)); } - - /// uncertainty on longitudinal fractional momentum loss - float xiError() const { return error(Index::xi); } - /// uncertainty on fitted momentum horizontal angle opening - float thetaXError() const { return error(Index::th_x); } - /// uncertainty on fitted momentum vertical angle opening - float thetaYError() const { return error(Index::th_y); } - /// uncertainty on fitted vertex horizontal position - float vxError() const { return error(Index::vtx_x); } - /// uncertainty on fitted vertex vertical position - float vyError() const { return error(Index::vtx_y); } - - /// proton mass in GeV - static float mass() { return mass_; } - - /// compute the squared four-momentum transfer from incident and scattered momenta, and angular information - static float calculateT(double beam_mom, double proton_mom, double theta); - - /// four-momentum transfer squared, in GeV^2 - float t() const; - - /// time of proton arrival at forward stations - float time() const { return time_; } - void setTime(float time) { time_ = time; } - - /// uncertainty on time of proton arrival at forward stations - float timeError() const { return time_err_; } - void setTimeError(float time_err) { time_err_ = time_err; } - - /// set the flag for the fit validity - void setValidFit(bool valid = true) { valid_fit_ = valid; } - /// flag for the fit validity - bool validFit() const { return valid_fit_; } - - /// set the reconstruction method for this track - void setMethod(const ReconstructionMethod& method) { method_ = method; } - /// reconstruction method for this track - ReconstructionMethod method() const { return method_; } - - /// store the list of RP tracks that contributed to this global track - void setContributingLocalTracks(const CTPPSLocalTrackLiteRefVector& v) { contributing_local_tracks_ = v; } - /// list of RP tracks that contributed to this global track - const CTPPSLocalTrackLiteRefVector& contributingLocalTracks() const { return contributing_local_tracks_; } - - /// LHC sector - enum class LHCSector { invalid = -1, sector45, sector56 }; - LHCSector lhcSector() const { - if (pz() < 0.) - return LHCSector::sector56; - if (pz() > 0.) - return LHCSector::sector45; - return LHCSector::invalid; - } - - private: - static constexpr float mass_ = 0.938272046; ///< proton mass, GeV - static constexpr float massSquared_ = 0.88035443; ///< proton mass squared, GeV^2 - - /// reconstructed vertex position at z/s = 0 - Point vertex_; - /// reconstructed momentum vector - Vector momentum_; - /// reconstructed time at forward detectors - float time_; - /// uncertainty on reconstructed time at forward detectors - float time_err_; - /// fractional momentum loss (positive for diffractive protons) - float xi_; - /// 5x5 covariance matrix - CovarianceMatrix covariance_; - /// chi-squared - float chi2_; - /// number of degrees of freedom - unsigned int ndof_; - /// fit validity flag - bool valid_fit_; - /// type of reconstruction applied - ReconstructionMethod method_; - /// collection of references to tracks contributing to this object definition - CTPPSLocalTrackLiteRefVector contributing_local_tracks_; - }; + namespace io_v1 { + class ForwardProton { + public: + /// parameter dimension + enum { dimension = 5 }; + /// indices to the covariance matrix + enum struct Index { xi, th_x, vtx_x, th_y, vtx_y, num_indices = dimension }; + /// dimension-parameter covariance matrix + typedef math::ErrorF::type CovarianceMatrix; + /// spatial vector + typedef math::XYZVectorF Vector; + /// point in the space + typedef math::XYZPointF Point; + /// type of reconstruction applied for this track + enum class ReconstructionMethod { invalid = -1, singleRP, multiRP }; + + public: + /// default constructor + ForwardProton(); + /// constructor from refit parameters, fitted vertex and momentum, and longitudinal fractional momentum loss + ForwardProton(double chi2, + double ndof, + const Point& vtx, + const Vector& momentum, + float xi, + const CovarianceMatrix& cov, + ReconstructionMethod method, + const CTPPSLocalTrackLiteRefVector& local_tracks, + bool valid, + const float time = 0., + const float time_err = 0.); + + /// fitted vertex position + const Point& vertex() const { return vertex_; } + /// fitted vertex horizontal position + float vx() const { return vertex_.x(); } + /// fitted vertex vertical position + float vy() const { return vertex_.y(); } + /// vertex longitudinal position (conventionally set to 0) + float vz() const { return vertex_.z(); } + /// fitted track direction + const Vector& momentum() const { return momentum_; } + /// scalar norm of fitted track momentum + float p() const { return momentum_.r(); } + /// scalar fitted track transverse momentum + float pt() const { return momentum_.rho(); } + /// fitted track momentum horizontal component + float px() const { return momentum_.x(); } + /// fitted track momentum vertical component + float py() const { return momentum_.y(); } + /// fitted track momentum longitudinal component + float pz() const { return momentum_.z(); } + + /// chi-squared of the fit + float chi2() const { return chi2_; } + /// number of degrees of freedom for the track fit + unsigned int ndof() const { return ndof_; } + /// chi-squared divided by ndof (or chi-squared * 1e6 if ndof is zero) + float normalizedChi2() const { return (ndof_ != 0) ? chi2_ / ndof_ : chi2_ * 1.e6; } + + /// longitudinal fractional momentum loss + float xi() const { return xi_; } + /// vertical scattering angle, in rad + float thetaX() const { return px() / p(); } + /// horizontal scattering angle, in rad + float thetaY() const { return py() / p(); } + + // vertex position can be obtained via TrackBase::vx() and vy() functions + + /// return the uncertainty on a given component + double error(Index i) const { return sqrt(covariance_((unsigned int)i, (unsigned int)i)); } + + /// uncertainty on longitudinal fractional momentum loss + float xiError() const { return error(Index::xi); } + /// uncertainty on fitted momentum horizontal angle opening + float thetaXError() const { return error(Index::th_x); } + /// uncertainty on fitted momentum vertical angle opening + float thetaYError() const { return error(Index::th_y); } + /// uncertainty on fitted vertex horizontal position + float vxError() const { return error(Index::vtx_x); } + /// uncertainty on fitted vertex vertical position + float vyError() const { return error(Index::vtx_y); } + + /// proton mass in GeV + static float mass() { return mass_; } + + /// compute the squared four-momentum transfer from incident and scattered momenta, and angular information + static float calculateT(double beam_mom, double proton_mom, double theta); + + /// four-momentum transfer squared, in GeV^2 + float t() const; + + /// time of proton arrival at forward stations + float time() const { return time_; } + void setTime(float time) { time_ = time; } + + /// uncertainty on time of proton arrival at forward stations + float timeError() const { return time_err_; } + void setTimeError(float time_err) { time_err_ = time_err; } + + /// set the flag for the fit validity + void setValidFit(bool valid = true) { valid_fit_ = valid; } + /// flag for the fit validity + bool validFit() const { return valid_fit_; } + + /// set the reconstruction method for this track + void setMethod(const ReconstructionMethod& method) { method_ = method; } + /// reconstruction method for this track + ReconstructionMethod method() const { return method_; } + + /// store the list of RP tracks that contributed to this global track + void setContributingLocalTracks(const CTPPSLocalTrackLiteRefVector& v) { contributing_local_tracks_ = v; } + /// list of RP tracks that contributed to this global track + const CTPPSLocalTrackLiteRefVector& contributingLocalTracks() const { return contributing_local_tracks_; } + + /// LHC sector + enum class LHCSector { invalid = -1, sector45, sector56 }; + LHCSector lhcSector() const { + if (pz() < 0.) + return LHCSector::sector56; + if (pz() > 0.) + return LHCSector::sector45; + return LHCSector::invalid; + } + + private: + static constexpr float mass_ = 0.938272046; ///< proton mass, GeV + static constexpr float massSquared_ = 0.88035443; ///< proton mass squared, GeV^2 + + /// reconstructed vertex position at z/s = 0 + Point vertex_; + /// reconstructed momentum vector + Vector momentum_; + /// reconstructed time at forward detectors + float time_; + /// uncertainty on reconstructed time at forward detectors + float time_err_; + /// fractional momentum loss (positive for diffractive protons) + float xi_; + /// 5x5 covariance matrix + CovarianceMatrix covariance_; + /// chi-squared + float chi2_; + /// number of degrees of freedom + unsigned int ndof_; + /// fit validity flag + bool valid_fit_; + /// type of reconstruction applied + ReconstructionMethod method_; + /// collection of references to tracks contributing to this object definition + CTPPSLocalTrackLiteRefVector contributing_local_tracks_; + }; + } // namespace io_v1 + using ForwardProton = io_v1::ForwardProton; } // namespace reco #endif diff --git a/DataFormats/ProtonReco/interface/ForwardProtonFwd.h b/DataFormats/ProtonReco/interface/ForwardProtonFwd.h index 8ef9b32c6d078..9ec1e3eeec77b 100644 --- a/DataFormats/ProtonReco/interface/ForwardProtonFwd.h +++ b/DataFormats/ProtonReco/interface/ForwardProtonFwd.h @@ -17,7 +17,10 @@ #include namespace reco { - class ForwardProton; + namespace io_v1 { + class ForwardProton; + } + using ForwardProton = io_v1::ForwardProton; /// Collection of ForwardProton objects typedef std::vector ForwardProtonCollection; /// Persistent reference to a ForwardProton diff --git a/DataFormats/ProtonReco/src/classes_def.xml b/DataFormats/ProtonReco/src/classes_def.xml index 0e88cf81de42e..a1427c404e1c8 100644 --- a/DataFormats/ProtonReco/src/classes_def.xml +++ b/DataFormats/ProtonReco/src/classes_def.xml @@ -1,10 +1,10 @@ - - + + - - - - - + + + + + diff --git a/DataFormats/RecoCandidate/interface/IsoDeposit.h b/DataFormats/RecoCandidate/interface/IsoDeposit.h index aa4c0d16f7506..1b3714f1f017d 100644 --- a/DataFormats/RecoCandidate/interface/IsoDeposit.h +++ b/DataFormats/RecoCandidate/interface/IsoDeposit.h @@ -45,264 +45,267 @@ namespace reco { } // namespace reco namespace reco { + namespace io_v1 { - class IsoDeposit { - public: - typedef isodeposit::Direction Direction; - typedef isodeposit::AbsVeto AbsVeto; - typedef isodeposit::AbsVetos AbsVetos; - typedef Direction::Distance Distance; - typedef std::multimap DepositsMultimap; - typedef DepositsMultimap::const_iterator DepIterator; - - // old style vetos - struct Veto { - Direction vetoDir; - float dR; - Veto() {} - Veto(Direction dir, double d) : vetoDir(dir), dR(d) {} - }; - typedef std::vector Vetos; - - //! Constructor - IsoDeposit(double eta = 0, double phi = 0); - IsoDeposit(const Direction& candDirection); - - //! Destructor - virtual ~IsoDeposit() {} - - //! Get direction of isolation cone - const Direction& direction() const { return theDirection; } - double eta() const { return theDirection.eta(); } - double phi() const { return theDirection.phi(); } - - //! Get veto area - const Veto& veto() const { return theVeto; } - //! Set veto - void setVeto(const Veto& aVeto) { theVeto = aVeto; } - - //! Add deposit (ie. transverse energy or pT) - void addDeposit(double dr, double deposit); // FIXME - temporary for backward compatibility - void addDeposit(const Direction& depDir, double deposit); - - //! Get deposit - double depositWithin(double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit wrt other direction - double depositWithin(Direction dir, - double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit - std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - double threshold = -1e+36, //threshold on counted deposits - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit wrt other direction - std::pair depositAndCountWithin(Direction dir, //wrt another direction - double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - double threshold = -1e+36, //threshold on deposits - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit with new style vetos - double depositWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos, //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit - std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos, //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get energy or pT attached to cand trajectory - double candEnergy() const { return theCandTag; } - - //! Set energy or pT attached to cand trajectory - void addCandEnergy(double et) { theCandTag += et; } - - std::string print() const; - - class const_iterator { + class IsoDeposit { public: - const const_iterator& operator++() { - ++it_; - cacheReady_ = false; - return *this; - } - const const_iterator* operator->() const { return this; } - float dR() const { return it_->first.deltaR; } - float eta() const { - if (!cacheReady_) - doDir(); - return cache_.eta(); - } - float phi() const { - if (!cacheReady_) - doDir(); - return cache_.phi(); - } - float value() const { return it_->second; } - bool operator!=(const const_iterator& it2) { return it2.it_ != it_; } - friend class IsoDeposit; - - private: + typedef isodeposit::Direction Direction; + typedef isodeposit::AbsVeto AbsVeto; + typedef isodeposit::AbsVetos AbsVetos; typedef Direction::Distance Distance; - void doDir() const { - if (!cacheReady_) - cache_ = parent_->direction() + it_->first; - cacheReady_ = true; - } - const_iterator(const IsoDeposit* parent, std::multimap::const_iterator it) - : parent_(parent), it_(it), cache_(), cacheReady_(false) {} - const reco::IsoDeposit* parent_; - std::multimap::const_iterator it_; - CMS_THREAD_SAFE mutable Direction cache_; - mutable std::atomic cacheReady_; - }; - const_iterator begin() const { return const_iterator(this, theDeposits.begin()); } - const_iterator end() const { return const_iterator(this, theDeposits.end()); } - - class SumAlgo { - public: - SumAlgo() : sum_(0) {} - void operator+=(DepIterator deposit) { sum_ += deposit->second; } - void operator+=(double deposit) { sum_ += deposit; } - double result() const { return sum_; } - - private: - double sum_; - }; - class CountAlgo { - public: - CountAlgo() : count_(0) {} - void operator+=(DepIterator deposit) { count_++; } - void operator+=(double deposit) { count_++; } - double result() const { return count_; } - - private: - size_t count_; - }; - class Sum2Algo { - public: - Sum2Algo() : sum2_(0) {} - void operator+=(DepIterator deposit) { sum2_ += deposit->second * deposit->second; } - void operator+=(double deposit) { sum2_ += deposit * deposit; } - double result() const { return sum2_; } - - private: - double sum2_; - }; - class MaxAlgo { - public: - MaxAlgo() : max_(0) {} - void operator+=(DepIterator deposit) { - if (deposit->second > max_) - max_ = deposit->second; - } - void operator+=(double deposit) { - if (deposit > max_) - max_ = deposit; - } - double result() const { return max_; } + typedef std::multimap DepositsMultimap; + typedef DepositsMultimap::const_iterator DepIterator; + + // old style vetos + struct Veto { + Direction vetoDir; + float dR; + Veto() {} + Veto(Direction dir, double d) : vetoDir(dir), dR(d) {} + }; + typedef std::vector Vetos; + + //! Constructor + IsoDeposit(double eta = 0, double phi = 0); + IsoDeposit(const Direction& candDirection); + + //! Destructor + virtual ~IsoDeposit() {} + + //! Get direction of isolation cone + const Direction& direction() const { return theDirection; } + double eta() const { return theDirection.eta(); } + double phi() const { return theDirection.phi(); } + + //! Get veto area + const Veto& veto() const { return theVeto; } + //! Set veto + void setVeto(const Veto& aVeto) { theVeto = aVeto; } + + //! Add deposit (ie. transverse energy or pT) + void addDeposit(double dr, double deposit); // FIXME - temporary for backward compatibility + void addDeposit(const Direction& depDir, double deposit); + + //! Get deposit + double depositWithin(double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit wrt other direction + double depositWithin(Direction dir, + double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit + std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + double threshold = -1e+36, //threshold on counted deposits + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit wrt other direction + std::pair depositAndCountWithin(Direction dir, //wrt another direction + double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + double threshold = -1e+36, //threshold on deposits + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit with new style vetos + double depositWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos, //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit + std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos, //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get energy or pT attached to cand trajectory + double candEnergy() const { return theCandTag; } + + //! Set energy or pT attached to cand trajectory + void addCandEnergy(double et) { theCandTag += et; } + + std::string print() const; + + class const_iterator { + public: + const const_iterator& operator++() { + ++it_; + cacheReady_ = false; + return *this; + } + const const_iterator* operator->() const { return this; } + float dR() const { return it_->first.deltaR; } + float eta() const { + if (!cacheReady_) + doDir(); + return cache_.eta(); + } + float phi() const { + if (!cacheReady_) + doDir(); + return cache_.phi(); + } + float value() const { return it_->second; } + bool operator!=(const const_iterator& it2) { return it2.it_ != it_; } + friend class IsoDeposit; + + private: + typedef Direction::Distance Distance; + void doDir() const { + if (!cacheReady_) + cache_ = parent_->direction() + it_->first; + cacheReady_ = true; + } + const_iterator(const IsoDeposit* parent, std::multimap::const_iterator it) + : parent_(parent), it_(it), cache_(), cacheReady_(false) {} + const IsoDeposit* parent_; + std::multimap::const_iterator it_; + CMS_THREAD_SAFE mutable Direction cache_; + mutable std::atomic cacheReady_; + }; + const_iterator begin() const { return const_iterator(this, theDeposits.begin()); } + const_iterator end() const { return const_iterator(this, theDeposits.end()); } + + class SumAlgo { + public: + SumAlgo() : sum_(0) {} + void operator+=(DepIterator deposit) { sum_ += deposit->second; } + void operator+=(double deposit) { sum_ += deposit; } + double result() const { return sum_; } + + private: + double sum_; + }; + class CountAlgo { + public: + CountAlgo() : count_(0) {} + void operator+=(DepIterator deposit) { count_++; } + void operator+=(double deposit) { count_++; } + double result() const { return count_; } + + private: + size_t count_; + }; + class Sum2Algo { + public: + Sum2Algo() : sum2_(0) {} + void operator+=(DepIterator deposit) { sum2_ += deposit->second * deposit->second; } + void operator+=(double deposit) { sum2_ += deposit * deposit; } + double result() const { return sum2_; } + + private: + double sum2_; + }; + class MaxAlgo { + public: + MaxAlgo() : max_(0) {} + void operator+=(DepIterator deposit) { + if (deposit->second > max_) + max_ = deposit->second; + } + void operator+=(double deposit) { + if (deposit > max_) + max_ = deposit; + } + double result() const { return max_; } + + private: + double max_; + }; + + class MeanDRAlgo { + public: + MeanDRAlgo() : sum_(0.), count_(0.) {} + void operator+=(DepIterator deposit) { + sum_ += deposit->first.deltaR; + count_ += 1.0; + } + double result() const { return sum_ / std::max(1., count_); } + + private: + double sum_; + double count_; + }; + + class SumDRAlgo { + public: + SumDRAlgo() : sum_(0.) {} + void operator+=(DepIterator deposit) { sum_ += deposit->first.deltaR; } + double result() const { return sum_; } + + private: + double sum_; + }; + + //! Get some info about the deposit (e.g. sum, max, sum2, count) + template + double algoWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + //! Get some info about the deposit (e.g. sum, max, sum2, count) w.r.t. other direction + template + double algoWithin(const Direction&, + double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // count of the non-vetoed deposits in the cone + double countWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // sum of the non-vetoed deposits in the cone + double sumWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // sum of the non-vetoed deposits in the cone w.r.t. other direction + double sumWithin(const Direction& dir, + double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; // sum of the squares of the non-vetoed deposits in the cone + double sum2Within(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // maximum value among the non-vetoed deposits in the cone + double maxWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // maximum value among the non-vetoed deposits in the cone + double nearestDR(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; private: - double max_; - }; + //! direcion of deposit (center of isolation cone) + Direction theDirection; - class MeanDRAlgo { - public: - MeanDRAlgo() : sum_(0.), count_(0.) {} - void operator+=(DepIterator deposit) { - sum_ += deposit->first.deltaR; - count_ += 1.0; - } - double result() const { return sum_ / std::max(1., count_); } + //! area to be excluded in computaion of depositWithin + Veto theVeto; - private: - double sum_; - double count_; - }; + //! float tagging cand, ment to be transverse energy or pT attached to cand, + float theCandTag; - class SumDRAlgo { - public: - SumDRAlgo() : sum_(0.) {} - void operator+=(DepIterator deposit) { sum_ += deposit->first.deltaR; } - double result() const { return sum_; } + //! the deposits identifed by relative position to center of cone and deposit value - private: - double sum_; + DepositsMultimap theDeposits; }; - //! Get some info about the deposit (e.g. sum, max, sum2, count) - template - double algoWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - //! Get some info about the deposit (e.g. sum, max, sum2, count) w.r.t. other direction - template - double algoWithin(const Direction&, - double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // count of the non-vetoed deposits in the cone - double countWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // sum of the non-vetoed deposits in the cone - double sumWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // sum of the non-vetoed deposits in the cone w.r.t. other direction - double sumWithin(const Direction& dir, - double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; // sum of the squares of the non-vetoed deposits in the cone - double sum2Within(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // maximum value among the non-vetoed deposits in the cone - double maxWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // maximum value among the non-vetoed deposits in the cone - double nearestDR(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - private: - //! direcion of deposit (center of isolation cone) - Direction theDirection; - - //! area to be excluded in computaion of depositWithin - Veto theVeto; - - //! float tagging cand, ment to be transverse energy or pT attached to cand, - float theCandTag; - - //! the deposits identifed by relative position to center of cone and deposit value - - DepositsMultimap theDeposits; - }; - + } // namespace io_v1 + using IsoDeposit = io_v1::IsoDeposit; } // namespace reco template diff --git a/DataFormats/RecoCandidate/interface/IsoDepositFwd.h b/DataFormats/RecoCandidate/interface/IsoDepositFwd.h index e6fd152bfb9d1..81daed9cdc07e 100644 --- a/DataFormats/RecoCandidate/interface/IsoDepositFwd.h +++ b/DataFormats/RecoCandidate/interface/IsoDepositFwd.h @@ -6,7 +6,10 @@ #define HAVE_COMMON_ISODEPOSITMAP 1 namespace reco { - class IsoDeposit; + namespace io_v1 { + class IsoDeposit; + } + using IsoDeposit = io_v1::IsoDeposit; //! keep it only as a part of ValueMap typedef edm::ValueMap IsoDepositMap; diff --git a/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h b/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h index e4b3e9150c04d..74c6526095b5e 100644 --- a/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h +++ b/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h @@ -11,35 +11,38 @@ #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" namespace reco { + namespace io_v1 { - class RecoChargedCandidate : public RecoCandidate { - public: - /// default constructor - RecoChargedCandidate() : RecoCandidate() {} - /// constructor from values - RecoChargedCandidate( - Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// constructor from values - RecoChargedCandidate( - Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// destructor - ~RecoChargedCandidate() override; - /// returns a clone of the candidate - RecoChargedCandidate* clone() const override; - /// set reference to track - void setTrack(const reco::TrackRef& r) { track_ = r; } - /// reference to a track - reco::TrackRef track() const override; + class RecoChargedCandidate : public RecoCandidate { + public: + /// default constructor + RecoChargedCandidate() : RecoCandidate() {} + /// constructor from values + RecoChargedCandidate( + Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// constructor from values + RecoChargedCandidate( + Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// destructor + ~RecoChargedCandidate() override; + /// returns a clone of the candidate + RecoChargedCandidate* clone() const override; + /// set reference to track + void setTrack(const reco::TrackRef& r) { track_ = r; } + /// reference to a track + reco::TrackRef track() const override; - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to a track - reco::TrackRef track_; - }; + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to a track + reco::TrackRef track_; + }; + } // namespace io_v1 + using RecoChargedCandidate = io_v1::RecoChargedCandidate; } // namespace reco #endif diff --git a/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h b/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h index af334f56d5494..ea67c910e7bce 100644 --- a/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h +++ b/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class RecoChargedCandidate; + namespace io_v1 { + class RecoChargedCandidate; + } + using RecoChargedCandidate = io_v1::RecoChargedCandidate; /// collectin of RecoChargedCandidate objects typedef std::vector RecoChargedCandidateCollection; diff --git a/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h b/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h index 1f4c32059297f..efd01af6a6607 100644 --- a/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h +++ b/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h @@ -9,42 +9,46 @@ namespace reco { typedef LeafRefCandidateT RecoChargedRefCandidateBase; - class RecoChargedRefCandidate : public LeafRefCandidateT { - public: - RecoChargedRefCandidate() {} - RecoChargedRefCandidate(TrackRef ref, float m) : LeafRefCandidateT(ref, m) {} - - ~RecoChargedRefCandidate() override {} - - RecoChargedRefCandidate* clone() const override { return new RecoChargedRefCandidate(*this); } - - reco::TrackRef track() const { return getRef(); } - // return a pointer to the best track, if available. - // otherwise, return a null pointer - const reco::Track* bestTrack() const override { - if (track().isNonnull() && track().isAvailable()) - return &(*track()); - else - return nullptr; - } - - /// uncertainty on dz - float dzError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dzError(); - else - return 0; - } - /// uncertainty on dxy - float dxyError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dxyError(); - else - return 0; - } - }; + namespace io_v1 { + + class RecoChargedRefCandidate : public LeafRefCandidateT { + public: + RecoChargedRefCandidate() {} + RecoChargedRefCandidate(TrackRef ref, float m) : LeafRefCandidateT(ref, m) {} + + ~RecoChargedRefCandidate() override {} + + RecoChargedRefCandidate* clone() const override { return new RecoChargedRefCandidate(*this); } + + reco::TrackRef track() const { return getRef(); } + // return a pointer to the best track, if available. + // otherwise, return a null pointer + const reco::Track* bestTrack() const override { + if (track().isNonnull() && track().isAvailable()) + return &(*track()); + else + return nullptr; + } + + /// uncertainty on dz + float dzError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dzError(); + else + return 0; + } + /// uncertainty on dxy + float dxyError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dxyError(); + else + return 0; + } + }; + } // namespace io_v1 + using RecoChargedRefCandidate = io_v1::RecoChargedRefCandidate; } // namespace reco #endif diff --git a/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h b/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h index 1c5ffd455424e..61d7d0cc072ae 100644 --- a/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h +++ b/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h @@ -11,35 +11,38 @@ #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" namespace reco { + namespace io_v1 { - class RecoEcalCandidate : public RecoCandidate { - public: - /// default constructor - RecoEcalCandidate() : RecoCandidate() {} - /// constructor from values - RecoEcalCandidate( - Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// constructor from values - RecoEcalCandidate( - Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// destructor - ~RecoEcalCandidate() override; - /// returns a clone of the candidate - RecoEcalCandidate* clone() const override; - /// set reference to superCluster - void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } - /// reference to a superCluster - reco::SuperClusterRef superCluster() const override; + class RecoEcalCandidate : public RecoCandidate { + public: + /// default constructor + RecoEcalCandidate() : RecoCandidate() {} + /// constructor from values + RecoEcalCandidate( + Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// constructor from values + RecoEcalCandidate( + Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// destructor + ~RecoEcalCandidate() override; + /// returns a clone of the candidate + RecoEcalCandidate* clone() const override; + /// set reference to superCluster + void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } + /// reference to a superCluster + reco::SuperClusterRef superCluster() const override; - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to a superCluster - reco::SuperClusterRef superCluster_; - }; + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to a superCluster + reco::SuperClusterRef superCluster_; + }; + } // namespace io_v1 + using RecoEcalCandidate = io_v1::RecoEcalCandidate; } // namespace reco #endif diff --git a/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h b/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h index f5dfad4018448..a71aea7220a5b 100644 --- a/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h +++ b/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class RecoEcalCandidate; + namespace io_v1 { + class RecoEcalCandidate; + } + using RecoEcalCandidate = io_v1::RecoEcalCandidate; /// collectin of RecoEcalCandidate objects typedef std::vector RecoEcalCandidateCollection; diff --git a/DataFormats/RecoCandidate/src/classes_def.xml b/DataFormats/RecoCandidate/src/classes_def.xml index 356ffc7f9c72c..12780fb532966 100644 --- a/DataFormats/RecoCandidate/src/classes_def.xml +++ b/DataFormats/RecoCandidate/src/classes_def.xml @@ -1,33 +1,22 @@ - - - - + + - - + + - - - - + + - - - - + + - - - - + + - - - - - + + @@ -40,112 +29,114 @@ - - - - - + + + + + + - - - - - + + + + + - + - - + + - - + + - + - - - - - - + + + + + + + - + - - - + + + - - + + - + - - - + + + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - + - + - - + + - + - + - + - + diff --git a/DataFormats/TauReco/interface/PFTau.h b/DataFormats/TauReco/interface/PFTau.h index 48e8161de8bed..235b24934c66c 100644 --- a/DataFormats/TauReco/interface/PFTau.h +++ b/DataFormats/TauReco/interface/PFTau.h @@ -32,285 +32,288 @@ namespace reco { } // namespace reco namespace reco { - - class PFTau : public BaseTau { - public: - enum hadronicDecayMode { - kNull = -1, - kOneProng0PiZero, - kOneProng1PiZero, - kOneProng2PiZero, - kOneProng3PiZero, - kOneProngNPiZero, - kTwoProng0PiZero, - kTwoProng1PiZero, - kTwoProng2PiZero, - kTwoProng3PiZero, - kTwoProngNPiZero, - kThreeProng0PiZero, - kThreeProng1PiZero, - kThreeProng2PiZero, - kThreeProng3PiZero, - kThreeProngNPiZero, - kRareDecayMode + namespace io_v1 { + + class PFTau : public BaseTau { + public: + enum hadronicDecayMode { + kNull = -1, + kOneProng0PiZero, + kOneProng1PiZero, + kOneProng2PiZero, + kOneProng3PiZero, + kOneProngNPiZero, + kTwoProng0PiZero, + kTwoProng1PiZero, + kTwoProng2PiZero, + kTwoProng3PiZero, + kTwoProngNPiZero, + kThreeProng0PiZero, + kThreeProng1PiZero, + kThreeProng2PiZero, + kThreeProng3PiZero, + kThreeProngNPiZero, + kRareDecayMode + }; + + PFTau(); + PFTau(Charge q, const LorentzVector&, const Point& = Point(0, 0, 0)); + ~PFTau() override {} + PFTau* clone() const override; + + const JetBaseRef& jetRef() const; + void setjetRef(const JetBaseRef&); + + // functions to access the PFTauTagInfoRef used by HLT + const PFTauTagInfoRef& pfTauTagInfoRef() const; + void setpfTauTagInfoRef(const PFTauTagInfoRef); + + PFRecoTauChargedHadronRef leadTauChargedHadronCandidate() const; + const CandidatePtr& leadChargedHadrCand() const; + const CandidatePtr& leadNeutralCand() const; + //Can be either the charged or the neutral one + const CandidatePtr& leadCand() const; + + void setleadChargedHadrCand(const CandidatePtr&); + void setleadNeutralCand(const CandidatePtr&); + void setleadCand(const CandidatePtr&); + + /// Signed transverse impact parameter significance of the Track + /// associated to the leading charged PFCandidate + float leadPFChargedHadrCandsignedSipt() const; + void setleadPFChargedHadrCandsignedSipt(const float&); + + /// Candidates in signal region + const std::vector& signalCands() const; + void setsignalCands(const std::vector&); + + /// Charged hadrons in signal region + const std::vector& signalChargedHadrCands() const; + void setsignalChargedHadrCands(const std::vector&); + + /// Neutral hadrons in signal region + const std::vector& signalNeutrHadrCands() const; + void setsignalNeutrHadrCands(const std::vector&); + + /// Gamma candidates in signal region + const std::vector& signalGammaCands() const; + void setsignalGammaCands(const std::vector&); + + /// Candidates in isolation region + const std::vector& isolationCands() const; + void setisolationCands(const std::vector&); + + /// Charged candidates in isolation region + const std::vector& isolationChargedHadrCands() const; + void setisolationChargedHadrCands(const std::vector&); + + //// Neutral hadrons in isolation region + const std::vector& isolationNeutrHadrCands() const; + void setisolationNeutrHadrCands(const std::vector&); + + /// Gamma candidates in isolation region + const std::vector& isolationGammaCands() const; + void setisolationGammaCands(const std::vector&); + + /// Getters for different PFCandidates for PFTaus made from PFCandidates + const PFCandidatePtr leadPFChargedHadrCand() const; + const PFCandidatePtr leadPFNeutralCand() const; + const PFCandidatePtr leadPFCand() const; + const std::vector& signalPFCands() const; + const std::vector& signalPFChargedHadrCands() const; + const std::vector& signalPFNeutrHadrCands() const; + const std::vector& signalPFGammaCands() const; + const std::vector& isolationPFCands() const; + const std::vector& isolationPFChargedHadrCands() const; + const std::vector& isolationPFNeutrHadrCands() const; + const std::vector& isolationPFGammaCands() const; + + /// Sum of charged hadron candidate PT in isolation cone; returns NaN + /// if isolation region is undefined. + float isolationPFChargedHadrCandsPtSum() const; + void setisolationPFChargedHadrCandsPtSum(const float&); + + /// Sum of gamma candidate PT in isolation cone; returns NaN + /// if isolation region is undefined. + float isolationPFGammaCandsEtSum() const; + void setisolationPFGammaCandsEtSum(const float&); + + /// Et of the highest Et HCAL PFCluster + float maximumHCALPFClusterEt() const; + void setmaximumHCALPFClusterEt(const float&); + + /// Retrieve the association of signal region gamma candidates into candidate PiZeros + const std::vector& signalPiZeroCandidates() const; + void setsignalPiZeroCandidates(std::vector); + void setSignalPiZeroCandidatesRefs(RecoTauPiZeroRefVector); + + /// Retrieve the association of isolation region gamma candidates into candidate PiZeros + const std::vector& isolationPiZeroCandidates() const; + void setisolationPiZeroCandidates(std::vector); + void setIsolationPiZeroCandidatesRefs(RecoTauPiZeroRefVector); + + /// Retrieve the association of signal region PF candidates into candidate PFRecoTauChargedHadrons + const std::vector& signalTauChargedHadronCandidates() const; + void setSignalTauChargedHadronCandidates(std::vector); + void setSignalTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); + + /// Retrieve the association of isolation region PF candidates into candidate PFRecoTauChargedHadron + const std::vector& isolationTauChargedHadronCandidates() const; + void setIsolationTauChargedHadronCandidates(std::vector); + void setIsolationTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); + + /// Retrieve the identified hadronic decay mode according to the number of + /// charged and piZero candidates in the signal cone + hadronicDecayMode decayMode() const; + void setDecayMode(const hadronicDecayMode&); + + /// Effect of eta and phi correction of strip on mass of tau candidate + float bendCorrMass() const { return bendCorrMass_; } + void setBendCorrMass(float bendCorrMass) { bendCorrMass_ = bendCorrMass; } + + /// Size of signal cone + double signalConeSize() const { return signalConeSize_; } + void setSignalConeSize(double signalConeSize) { signalConeSize_ = signalConeSize; } + + //Electron rejection + float emFraction() const; // Ecal/Hcal Cluster Energy + float hcalTotOverPLead() const; // total Hcal Cluster E / leadPFChargedHadron P + float hcalMaxOverPLead() const; // max. Hcal Cluster E / leadPFChargedHadron P + // Hcal Cluster E in R<0.184 around Ecal impact point of leading track / leadPFChargedHadron P + float hcal3x3OverPLead() const; + float ecalStripSumEOverPLead() const; // Simple BremsRecovery Sum E / leadPFChargedHadron P + float bremsRecoveryEOverPLead() const; // BremsRecovery Sum E / leadPFChargedHadron P + reco::TrackRef electronPreIDTrack() const; // Ref to KF track from Electron PreID + float electronPreIDOutput() const; // BDT output from Electron PreID + bool electronPreIDDecision() const; // Decision from Electron PreID + + void setemFraction(const float&); + void sethcalTotOverPLead(const float&); + void sethcalMaxOverPLead(const float&); + void sethcal3x3OverPLead(const float&); + void setecalStripSumEOverPLead(const float&); + void setbremsRecoveryEOverPLead(const float&); + void setelectronPreIDTrack(const reco::TrackRef&); + void setelectronPreIDOutput(const float&); + void setelectronPreIDDecision(const bool&); + + // For Muon Rejection + bool hasMuonReference() const; // check if muon ref exists + float caloComp() const; + float segComp() const; + bool muonDecision() const; + void setCaloComp(const float&); + void setSegComp(const float&); + void setMuonDecision(const bool&); + + /// return the number of source Candidates + /// ( the candidates used to construct this Candidate) + /// in the case of taus, there is only one source candidate, + /// which is the corresponding PFJet + size_type numberOfSourceCandidatePtrs() const override { return 1; } + + /// return a RefToBase to the source Candidates + /// ( the candidates used to construct this Candidate) + CandidatePtr sourceCandidatePtr(size_type i) const override; + + /// prints information on this PFTau + void dump(std::ostream& out = std::cout) const; + + private: + friend class tau::RecoTauConstructor; + friend class tau::PFRecoTauEnergyAlgorithmPlugin; + + //These are used by the friends + std::vector& signalPiZeroCandidatesRestricted(); + std::vector& isolationPiZeroCandidatesRestricted(); + std::vector& signalTauChargedHadronCandidatesRestricted(); + std::vector& isolationTauChargedHadronCandidatesRestricted(); + + // check overlap with another candidate + bool overlap(const Candidate&) const override; + + bool muonDecision_; + bool electronPreIDDecision_; + + // SIP + float leadPFChargedHadrCandsignedSipt_; + // Isolation variables + float isolationPFChargedHadrCandsPtSum_; + float isolationPFGammaCandsEtSum_; + float maximumHCALPFClusterEt_; + + // Electron rejection variables + float emFraction_; + float hcalTotOverPLead_; + float hcalMaxOverPLead_; + float hcal3x3OverPLead_; + float ecalStripSumEOverPLead_; + float bremsRecoveryEOverPLead_; + float electronPreIDOutput_; + + // Muon rejection variables + float caloComp_; + float segComp_; + + hadronicDecayMode decayMode_; + + float bendCorrMass_; + + float signalConeSize_; + + reco::JetBaseRef jetRef_; + PFTauTagInfoRef PFTauTagInfoRef_; + reco::CandidatePtr leadChargedHadrCand_; + reco::CandidatePtr leadNeutralCand_; + reco::CandidatePtr leadCand_; + reco::TrackRef electronPreIDTrack_; + + // Signal candidates + std::vector selectedSignalCands_; + std::vector selectedSignalChargedHadrCands_; + std::vector selectedSignalNeutrHadrCands_; + std::vector selectedSignalGammaCands_; + + // Isolation candidates + std::vector selectedIsolationCands_; + std::vector selectedIsolationChargedHadrCands_; + std::vector selectedIsolationNeutrHadrCands_; + std::vector selectedIsolationGammaCands_; + + // Transient caches for PFCandidate-based accessors + edm::AtomicPtrCache leadPFChargedHadrCand_; + edm::AtomicPtrCache leadPFNeutralCand_; + edm::AtomicPtrCache leadPFCand_; + + edm::AtomicPtrCache> selectedTransientSignalPFCands_; + edm::AtomicPtrCache> selectedTransientSignalPFChargedHadrCands_; + edm::AtomicPtrCache> selectedTransientSignalPFNeutrHadrCands_; + edm::AtomicPtrCache> selectedTransientSignalPFGammaCands_; + + edm::AtomicPtrCache> selectedTransientIsolationPFCands_; + edm::AtomicPtrCache> selectedTransientIsolationPFChargedHadrCands_; + edm::AtomicPtrCache> selectedTransientIsolationPFNeutrHadrCands_; + edm::AtomicPtrCache> selectedTransientIsolationPFGammaCands_; + + RecoTauPiZeroRefVector signalPiZeroCandidatesRefs_; + RecoTauPiZeroRefVector isolationPiZeroCandidatesRefs_; + + PFRecoTauChargedHadronRefVector signalTauChargedHadronCandidatesRefs_; + PFRecoTauChargedHadronRefVector isolationTauChargedHadronCandidatesRefs_; + + // Association of gamma candidates into PiZeros (transient) + edm::AtomicPtrCache> signalPiZeroCandidates_; + edm::AtomicPtrCache> isolationPiZeroCandidates_; + + // Association of PF candidates into PFRecoTauChargedHadrons (transient) + edm::AtomicPtrCache> signalTauChargedHadronCandidates_; + edm::AtomicPtrCache> isolationTauChargedHadronCandidates_; }; - PFTau(); - PFTau(Charge q, const LorentzVector&, const Point& = Point(0, 0, 0)); - ~PFTau() override {} - PFTau* clone() const override; - - const JetBaseRef& jetRef() const; - void setjetRef(const JetBaseRef&); - - // functions to access the PFTauTagInfoRef used by HLT - const PFTauTagInfoRef& pfTauTagInfoRef() const; - void setpfTauTagInfoRef(const PFTauTagInfoRef); - - PFRecoTauChargedHadronRef leadTauChargedHadronCandidate() const; - const CandidatePtr& leadChargedHadrCand() const; - const CandidatePtr& leadNeutralCand() const; - //Can be either the charged or the neutral one - const CandidatePtr& leadCand() const; - - void setleadChargedHadrCand(const CandidatePtr&); - void setleadNeutralCand(const CandidatePtr&); - void setleadCand(const CandidatePtr&); - - /// Signed transverse impact parameter significance of the Track - /// associated to the leading charged PFCandidate - float leadPFChargedHadrCandsignedSipt() const; - void setleadPFChargedHadrCandsignedSipt(const float&); - - /// Candidates in signal region - const std::vector& signalCands() const; - void setsignalCands(const std::vector&); - - /// Charged hadrons in signal region - const std::vector& signalChargedHadrCands() const; - void setsignalChargedHadrCands(const std::vector&); - - /// Neutral hadrons in signal region - const std::vector& signalNeutrHadrCands() const; - void setsignalNeutrHadrCands(const std::vector&); - - /// Gamma candidates in signal region - const std::vector& signalGammaCands() const; - void setsignalGammaCands(const std::vector&); - - /// Candidates in isolation region - const std::vector& isolationCands() const; - void setisolationCands(const std::vector&); - - /// Charged candidates in isolation region - const std::vector& isolationChargedHadrCands() const; - void setisolationChargedHadrCands(const std::vector&); - - //// Neutral hadrons in isolation region - const std::vector& isolationNeutrHadrCands() const; - void setisolationNeutrHadrCands(const std::vector&); - - /// Gamma candidates in isolation region - const std::vector& isolationGammaCands() const; - void setisolationGammaCands(const std::vector&); - - /// Getters for different PFCandidates for PFTaus made from PFCandidates - const PFCandidatePtr leadPFChargedHadrCand() const; - const PFCandidatePtr leadPFNeutralCand() const; - const PFCandidatePtr leadPFCand() const; - const std::vector& signalPFCands() const; - const std::vector& signalPFChargedHadrCands() const; - const std::vector& signalPFNeutrHadrCands() const; - const std::vector& signalPFGammaCands() const; - const std::vector& isolationPFCands() const; - const std::vector& isolationPFChargedHadrCands() const; - const std::vector& isolationPFNeutrHadrCands() const; - const std::vector& isolationPFGammaCands() const; - - /// Sum of charged hadron candidate PT in isolation cone; returns NaN - /// if isolation region is undefined. - float isolationPFChargedHadrCandsPtSum() const; - void setisolationPFChargedHadrCandsPtSum(const float&); - - /// Sum of gamma candidate PT in isolation cone; returns NaN - /// if isolation region is undefined. - float isolationPFGammaCandsEtSum() const; - void setisolationPFGammaCandsEtSum(const float&); - - /// Et of the highest Et HCAL PFCluster - float maximumHCALPFClusterEt() const; - void setmaximumHCALPFClusterEt(const float&); - - /// Retrieve the association of signal region gamma candidates into candidate PiZeros - const std::vector& signalPiZeroCandidates() const; - void setsignalPiZeroCandidates(std::vector); - void setSignalPiZeroCandidatesRefs(RecoTauPiZeroRefVector); - - /// Retrieve the association of isolation region gamma candidates into candidate PiZeros - const std::vector& isolationPiZeroCandidates() const; - void setisolationPiZeroCandidates(std::vector); - void setIsolationPiZeroCandidatesRefs(RecoTauPiZeroRefVector); - - /// Retrieve the association of signal region PF candidates into candidate PFRecoTauChargedHadrons - const std::vector& signalTauChargedHadronCandidates() const; - void setSignalTauChargedHadronCandidates(std::vector); - void setSignalTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); - - /// Retrieve the association of isolation region PF candidates into candidate PFRecoTauChargedHadron - const std::vector& isolationTauChargedHadronCandidates() const; - void setIsolationTauChargedHadronCandidates(std::vector); - void setIsolationTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); - - /// Retrieve the identified hadronic decay mode according to the number of - /// charged and piZero candidates in the signal cone - hadronicDecayMode decayMode() const; - void setDecayMode(const hadronicDecayMode&); - - /// Effect of eta and phi correction of strip on mass of tau candidate - float bendCorrMass() const { return bendCorrMass_; } - void setBendCorrMass(float bendCorrMass) { bendCorrMass_ = bendCorrMass; } - - /// Size of signal cone - double signalConeSize() const { return signalConeSize_; } - void setSignalConeSize(double signalConeSize) { signalConeSize_ = signalConeSize; } - - //Electron rejection - float emFraction() const; // Ecal/Hcal Cluster Energy - float hcalTotOverPLead() const; // total Hcal Cluster E / leadPFChargedHadron P - float hcalMaxOverPLead() const; // max. Hcal Cluster E / leadPFChargedHadron P - // Hcal Cluster E in R<0.184 around Ecal impact point of leading track / leadPFChargedHadron P - float hcal3x3OverPLead() const; - float ecalStripSumEOverPLead() const; // Simple BremsRecovery Sum E / leadPFChargedHadron P - float bremsRecoveryEOverPLead() const; // BremsRecovery Sum E / leadPFChargedHadron P - reco::TrackRef electronPreIDTrack() const; // Ref to KF track from Electron PreID - float electronPreIDOutput() const; // BDT output from Electron PreID - bool electronPreIDDecision() const; // Decision from Electron PreID - - void setemFraction(const float&); - void sethcalTotOverPLead(const float&); - void sethcalMaxOverPLead(const float&); - void sethcal3x3OverPLead(const float&); - void setecalStripSumEOverPLead(const float&); - void setbremsRecoveryEOverPLead(const float&); - void setelectronPreIDTrack(const reco::TrackRef&); - void setelectronPreIDOutput(const float&); - void setelectronPreIDDecision(const bool&); - - // For Muon Rejection - bool hasMuonReference() const; // check if muon ref exists - float caloComp() const; - float segComp() const; - bool muonDecision() const; - void setCaloComp(const float&); - void setSegComp(const float&); - void setMuonDecision(const bool&); - - /// return the number of source Candidates - /// ( the candidates used to construct this Candidate) - /// in the case of taus, there is only one source candidate, - /// which is the corresponding PFJet - size_type numberOfSourceCandidatePtrs() const override { return 1; } - - /// return a RefToBase to the source Candidates - /// ( the candidates used to construct this Candidate) - CandidatePtr sourceCandidatePtr(size_type i) const override; - - /// prints information on this PFTau - void dump(std::ostream& out = std::cout) const; - - private: - friend class tau::RecoTauConstructor; - friend class tau::PFRecoTauEnergyAlgorithmPlugin; - - //These are used by the friends - std::vector& signalPiZeroCandidatesRestricted(); - std::vector& isolationPiZeroCandidatesRestricted(); - std::vector& signalTauChargedHadronCandidatesRestricted(); - std::vector& isolationTauChargedHadronCandidatesRestricted(); - - // check overlap with another candidate - bool overlap(const Candidate&) const override; - - bool muonDecision_; - bool electronPreIDDecision_; - - // SIP - float leadPFChargedHadrCandsignedSipt_; - // Isolation variables - float isolationPFChargedHadrCandsPtSum_; - float isolationPFGammaCandsEtSum_; - float maximumHCALPFClusterEt_; - - // Electron rejection variables - float emFraction_; - float hcalTotOverPLead_; - float hcalMaxOverPLead_; - float hcal3x3OverPLead_; - float ecalStripSumEOverPLead_; - float bremsRecoveryEOverPLead_; - float electronPreIDOutput_; - - // Muon rejection variables - float caloComp_; - float segComp_; - - hadronicDecayMode decayMode_; - - float bendCorrMass_; - - float signalConeSize_; - - reco::JetBaseRef jetRef_; - PFTauTagInfoRef PFTauTagInfoRef_; - reco::CandidatePtr leadChargedHadrCand_; - reco::CandidatePtr leadNeutralCand_; - reco::CandidatePtr leadCand_; - reco::TrackRef electronPreIDTrack_; - - // Signal candidates - std::vector selectedSignalCands_; - std::vector selectedSignalChargedHadrCands_; - std::vector selectedSignalNeutrHadrCands_; - std::vector selectedSignalGammaCands_; - - // Isolation candidates - std::vector selectedIsolationCands_; - std::vector selectedIsolationChargedHadrCands_; - std::vector selectedIsolationNeutrHadrCands_; - std::vector selectedIsolationGammaCands_; - - // Transient caches for PFCandidate-based accessors - edm::AtomicPtrCache leadPFChargedHadrCand_; - edm::AtomicPtrCache leadPFNeutralCand_; - edm::AtomicPtrCache leadPFCand_; - - edm::AtomicPtrCache> selectedTransientSignalPFCands_; - edm::AtomicPtrCache> selectedTransientSignalPFChargedHadrCands_; - edm::AtomicPtrCache> selectedTransientSignalPFNeutrHadrCands_; - edm::AtomicPtrCache> selectedTransientSignalPFGammaCands_; - - edm::AtomicPtrCache> selectedTransientIsolationPFCands_; - edm::AtomicPtrCache> selectedTransientIsolationPFChargedHadrCands_; - edm::AtomicPtrCache> selectedTransientIsolationPFNeutrHadrCands_; - edm::AtomicPtrCache> selectedTransientIsolationPFGammaCands_; - - RecoTauPiZeroRefVector signalPiZeroCandidatesRefs_; - RecoTauPiZeroRefVector isolationPiZeroCandidatesRefs_; - - PFRecoTauChargedHadronRefVector signalTauChargedHadronCandidatesRefs_; - PFRecoTauChargedHadronRefVector isolationTauChargedHadronCandidatesRefs_; - - // Association of gamma candidates into PiZeros (transient) - edm::AtomicPtrCache> signalPiZeroCandidates_; - edm::AtomicPtrCache> isolationPiZeroCandidates_; - - // Association of PF candidates into PFRecoTauChargedHadrons (transient) - edm::AtomicPtrCache> signalTauChargedHadronCandidates_; - edm::AtomicPtrCache> isolationTauChargedHadronCandidates_; - }; - - std::ostream& operator<<(std::ostream& out, const PFTau& c); + std::ostream& operator<<(std::ostream& out, const PFTau& c); + } // namespace io_v1 + using PFTau = io_v1::PFTau; } // end namespace reco #endif diff --git a/DataFormats/TauReco/interface/PFTauDiscriminator.h b/DataFormats/TauReco/interface/PFTauDiscriminator.h index 85313b7c2fdbc..5a5b8537952b2 100644 --- a/DataFormats/TauReco/interface/PFTauDiscriminator.h +++ b/DataFormats/TauReco/interface/PFTauDiscriminator.h @@ -9,14 +9,17 @@ namespace reco { typedef edm::AssociationVector > PFTauDiscriminatorBase; - class PFTauDiscriminator : public PFTauDiscriminatorBase { - public: - PFTauDiscriminator() : PFTauDiscriminatorBase() {} + namespace io_v1 { + class PFTauDiscriminator : public PFTauDiscriminatorBase { + public: + PFTauDiscriminator() : PFTauDiscriminatorBase() {} - PFTauDiscriminator(const reco::PFTauRefProd &ref) : PFTauDiscriminatorBase(ref) {} + PFTauDiscriminator(const reco::PFTauRefProd &ref) : PFTauDiscriminatorBase(ref) {} - PFTauDiscriminator(const PFTauDiscriminatorBase &v) : PFTauDiscriminatorBase(v) {} - }; + PFTauDiscriminator(const PFTauDiscriminatorBase &v) : PFTauDiscriminatorBase(v) {} + }; + } // namespace io_v1 + using PFTauDiscriminator = io_v1::PFTauDiscriminator; typedef PFTauDiscriminator::value_type PFTauDiscriminatorVT; typedef edm::Ref PFTauDiscriminatorRef; diff --git a/DataFormats/TauReco/interface/PFTauFwd.h b/DataFormats/TauReco/interface/PFTauFwd.h index 8a03c171bde96..a1133b30127f4 100644 --- a/DataFormats/TauReco/interface/PFTauFwd.h +++ b/DataFormats/TauReco/interface/PFTauFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class PFTau; + namespace io_v1 { + class PFTau; + } + using PFTau = io_v1::PFTau; /// collection of PFTau objects typedef std::vector PFTauCollection; /// presistent reference to a PFTau diff --git a/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h b/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h index e7706a3fb1398..9c30cdcb41fc4 100644 --- a/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h +++ b/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h @@ -21,64 +21,67 @@ #include "TVector3.h" namespace reco { - class PFTauTransverseImpactParameter { - enum { dimension = 3 }; - enum { covarianceSize = dimension * (dimension + 1) / 2 }; + namespace io_v1 { + class PFTauTransverseImpactParameter { + enum { dimension = 3 }; + enum { covarianceSize = dimension * (dimension + 1) / 2 }; - public: - typedef math::Error::type CovMatrix; - typedef math::XYZPoint Point; - typedef math::XYZVector Vector; + public: + typedef math::Error::type CovMatrix; + typedef math::XYZPoint Point; + typedef math::XYZVector Vector; - PFTauTransverseImpactParameter() {} - /// constructor from values - PFTauTransverseImpactParameter(const Point&, double, double, const Point&, double, double, const VertexRef&); - PFTauTransverseImpactParameter(const Point&, - double, - double, - const Point&, - double, - double, - const VertexRef&, - const Point&, - double, - const VertexRef&); + PFTauTransverseImpactParameter() {} + /// constructor from values + PFTauTransverseImpactParameter(const Point&, double, double, const Point&, double, double, const VertexRef&); + PFTauTransverseImpactParameter(const Point&, + double, + double, + const Point&, + double, + double, + const VertexRef&, + const Point&, + double, + const VertexRef&); - virtual ~PFTauTransverseImpactParameter() {} - PFTauTransverseImpactParameter* clone() const; + virtual ~PFTauTransverseImpactParameter() {} + PFTauTransverseImpactParameter* clone() const; - const Point& dxy_PCA() const { return pca_; } - double dxy() const { return dxy_; } - double dxy_error() const { return dxy_error_; } - double dxy_Sig() const { return (dxy_error_ != 0) ? (dxy_ / dxy_error_) : 0.; } - const Point& ip3d_PCA() const { return pca3d_; } - double ip3d() const { return ip3d_; } - double ip3d_error() const { return ip3d_error_; } - double ip3d_Sig() const { return (ip3d_error_ != 0) ? (ip3d_ / ip3d_error_) : 0.; } - const VertexRef& primaryVertex() const { return PV_; } - Point primaryVertexPos() const; - CovMatrix primaryVertexCov() const; - bool hasSecondaryVertex() const { return hasSV_; } - const Vector& flightLength() const; - double flightLengthSig() const; - CovMatrix flightLengthCov() const; - const VertexRef& secondaryVertex() const { return SV_; } - Point secondaryVertexPos() const; - CovMatrix secondaryVertexCov() const; + const Point& dxy_PCA() const { return pca_; } + double dxy() const { return dxy_; } + double dxy_error() const { return dxy_error_; } + double dxy_Sig() const { return (dxy_error_ != 0) ? (dxy_ / dxy_error_) : 0.; } + const Point& ip3d_PCA() const { return pca3d_; } + double ip3d() const { return ip3d_; } + double ip3d_error() const { return ip3d_error_; } + double ip3d_Sig() const { return (ip3d_error_ != 0) ? (ip3d_ / ip3d_error_) : 0.; } + const VertexRef& primaryVertex() const { return PV_; } + Point primaryVertexPos() const; + CovMatrix primaryVertexCov() const; + bool hasSecondaryVertex() const { return hasSV_; } + const Vector& flightLength() const; + double flightLengthSig() const; + CovMatrix flightLengthCov() const; + const VertexRef& secondaryVertex() const { return SV_; } + Point secondaryVertexPos() const; + CovMatrix secondaryVertexCov() const; - private: - Point pca_; - double dxy_{0}; - double dxy_error_{0}; - Point pca3d_; - double ip3d_{0}; - double ip3d_error_{0}; - VertexRef PV_; - bool hasSV_{false}; - Vector FlightLength_; - double FlightLengthSig_{0}; - VertexRef SV_; - }; + private: + Point pca_; + double dxy_{0}; + double dxy_error_{0}; + Point pca3d_; + double ip3d_{0}; + double ip3d_error_{0}; + VertexRef PV_; + bool hasSV_{false}; + Vector FlightLength_; + double FlightLengthSig_{0}; + VertexRef SV_; + }; + } // namespace io_v1 + using PFTauTransverseImpactParameter = io_v1::PFTauTransverseImpactParameter; } // namespace reco #endif diff --git a/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h b/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h index 9d69c49979136..00cc1e7aafed7 100644 --- a/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h +++ b/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class PFTauTransverseImpactParameter; + namespace io_v1 { + class PFTauTransverseImpactParameter; + } + using PFTauTransverseImpactParameter = io_v1::PFTauTransverseImpactParameter; /// collection of PFTauTransverseImpactParameter objects typedef std::vector PFTauTransverseImpactParameterCollection; /// presistent reference to a PFTauTransverseImpactParameter diff --git a/DataFormats/TauReco/interface/RecoTauPiZero.h b/DataFormats/TauReco/interface/RecoTauPiZero.h index 610d147f48cb1..edc9b44b359cc 100644 --- a/DataFormats/TauReco/interface/RecoTauPiZero.h +++ b/DataFormats/TauReco/interface/RecoTauPiZero.h @@ -4,96 +4,99 @@ #include "DataFormats/Candidate/interface/CompositePtrCandidate.h" namespace reco { - class RecoTauPiZero : public CompositePtrCandidate { - public: - enum PiZeroAlgorithm { - // Algorithm where each photon becomes a pi zero - kUndefined = 0, - kTrivial = 1, - kCombinatoric = 2, - kStrips = 3 + namespace io_v1 { + class RecoTauPiZero : public CompositePtrCandidate { + public: + enum PiZeroAlgorithm { + // Algorithm where each photon becomes a pi zero + kUndefined = 0, + kTrivial = 1, + kCombinatoric = 2, + kStrips = 3 + }; + + RecoTauPiZero() : CompositePtrCandidate(), algoName_(kUndefined), bendCorrEta_(0.), bendCorrPhi_(0.) { + this->setPdgId(111); + } + + RecoTauPiZero(PiZeroAlgorithm algoName) + : CompositePtrCandidate(), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { + this->setPdgId(111); + } + + /// constructor from values + RecoTauPiZero(Charge q, + const LorentzVector& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 111, + int status = 0, + bool integerCharge = true, + PiZeroAlgorithm algoName = kUndefined) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), + algoName_(algoName), + bendCorrEta_(0.), + bendCorrPhi_(0.) {} + + /// constructor from values + RecoTauPiZero(Charge q, + const PolarLorentzVector& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 111, + int status = 0, + bool integerCharge = true, + PiZeroAlgorithm algoName = kUndefined) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), + algoName_(algoName), + bendCorrEta_(0.), + bendCorrPhi_(0.) {} + + /// constructor from a Candidate + explicit RecoTauPiZero(const Candidate& p, PiZeroAlgorithm algoName = kUndefined) + : CompositePtrCandidate(p), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { + this->setPdgId(111); + } + + /// destructor + ~RecoTauPiZero() override {} + + /// Number of PFGamma constituents + size_t numberOfGammas() const; + + /// Number of electron constituents + size_t numberOfElectrons() const; + + /// Maximum DeltaPhi between a constituent and the four vector + double maxDeltaPhi() const; + + /// Maxmum DeltaEta between a constituent and the four vector + double maxDeltaEta() const; + + /// Algorithm that built this piZero + PiZeroAlgorithm algo() const; + + /// Check whether a given algo produced this pi zero + bool algoIs(PiZeroAlgorithm algo) const; + + /// Size of correction to account for spread of photon energy in eta and phi + /// in case charged pions make nuclear interactions or photons convert within the tracking detector + float bendCorrEta() const { return bendCorrEta_; } + float bendCorrPhi() const { return bendCorrPhi_; } + void setBendCorrEta(float bendCorrEta) { bendCorrEta_ = bendCorrEta; } + void setBendCorrPhi(float bendCorrPhi) { bendCorrPhi_ = bendCorrPhi; } + + void print(std::ostream& out = std::cout) const; + + private: + PiZeroAlgorithm algoName_; + + float bendCorrEta_; + float bendCorrPhi_; }; - RecoTauPiZero() : CompositePtrCandidate(), algoName_(kUndefined), bendCorrEta_(0.), bendCorrPhi_(0.) { - this->setPdgId(111); - } - - RecoTauPiZero(PiZeroAlgorithm algoName) - : CompositePtrCandidate(), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { - this->setPdgId(111); - } - - /// constructor from values - RecoTauPiZero(Charge q, - const LorentzVector& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 111, - int status = 0, - bool integerCharge = true, - PiZeroAlgorithm algoName = kUndefined) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), - algoName_(algoName), - bendCorrEta_(0.), - bendCorrPhi_(0.) {} - - /// constructor from values - RecoTauPiZero(Charge q, - const PolarLorentzVector& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 111, - int status = 0, - bool integerCharge = true, - PiZeroAlgorithm algoName = kUndefined) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), - algoName_(algoName), - bendCorrEta_(0.), - bendCorrPhi_(0.) {} - - /// constructor from a Candidate - explicit RecoTauPiZero(const Candidate& p, PiZeroAlgorithm algoName = kUndefined) - : CompositePtrCandidate(p), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { - this->setPdgId(111); - } - - /// destructor - ~RecoTauPiZero() override {} - - /// Number of PFGamma constituents - size_t numberOfGammas() const; - - /// Number of electron constituents - size_t numberOfElectrons() const; - - /// Maximum DeltaPhi between a constituent and the four vector - double maxDeltaPhi() const; - - /// Maxmum DeltaEta between a constituent and the four vector - double maxDeltaEta() const; - - /// Algorithm that built this piZero - PiZeroAlgorithm algo() const; - - /// Check whether a given algo produced this pi zero - bool algoIs(PiZeroAlgorithm algo) const; - - /// Size of correction to account for spread of photon energy in eta and phi - /// in case charged pions make nuclear interactions or photons convert within the tracking detector - float bendCorrEta() const { return bendCorrEta_; } - float bendCorrPhi() const { return bendCorrPhi_; } - void setBendCorrEta(float bendCorrEta) { bendCorrEta_ = bendCorrEta; } - void setBendCorrPhi(float bendCorrPhi) { bendCorrPhi_ = bendCorrPhi; } - - void print(std::ostream& out = std::cout) const; - - private: - PiZeroAlgorithm algoName_; - - float bendCorrEta_; - float bendCorrPhi_; - }; - - std::ostream& operator<<(std::ostream& out, const RecoTauPiZero& c); + std::ostream& operator<<(std::ostream& out, const RecoTauPiZero& c); + } // namespace io_v1 + using RecoTauPiZero = io_v1::RecoTauPiZero; } // namespace reco #endif diff --git a/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h b/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h index a5430ab5f154e..df98ff288f05c 100644 --- a/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h +++ b/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class RecoTauPiZero; + namespace io_v1 { + class RecoTauPiZero; + } + using RecoTauPiZero = io_v1::RecoTauPiZero; /// collection of RecoTauPiZero objects typedef std::vector RecoTauPiZeroCollection; /// presistent reference to a RecoTauPiZero diff --git a/DataFormats/TauReco/src/RecoTauPiZero.cc b/DataFormats/TauReco/src/RecoTauPiZero.cc index 995bc7452ccce..b382a270d79fd 100644 --- a/DataFormats/TauReco/src/RecoTauPiZero.cc +++ b/DataFormats/TauReco/src/RecoTauPiZero.cc @@ -3,91 +3,93 @@ #include "DataFormats/Math/interface/deltaPhi.h" namespace reco { + namespace io_v1 { - size_t RecoTauPiZero::numberOfGammas() const { - size_t nGammas = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - if (daughter(i)->pdgId() == 22) - ++nGammas; + size_t RecoTauPiZero::numberOfGammas() const { + size_t nGammas = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + if (daughter(i)->pdgId() == 22) + ++nGammas; + } + return nGammas; } - return nGammas; - } - size_t RecoTauPiZero::numberOfElectrons() const { - size_t nElectrons = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - if (std::abs(daughter(i)->pdgId()) == 11) - ++nElectrons; + size_t RecoTauPiZero::numberOfElectrons() const { + size_t nElectrons = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + if (std::abs(daughter(i)->pdgId()) == 11) + ++nElectrons; + } + return nElectrons; } - return nElectrons; - } - double RecoTauPiZero::maxDeltaPhi() const { - double maxDPhi = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - double dPhi = std::fabs(deltaPhi(*this, *daughter(i))); - if (dPhi > maxDPhi) - maxDPhi = dPhi; + double RecoTauPiZero::maxDeltaPhi() const { + double maxDPhi = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + double dPhi = std::fabs(deltaPhi(*this, *daughter(i))); + if (dPhi > maxDPhi) + maxDPhi = dPhi; + } + return maxDPhi; } - return maxDPhi; - } - double RecoTauPiZero::maxDeltaEta() const { - double maxDEta = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - double dEta = std::fabs(eta() - daughter(i)->eta()); - if (dEta > maxDEta) - maxDEta = dEta; + double RecoTauPiZero::maxDeltaEta() const { + double maxDEta = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + double dEta = std::fabs(eta() - daughter(i)->eta()); + if (dEta > maxDEta) + maxDEta = dEta; + } + return maxDEta; } - return maxDEta; - } - RecoTauPiZero::PiZeroAlgorithm RecoTauPiZero::algo() const { return algoName_; } + RecoTauPiZero::PiZeroAlgorithm RecoTauPiZero::algo() const { return algoName_; } - bool RecoTauPiZero::algoIs(RecoTauPiZero::PiZeroAlgorithm algo) const { return (algoName_ == algo); } + bool RecoTauPiZero::algoIs(RecoTauPiZero::PiZeroAlgorithm algo) const { return (algoName_ == algo); } - namespace { - std::string getPFCandidateType(reco::PFCandidate::ParticleType pfCandidateType) { - if (pfCandidateType == reco::PFCandidate::X) - return "undefined"; - else if (pfCandidateType == reco::PFCandidate::h) - return "PFChargedHadron"; - else if (pfCandidateType == reco::PFCandidate::e) - return "PFElectron"; - else if (pfCandidateType == reco::PFCandidate::mu) - return "PFMuon"; - else if (pfCandidateType == reco::PFCandidate::gamma) - return "PFGamma"; - else if (pfCandidateType == reco::PFCandidate::h0) - return "PFNeutralHadron"; - else if (pfCandidateType == reco::PFCandidate::h_HF) - return "HF_had"; - else if (pfCandidateType == reco::PFCandidate::egamma_HF) - return "HF_em"; - else - assert(0); - } - } // namespace + namespace { + std::string getPFCandidateType(reco::PFCandidate::ParticleType pfCandidateType) { + if (pfCandidateType == reco::PFCandidate::X) + return "undefined"; + else if (pfCandidateType == reco::PFCandidate::h) + return "PFChargedHadron"; + else if (pfCandidateType == reco::PFCandidate::e) + return "PFElectron"; + else if (pfCandidateType == reco::PFCandidate::mu) + return "PFMuon"; + else if (pfCandidateType == reco::PFCandidate::gamma) + return "PFGamma"; + else if (pfCandidateType == reco::PFCandidate::h0) + return "PFNeutralHadron"; + else if (pfCandidateType == reco::PFCandidate::h_HF) + return "HF_had"; + else if (pfCandidateType == reco::PFCandidate::egamma_HF) + return "HF_em"; + else + assert(0); + } + } // namespace - void RecoTauPiZero::print(std::ostream& stream) const { - std::cout << "Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() << std::endl; - size_t numDaughters = this->numberOfDaughters(); - for (size_t iDaughter = 0; iDaughter < numDaughters; ++iDaughter) { - const reco::PFCandidate* daughter = dynamic_cast(this->daughterPtr(iDaughter).get()); - std::cout << " daughter #" << iDaughter << " (" << getPFCandidateType(daughter->particleId()) << "):" - << " Pt = " << daughter->pt() << ", eta = " << daughter->eta() << ", phi = " << daughter->phi() - << std::endl; + void RecoTauPiZero::print(std::ostream& stream) const { + std::cout << "Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() << std::endl; + size_t numDaughters = this->numberOfDaughters(); + for (size_t iDaughter = 0; iDaughter < numDaughters; ++iDaughter) { + const reco::PFCandidate* daughter = dynamic_cast(this->daughterPtr(iDaughter).get()); + std::cout << " daughter #" << iDaughter << " (" << getPFCandidateType(daughter->particleId()) << "):" + << " Pt = " << daughter->pt() << ", eta = " << daughter->eta() << ", phi = " << daughter->phi() + << std::endl; + } } - } - std::ostream& operator<<(std::ostream& out, const reco::RecoTauPiZero& piZero) { - if (!out) + std::ostream& operator<<(std::ostream& out, const reco::RecoTauPiZero& piZero) { + if (!out) + return out; + piZero.print(out); return out; - piZero.print(out); - return out; - } + } + } // namespace io_v1 } // namespace reco diff --git a/DataFormats/TauReco/src/classes_def_1.xml b/DataFormats/TauReco/src/classes_def_1.xml index de40ee279a7e8..78ac10f94428d 100644 --- a/DataFormats/TauReco/src/classes_def_1.xml +++ b/DataFormats/TauReco/src/classes_def_1.xml @@ -19,99 +19,23 @@ - + - - - - - - - - - (cand));]]> - - - - (cand));]]> - - - - (cand));]]> - - - - - - - - - - - - - - - - + - + diff --git a/DataFormats/TauReco/src/classes_def_2.xml b/DataFormats/TauReco/src/classes_def_2.xml index 20a0fbe1d02e1..8a1a6083861fa 100644 --- a/DataFormats/TauReco/src/classes_def_2.xml +++ b/DataFormats/TauReco/src/classes_def_2.xml @@ -1,7 +1,7 @@ - - + + @@ -19,26 +19,28 @@ - - - - - - - + + + + + + + + - + + - - - - + + + + - - - - - - - - - + + - + - + - - - - - - - - - + + + + - - - - - - - - + + + + + + + + - + diff --git a/DataFormats/TauReco/src/classes_def_3.xml b/DataFormats/TauReco/src/classes_def_3.xml index 3edff5b4cc265..054a68fa17b49 100644 --- a/DataFormats/TauReco/src/classes_def_3.xml +++ b/DataFormats/TauReco/src/classes_def_3.xml @@ -3,9 +3,8 @@ - - - + + @@ -23,15 +22,14 @@ - - - + + - + @@ -44,10 +42,8 @@ - - - - + + @@ -55,20 +51,18 @@ - - + + - - + + - - - - + + @@ -93,18 +87,18 @@ - - + + - - - - - - - - + + + + + + + + diff --git a/DataFormats/TauReco/src/classes_def_hlt.xml b/DataFormats/TauReco/src/classes_def_hlt.xml index 9ffc3a3973a82..9f446e4e20dbb 100644 --- a/DataFormats/TauReco/src/classes_def_hlt.xml +++ b/DataFormats/TauReco/src/classes_def_hlt.xml @@ -13,13 +13,13 @@ - - - + + + - - - + + + diff --git a/DataFormats/TrackReco/interface/DeDxData.h b/DataFormats/TrackReco/interface/DeDxData.h index 5d52f352a456c..b366af52e0ecf 100644 --- a/DataFormats/TrackReco/interface/DeDxData.h +++ b/DataFormats/TrackReco/interface/DeDxData.h @@ -4,28 +4,32 @@ #include "DataFormats/Common/interface/ValueMap.h" namespace reco { + namespace io_v1 { - class DeDxData { - public: - DeDxData(); - DeDxData(float val, int nsat, unsigned int num); - DeDxData(float val, float er, int sat, unsigned int num); - virtual ~DeDxData(); - float dEdx() const; - float dEdxError() const; - int numberOfSaturatedMeasurements() const; - unsigned int numberOfMeasurements() const; - - private: - float value_; - float error_; - unsigned int numberOfMeasurements_; - int numberOfSatMeasurements_; - }; + class DeDxData { + public: + DeDxData(); + DeDxData(float val, int nsat, unsigned int num); + DeDxData(float val, float er, int sat, unsigned int num); + virtual ~DeDxData(); + float dEdx() const; + float dEdxError() const; + int numberOfSaturatedMeasurements() const; + unsigned int numberOfMeasurements() const; + + private: + float value_; + float error_; + unsigned int numberOfMeasurements_; + int numberOfSatMeasurements_; + }; + + } // namespace io_v1 + using DeDxData = io_v1::DeDxData; //Association Track -> float estimator - typedef std::vector DeDxDataCollection; - typedef edm::ValueMap DeDxDataValueMap; + typedef std::vector DeDxDataCollection; + typedef edm::ValueMap DeDxDataValueMap; // //Association Track -> float estimator //typedef edm::AssociationVector > DeDxDataCollection; diff --git a/DataFormats/TrackReco/interface/DeDxHitInfo.h b/DataFormats/TrackReco/interface/DeDxHitInfo.h index 43781bf587694..399a6f9acd735 100644 --- a/DataFormats/TrackReco/interface/DeDxHitInfo.h +++ b/DataFormats/TrackReco/interface/DeDxHitInfo.h @@ -11,110 +11,114 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class DeDxHitInfo { - public: - class DeDxHitInfoContainer { + namespace io_v1 { + class DeDxHitInfo { public: - DeDxHitInfoContainer() : charge_(0.0f), pathlength_(0.0f) {} - DeDxHitInfoContainer( - const float charge, const float pathlength, const DetId& detId, const LocalPoint& pos, const uint8_t& type) - : charge_(charge), pathlength_(pathlength), detId_(detId), pos_(pos), type_(type) {} + class DeDxHitInfoContainer { + public: + DeDxHitInfoContainer() : charge_(0.0f), pathlength_(0.0f) {} + DeDxHitInfoContainer( + const float charge, const float pathlength, const DetId& detId, const LocalPoint& pos, const uint8_t& type) + : charge_(charge), pathlength_(pathlength), detId_(detId), pos_(pos), type_(type) {} - float charge() const { return charge_; } - float pathlength() const { return pathlength_; } - const DetId& detId() const { return detId_; } - const LocalPoint& pos() const { return pos_; } - const uint8_t& type() const { return type_; } + float charge() const { return charge_; } + float pathlength() const { return pathlength_; } + const DetId& detId() const { return detId_; } + const LocalPoint& pos() const { return pos_; } + const uint8_t& type() const { return type_; } - private: - //! total cluster charge - float charge_; - //! path length inside a module - float pathlength_; - DetId detId_; - //! hit position - LocalPoint pos_; - uint8_t type_; - }; + private: + //! total cluster charge + float charge_; + //! path length inside a module + float pathlength_; + DetId detId_; + //! hit position + LocalPoint pos_; + uint8_t type_; + }; - static constexpr int Complete = 0, Compatible = 1, Calibration = 2; - typedef std::vector DeDxHitInfoContainerCollection; + static constexpr int Complete = 0, Compatible = 1, Calibration = 2; + typedef std::vector DeDxHitInfoContainerCollection; - public: - DeDxHitInfo() {} - size_t size() const { return infos_.size(); } - float charge(size_t i) const { return infos_[i].charge(); } - float pathlength(size_t i) const { return infos_[i].pathlength(); } - DetId detId(size_t i) const { return infos_[i].detId(); } - const LocalPoint pos(size_t i) const { return infos_[i].pos(); } - const uint8_t type(size_t i) const { return infos_[i].type(); } - const SiPixelCluster* pixelCluster(size_t i) const { - size_t P = 0; - bool isPixel = false; - bool isFirst = true; - for (size_t j = 0; j <= i && j < infos_.size(); j++) { - if (detId(j).subdetId() < SiStripDetId::TIB) { - if (isFirst) - isFirst = false; - else - P++; - isPixel = true; - } else { - isPixel = false; + public: + DeDxHitInfo() {} + size_t size() const { return infos_.size(); } + float charge(size_t i) const { return infos_[i].charge(); } + float pathlength(size_t i) const { return infos_[i].pathlength(); } + DetId detId(size_t i) const { return infos_[i].detId(); } + const LocalPoint pos(size_t i) const { return infos_[i].pos(); } + const uint8_t type(size_t i) const { return infos_[i].type(); } + const SiPixelCluster* pixelCluster(size_t i) const { + size_t P = 0; + bool isPixel = false; + bool isFirst = true; + for (size_t j = 0; j <= i && j < infos_.size(); j++) { + if (detId(j).subdetId() < SiStripDetId::TIB) { + if (isFirst) + isFirst = false; + else + P++; + isPixel = true; + } else { + isPixel = false; + } } + if (isPixel && pixelClusters_.size() > P) { + return &(pixelClusters_[P]); + } + return nullptr; } - if (isPixel && pixelClusters_.size() > P) { - return &(pixelClusters_[P]); - } - return nullptr; - } - const SiStripCluster* stripCluster(size_t i) const { - size_t S = 0; - bool isStrip = false; - bool isFirst = true; - for (size_t j = 0; j <= i && j < infos_.size(); j++) { - if (detId(j).subdetId() >= SiStripDetId::TIB) { - if (isFirst) { - isFirst = false; - } else - S++; - isStrip = true; - } else { - isStrip = false; + const SiStripCluster* stripCluster(size_t i) const { + size_t S = 0; + bool isStrip = false; + bool isFirst = true; + for (size_t j = 0; j <= i && j < infos_.size(); j++) { + if (detId(j).subdetId() >= SiStripDetId::TIB) { + if (isFirst) { + isFirst = false; + } else + S++; + isStrip = true; + } else { + isStrip = false; + } } + if (isStrip && stripClusters_.size() > S) { + return &(stripClusters_[S]); + } + return nullptr; + } + const std::vector& stripClusters() const { return stripClusters_; } + const std::vector& pixelClusters() const { return pixelClusters_; } + + void addHit(const float charge, + const float pathlength, + const DetId& detId, + const LocalPoint& pos, + const uint8_t& type, + const SiStripCluster& stripCluster) { + infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); + stripClusters_.push_back(stripCluster); } - if (isStrip && stripClusters_.size() > S) { - return &(stripClusters_[S]); + void addHit(const float charge, + const float pathlength, + const DetId& detId, + const LocalPoint& pos, + const uint8_t& type, + const SiPixelCluster& pixelCluster) { + infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); + pixelClusters_.push_back(pixelCluster); } - return nullptr; - } - const std::vector& stripClusters() const { return stripClusters_; } - const std::vector& pixelClusters() const { return pixelClusters_; } - void addHit(const float charge, - const float pathlength, - const DetId& detId, - const LocalPoint& pos, - const uint8_t& type, - const SiStripCluster& stripCluster) { - infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); - stripClusters_.push_back(stripCluster); - } - void addHit(const float charge, - const float pathlength, - const DetId& detId, - const LocalPoint& pos, - const uint8_t& type, - const SiPixelCluster& pixelCluster) { - infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); - pixelClusters_.push_back(pixelCluster); - } + private: + std::vector infos_; + std::vector stripClusters_; + std::vector pixelClusters_; + }; - private: - std::vector infos_; - std::vector stripClusters_; - std::vector pixelClusters_; - }; + } // namespace io_v1 + using DeDxHitInfo = io_v1::DeDxHitInfo; typedef std::vector DeDxHitInfoCollection; typedef edm::Ref DeDxHitInfoRef; diff --git a/DataFormats/TrackReco/src/classes_def.xml b/DataFormats/TrackReco/src/classes_def.xml index c8bd7e403f535..986af210ec2ea 100644 --- a/DataFormats/TrackReco/src/classes_def.xml +++ b/DataFormats/TrackReco/src/classes_def.xml @@ -416,9 +416,8 @@ - - - + + @@ -484,23 +483,21 @@ - - - + + - + - - - + + - + diff --git a/DataFormats/V0Candidate/src/classes_def.xml b/DataFormats/V0Candidate/src/classes_def.xml index c43299c0a237e..2f9574ef344fe 100755 --- a/DataFormats/V0Candidate/src/classes_def.xml +++ b/DataFormats/V0Candidate/src/classes_def.xml @@ -1,9 +1,7 @@ - - - - + + diff --git a/DataFormats/VertexReco/interface/Vertex.h b/DataFormats/VertexReco/interface/Vertex.h index 855c922bf8f17..c06d8557452e6 100644 --- a/DataFormats/VertexReco/interface/Vertex.h +++ b/DataFormats/VertexReco/interface/Vertex.h @@ -29,211 +29,214 @@ #include "DataFormats/Math/interface/LorentzVector.h" namespace reco { + namespace io_v1 { - class Vertex { - public: - /// The iteratator for the vector - typedef std::vector::const_iterator trackRef_iterator; - /// point in the space - typedef math::XYZPoint Point; - /// error matrix dimension - constexpr static int dimension = 3; - constexpr static int dimension4D = 4; - /// covariance error matrix (3x3) - typedef math::Error::type Error; - /// covariance error matrix (3x3) - typedef math::Error::type CovarianceMatrix; - /// covariance error matrix (4x4) - typedef math::Error::type Error4D; - /// covariance error matrix (4x4) - typedef math::Error::type CovarianceMatrix4D; - /// matix size - constexpr static int size = dimension * (dimension + 1) / 2, size4D = (dimension4D) * (dimension4D + 1) / 2; - /// index type - typedef unsigned int index; - /// default constructor - The vertex will not be valid. Position, error, - /// chi2, ndof will have random entries, and the vectors of tracks will be empty - /// Use the isValid method to check that your vertex is valid. - Vertex() : chi2_(0.0), ndof_(0), position_(0., 0., 0.), time_(0.) { - validity_ = false; - for (int i = 0; i < size4D; ++i) - covariance_[i] = 0.; - } - /// Constructor for a fake vertex. - Vertex(const Point &, const Error &); - /// Constructor for a fake vertex. 4D - Vertex(const Point &, const Error4D &, double); - /// constructor for a valid vertex, with all data - Vertex(const Point &, const Error &, double chi2, double ndof, size_t size); - /// constructor for a valid vertex, with all data 4D - Vertex(const Point &, const Error4D &, double time, double chi2, double ndof, size_t size); - /// Tells whether the vertex is valid. - bool isValid() const { return validity_; } - /// Tells whether a Vertex is fake, i.e. not a vertex made out of a proper - /// fit with tracks. - /// For a primary vertex, it could simply be the beam line. - bool isFake() const { return (chi2_ == 0 && ndof_ == 0 && tracks_.empty()); } - /// reserve space for the tracks - void reserve(int size, bool refitAsWell = false) { - tracks_.reserve(size); - if (refitAsWell) - refittedTracks_.reserve(size); - weights_.reserve(size); - } - /// add a reference to a Track - template - void add(Ref const &r, float w = 1.0) { - tracks_.emplace_back(r); - weights_.emplace_back(w * 255.f); - } - /// add the original a Track(reference) and the smoothed Track - void add(const TrackBaseRef &r, const Track &refTrack, float w = 1.0); - void removeTracks(); - - ///returns the weight with which a Track has contributed to the vertex-fit. - template - float trackWeight(const TREF &r) const { - int i = 0; - for (auto const &t : tracks_) { - if ((r.id() == t.id()) && (t.key() == r.key())) - return weights_[i] / 255.f; - ++i; + class Vertex { + public: + /// The iteratator for the vector + typedef std::vector::const_iterator trackRef_iterator; + /// point in the space + typedef math::XYZPoint Point; + /// error matrix dimension + constexpr static int dimension = 3; + constexpr static int dimension4D = 4; + /// covariance error matrix (3x3) + typedef math::Error::type Error; + /// covariance error matrix (3x3) + typedef math::Error::type CovarianceMatrix; + /// covariance error matrix (4x4) + typedef math::Error::type Error4D; + /// covariance error matrix (4x4) + typedef math::Error::type CovarianceMatrix4D; + /// matix size + constexpr static int size = dimension * (dimension + 1) / 2, size4D = (dimension4D) * (dimension4D + 1) / 2; + /// index type + typedef unsigned int index; + /// default constructor - The vertex will not be valid. Position, error, + /// chi2, ndof will have random entries, and the vectors of tracks will be empty + /// Use the isValid method to check that your vertex is valid. + Vertex() : chi2_(0.0), ndof_(0), position_(0., 0., 0.), time_(0.) { + validity_ = false; + for (int i = 0; i < size4D; ++i) + covariance_[i] = 0.; + } + /// Constructor for a fake vertex. + Vertex(const Point &, const Error &); + /// Constructor for a fake vertex. 4D + Vertex(const Point &, const Error4D &, double); + /// constructor for a valid vertex, with all data + Vertex(const Point &, const Error &, double chi2, double ndof, size_t size); + /// constructor for a valid vertex, with all data 4D + Vertex(const Point &, const Error4D &, double time, double chi2, double ndof, size_t size); + /// Tells whether the vertex is valid. + bool isValid() const { return validity_; } + /// Tells whether a Vertex is fake, i.e. not a vertex made out of a proper + /// fit with tracks. + /// For a primary vertex, it could simply be the beam line. + bool isFake() const { return (chi2_ == 0 && ndof_ == 0 && tracks_.empty()); } + /// reserve space for the tracks + void reserve(int size, bool refitAsWell = false) { + tracks_.reserve(size); + if (refitAsWell) + refittedTracks_.reserve(size); + weights_.reserve(size); + } + /// add a reference to a Track + template + void add(Ref const &r, float w = 1.0) { + tracks_.emplace_back(r); + weights_.emplace_back(w * 255.f); } - return 0; - } - // track collections - auto const &tracks() const { return tracks_; } - /// first iterator over tracks - trackRef_iterator tracks_begin() const { return tracks_.begin(); } - /// last iterator over tracks - trackRef_iterator tracks_end() const { return tracks_.end(); } - /// number of tracks - size_t tracksSize() const { return tracks_.size(); } - /// python friendly track getting - const TrackBaseRef &trackRefAt(size_t idx) const { return tracks_[idx]; } - /// chi-squares - double chi2() const { return chi2_; } - /** Number of degrees of freedom + /// add the original a Track(reference) and the smoothed Track + void add(const TrackBaseRef &r, const Track &refTrack, float w = 1.0); + void removeTracks(); + + ///returns the weight with which a Track has contributed to the vertex-fit. + template + float trackWeight(const TREF &r) const { + int i = 0; + for (auto const &t : tracks_) { + if ((r.id() == t.id()) && (t.key() == r.key())) + return weights_[i] / 255.f; + ++i; + } + return 0; + } + // track collections + auto const &tracks() const { return tracks_; } + /// first iterator over tracks + trackRef_iterator tracks_begin() const { return tracks_.begin(); } + /// last iterator over tracks + trackRef_iterator tracks_end() const { return tracks_.end(); } + /// number of tracks + size_t tracksSize() const { return tracks_.size(); } + /// python friendly track getting + const TrackBaseRef &trackRefAt(size_t idx) const { return tracks_[idx]; } + /// chi-squares + double chi2() const { return chi2_; } + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - double ndof() const { return ndof_; } - /// chi-squared divided by n.d.o.f. - double normalizedChi2() const { return ndof_ != 0 ? chi2_ / ndof_ : chi2_ * 1e6; } - /// position - const Point &position() const { return position_; } - /// x coordinate - double x() const { return position_.X(); } - /// y coordinate - double y() const { return position_.Y(); } - /// z coordinate - double z() const { return position_.Z(); } - /// t coordinate - double t() const { return time_; } - /// error on x - double xError() const { return sqrt(covariance(0, 0)); } - /// error on y - double yError() const { return sqrt(covariance(1, 1)); } - /// error on z - double zError() const { return sqrt(covariance(2, 2)); } - /// error on t - double tError() const { return sqrt(covariance(3, 3)); } - /// (i, j)-th element of error matrix, i, j = 0, ... 2 - // Note that: - // double error( int i, int j ) const - // is OBSOLETE, use covariance(i, j) - double covariance(int i, int j) const { return covariance_[idx(i, j)]; } - /// return SMatrix - CovarianceMatrix covariance() const { - Error m; - fill(m); - return m; - } - /// return SMatrix 4D - CovarianceMatrix4D covariance4D() const { - Error4D m; - fill(m); - return m; - } - - /// return SMatrix - Error error() const { - Error m; - fill(m); - return m; - } - /// return SMatrix - Error4D error4D() const { - Error4D m; - fill(m); - return m; - } - - /// fill SMatrix - void fill(CovarianceMatrix &v) const; - /// 4D version - void fill(CovarianceMatrix4D &v) const; - - /// Checks whether refitted tracks are stored. - bool hasRefittedTracks() const { return !refittedTracks_.empty(); } - - /// Returns the original track which corresponds to a particular refitted Track - /// Throws an exception if now refitted tracks are stored ot the track is not found in the list - TrackBaseRef originalTrack(const Track &refTrack) const; - - /// Returns the refitted track which corresponds to a particular original Track - /// Throws an exception if now refitted tracks are stored ot the track is not found in the list - Track refittedTrack(const TrackBaseRef &track) const; - - /// Returns the refitted track which corresponds to a particular original Track - /// Throws an exception if now refitted tracks are stored ot the track is not found in the list - Track refittedTrack(const TrackRef &track) const; - - /// Returns the container of refitted tracks - const std::vector &refittedTracks() const { return refittedTracks_; } - - /// Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products - math::XYZTLorentzVectorD p4(float mass = 0.13957018, float minWeight = 0.5) const; - - /// Returns the number of tracks in the vertex with weight above minWeight - unsigned int nTracks(float minWeight = 0.5) const; - - class TrackEqual { - public: - TrackEqual(const Track &t) : track_(t) {} - bool operator()(const Track &t) const { return t.pt() == track_.pt(); } + double ndof() const { return ndof_; } + /// chi-squared divided by n.d.o.f. + double normalizedChi2() const { return ndof_ != 0 ? chi2_ / ndof_ : chi2_ * 1e6; } + /// position + const Point &position() const { return position_; } + /// x coordinate + double x() const { return position_.X(); } + /// y coordinate + double y() const { return position_.Y(); } + /// z coordinate + double z() const { return position_.Z(); } + /// t coordinate + double t() const { return time_; } + /// error on x + double xError() const { return sqrt(covariance(0, 0)); } + /// error on y + double yError() const { return sqrt(covariance(1, 1)); } + /// error on z + double zError() const { return sqrt(covariance(2, 2)); } + /// error on t + double tError() const { return sqrt(covariance(3, 3)); } + /// (i, j)-th element of error matrix, i, j = 0, ... 2 + // Note that: + // double error( int i, int j ) const + // is OBSOLETE, use covariance(i, j) + double covariance(int i, int j) const { return covariance_[idx(i, j)]; } + /// return SMatrix + CovarianceMatrix covariance() const { + Error m; + fill(m); + return m; + } + /// return SMatrix 4D + CovarianceMatrix4D covariance4D() const { + Error4D m; + fill(m); + return m; + } + + /// return SMatrix + Error error() const { + Error m; + fill(m); + return m; + } + /// return SMatrix + Error4D error4D() const { + Error4D m; + fill(m); + return m; + } + + /// fill SMatrix + void fill(CovarianceMatrix &v) const; + /// 4D version + void fill(CovarianceMatrix4D &v) const; + + /// Checks whether refitted tracks are stored. + bool hasRefittedTracks() const { return !refittedTracks_.empty(); } + + /// Returns the original track which corresponds to a particular refitted Track + /// Throws an exception if now refitted tracks are stored ot the track is not found in the list + TrackBaseRef originalTrack(const Track &refTrack) const; + + /// Returns the refitted track which corresponds to a particular original Track + /// Throws an exception if now refitted tracks are stored ot the track is not found in the list + Track refittedTrack(const TrackBaseRef &track) const; + + /// Returns the refitted track which corresponds to a particular original Track + /// Throws an exception if now refitted tracks are stored ot the track is not found in the list + Track refittedTrack(const TrackRef &track) const; + + /// Returns the container of refitted tracks + const std::vector &refittedTracks() const { return refittedTracks_; } + + /// Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products + math::XYZTLorentzVectorD p4(float mass = 0.13957018, float minWeight = 0.5) const; + + /// Returns the number of tracks in the vertex with weight above minWeight + unsigned int nTracks(float minWeight = 0.5) const; + + class TrackEqual { + public: + TrackEqual(const Track &t) : track_(t) {} + bool operator()(const Track &t) const { return t.pt() == track_.pt(); } + + private: + const Track &track_; + }; private: - const Track &track_; + /// chi-sqared + float chi2_; + /// number of degrees of freedom + float ndof_; + /// position + Point position_; + /// covariance matrix (4x4) as vector + float covariance_[size4D]; + /// reference to tracks + std::vector tracks_; + /// The vector of refitted tracks + std::vector refittedTracks_; + std::vector weights_; + /// tells wether the vertex is really valid. + bool validity_; + double time_; + + /// position index + index idx(index i, index j) const { + int a = (i <= j ? i : j), b = (i <= j ? j : i); + return b * (b + 1) / 2 + a; + } }; - private: - /// chi-sqared - float chi2_; - /// number of degrees of freedom - float ndof_; - /// position - Point position_; - /// covariance matrix (4x4) as vector - float covariance_[size4D]; - /// reference to tracks - std::vector tracks_; - /// The vector of refitted tracks - std::vector refittedTracks_; - std::vector weights_; - /// tells wether the vertex is really valid. - bool validity_; - double time_; - - /// position index - index idx(index i, index j) const { - int a = (i <= j ? i : j), b = (i <= j ? j : i); - return b * (b + 1) / 2 + a; - } - }; - + } // namespace io_v1 + using Vertex = io_v1::Vertex; } // namespace reco #endif diff --git a/DataFormats/VertexReco/interface/VertexFwd.h b/DataFormats/VertexReco/interface/VertexFwd.h index 54788a52259d7..cccbb860a3741 100644 --- a/DataFormats/VertexReco/interface/VertexFwd.h +++ b/DataFormats/VertexReco/interface/VertexFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Vertex; + namespace io_v1 { + class Vertex; + } + using Vertex = io_v1::Vertex; /// collection of Vertex objects typedef std::vector VertexCollection; /// persistent reference to a Vertex diff --git a/DataFormats/VertexReco/src/classes_def.xml b/DataFormats/VertexReco/src/classes_def.xml index a54459aa875fa..c8f8f15b7bd22 100755 --- a/DataFormats/VertexReco/src/classes_def.xml +++ b/DataFormats/VertexReco/src/classes_def.xml @@ -1,15 +1,15 @@ - - + + - - - - - + + + + + - - + + @@ -17,35 +17,35 @@ - - - - + + + + - - - - + + + + - + - - - - + + + + - + - - - - + + + + diff --git a/PhysicsTools/SelectorUtils/src/classes_def.xml b/PhysicsTools/SelectorUtils/src/classes_def.xml index 4e09d1b58d9cf..90e617ad891c6 100644 --- a/PhysicsTools/SelectorUtils/src/classes_def.xml +++ b/PhysicsTools/SelectorUtils/src/classes_def.xml @@ -9,9 +9,9 @@ - + - - + + diff --git a/SimDataFormats/Associations/src/classes_def.xml b/SimDataFormats/Associations/src/classes_def.xml index f61f51cbd2a2b..0879ec09c1856 100644 --- a/SimDataFormats/Associations/src/classes_def.xml +++ b/SimDataFormats/Associations/src/classes_def.xml @@ -58,11 +58,11 @@ - + - - + + @@ -77,8 +77,8 @@ - - + + @@ -119,8 +119,8 @@ - - + + @@ -155,8 +155,8 @@ - - + + @@ -168,40 +168,39 @@ - - - - - + + + + @@ -222,8 +221,8 @@ - - + + @@ -247,8 +246,8 @@ - - + + diff --git a/SimDataFormats/CaloAnalysis/src/classes_def.xml b/SimDataFormats/CaloAnalysis/src/classes_def.xml index cacc6d06c949f..5f6b9149ad5a3 100644 --- a/SimDataFormats/CaloAnalysis/src/classes_def.xml +++ b/SimDataFormats/CaloAnalysis/src/classes_def.xml @@ -1,7 +1,6 @@ - - - + + @@ -18,12 +17,8 @@ - - - - - - + + @@ -34,11 +29,8 @@ - - - - - + + diff --git a/SimDataFormats/HiGenData/src/classes_def.xml b/SimDataFormats/HiGenData/src/classes_def.xml index beef47a3a7fd6..c56f4cd631f7e 100644 --- a/SimDataFormats/HiGenData/src/classes_def.xml +++ b/SimDataFormats/HiGenData/src/classes_def.xml @@ -1,6 +1,6 @@ - - + + diff --git a/SimDataFormats/TrackingAnalysis/src/classes_def.xml b/SimDataFormats/TrackingAnalysis/src/classes_def.xml index fb7b75f3d385c..a893c9cd86636 100644 --- a/SimDataFormats/TrackingAnalysis/src/classes_def.xml +++ b/SimDataFormats/TrackingAnalysis/src/classes_def.xml @@ -10,9 +10,8 @@ - - - + + diff --git a/TrackingTools/GsfTracking/src/classes_def.xml b/TrackingTools/GsfTracking/src/classes_def.xml index 078aed289fa69..fd263496b674a 100644 --- a/TrackingTools/GsfTracking/src/classes_def.xml +++ b/TrackingTools/GsfTracking/src/classes_def.xml @@ -1,5 +1,5 @@ - + @@ -8,16 +8,16 @@ - + - - - + + + - +