diff --git a/DataFormats/HGCalReco/interface/Trackster.h b/DataFormats/HGCalReco/interface/Trackster.h index 79ab555f078ca..3b7f0d97ad2c6 100644 --- a/DataFormats/HGCalReco/interface/Trackster.h +++ b/DataFormats/HGCalReco/interface/Trackster.h @@ -18,271 +18,274 @@ // layer clusters together in a 3D object. namespace ticl { - class Trackster { - public: - typedef math::XYZVectorF Vector; + namespace io_v1 { + class Trackster { + public: + typedef math::XYZVectorF Vector; - enum IterationIndex { TRKEM = 0, EM, TRKHAD, HAD, MIP, SIM, SIM_CP }; + enum IterationIndex { TRKEM = 0, EM, TRKHAD, HAD, MIP, SIM, SIM_CP }; - // types considered by the particle identification - enum class ParticleType { - photon = 0, - electron, - muon, - neutral_pion, - charged_hadron, - neutral_hadron, - ambiguous, - unknown, - }; - - enum class PCAOrdering { ascending = 0, descending }; - - Trackster() - : barycenter_({0.f, 0.f, 0.f}), - regressed_energy_(0.f), - raw_energy_(0.f), - boundTime_(0.f), - time_(0.f), - timeError_(-1.f), - id_probabilities_{}, - raw_pt_(0.f), - raw_em_pt_(0.f), - raw_em_energy_(0.f), - seedIndex_(-1), - eigenvalues_{}, - sigmas_{}, - sigmasPCA_{}, - iterationIndex_(0) {} + // types considered by the particle identification + enum class ParticleType { + photon = 0, + electron, + muon, + neutral_pion, + charged_hadron, + neutral_hadron, + ambiguous, + unknown, + }; - inline void setIteration(const Trackster::IterationIndex i) { iterationIndex_ = i; } - std::vector &vertices() { return vertices_; } - std::vector &vertex_multiplicity() { return vertex_multiplicity_; } - std::vector > &edges() { return edges_; } - inline void setSeed(edm::ProductID pid, int index) { - seedID_ = pid; - seedIndex_ = index; - } - inline void setTimeAndError(float t, float tError) { - time_ = t; - timeError_ = tError; - } - inline void setRegressedEnergy(float value) { regressed_energy_ = value; } - inline void setRawEnergy(float value) { raw_energy_ = value; } - inline void addToRawEnergy(float value) { raw_energy_ += value; } - inline void setRawEmEnergy(float value) { raw_em_energy_ = value; } - inline void addToRawEmEnergy(float value) { raw_em_energy_ += value; } - inline void setRawPt(float value) { raw_pt_ = value; } - inline void calculateRawPt() { raw_pt_ = raw_energy_ / std::cosh(barycenter_.eta()); } - inline void setRawEmPt(float value) { raw_em_pt_ = value; } - inline void calculateRawEmPt() { raw_em_pt_ = raw_em_energy_ / std::cosh(barycenter_.eta()); } - inline void setBarycenter(Vector value) { barycenter_ = value; } - inline void addTrackIdx(int index) { track_idxs_.push_back(index); } - int trackIdx(int index = 0) const { return track_idxs_.empty() ? -1 : track_idxs_[index]; } - inline bool isHadronic(float th = 0.5f) const { - return id_probability(Trackster::ParticleType::photon) + id_probability(Trackster::ParticleType::electron) < th; - } + enum class PCAOrdering { ascending = 0, descending }; - inline void mergeTracksters(const Trackster &other) { - *this += other; + Trackster() + : barycenter_({0.f, 0.f, 0.f}), + regressed_energy_(0.f), + raw_energy_(0.f), + boundTime_(0.f), + time_(0.f), + timeError_(-1.f), + id_probabilities_{}, + raw_pt_(0.f), + raw_em_pt_(0.f), + raw_em_energy_(0.f), + seedIndex_(-1), + eigenvalues_{}, + sigmas_{}, + sigmasPCA_{}, + iterationIndex_(0) {} - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } + inline void setIteration(const Trackster::IterationIndex i) { iterationIndex_ = i; } + std::vector &vertices() { return vertices_; } + std::vector &vertex_multiplicity() { return vertex_multiplicity_; } + std::vector > &edges() { return edges_; } + inline void setSeed(edm::ProductID pid, int index) { + seedID_ = pid; + seedIndex_ = index; + } + inline void setTimeAndError(float t, float tError) { + time_ = t; + timeError_ = tError; + } + inline void setRegressedEnergy(float value) { regressed_energy_ = value; } + inline void setRawEnergy(float value) { raw_energy_ = value; } + inline void addToRawEnergy(float value) { raw_energy_ += value; } + inline void setRawEmEnergy(float value) { raw_em_energy_ = value; } + inline void addToRawEmEnergy(float value) { raw_em_energy_ += value; } + inline void setRawPt(float value) { raw_pt_ = value; } + inline void calculateRawPt() { raw_pt_ = raw_energy_ / std::cosh(barycenter_.eta()); } + inline void setRawEmPt(float value) { raw_em_pt_ = value; } + inline void calculateRawEmPt() { raw_em_pt_ = raw_em_energy_ / std::cosh(barycenter_.eta()); } + inline void setBarycenter(Vector value) { barycenter_ = value; } + inline void addTrackIdx(int index) { track_idxs_.push_back(index); } + int trackIdx(int index = 0) const { return track_idxs_.empty() ? -1 : track_idxs_[index]; } + inline bool isHadronic(float th = 0.5f) const { + return id_probability(Trackster::ParticleType::photon) + id_probability(Trackster::ParticleType::electron) < th; + } - inline void mergeTracksters(const std::vector &others) { - for (auto &other : others) { + inline void mergeTracksters(const Trackster &other) { *this += other; + + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); } - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } - template - inline void mergeTracksters(const std::vector &allTracksters, const std::vector &others) { - for (auto &other : others) { - *this += allTracksters[other]; + inline void mergeTracksters(const std::vector &others) { + for (auto &other : others) { + *this += other; + } + + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); } + template + inline void mergeTracksters(const std::vector &allTracksters, const std::vector &others) { + for (auto &other : others) { + *this += allTracksters[other]; + } - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } - template - inline void mergeTracksters(const edm::MultiSpan &allTracksters, const std::vector &others) { - for (auto &other : others) { - *this += allTracksters[other]; + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); } + template + inline void mergeTracksters(const edm::MultiSpan &allTracksters, const std::vector &others) { + for (auto &other : others) { + *this += allTracksters[other]; + } - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); + } - inline void fillPCAVariables(Eigen::Vector3f const &eigenvalues, - Eigen::Matrix3f const &eigenvectors, - Eigen::Vector3f const &sigmas, - Eigen::Vector3f const &sigmasEigen, - size_t pcadimension, - PCAOrdering order) { - int original_index = 0; - for (size_t i = 0; i < pcadimension; ++i) { - sigmas_[i] = std::sqrt(sigmas[i]); - // Reverse the order, since Eigen gives back the eigevalues in - // **increasing order** while we store them in **descreasing order**. - original_index = i; + inline void fillPCAVariables(Eigen::Vector3f const &eigenvalues, + Eigen::Matrix3f const &eigenvectors, + Eigen::Vector3f const &sigmas, + Eigen::Vector3f const &sigmasEigen, + size_t pcadimension, + PCAOrdering order) { + int original_index = 0; + for (size_t i = 0; i < pcadimension; ++i) { + sigmas_[i] = std::sqrt(sigmas[i]); + // Reverse the order, since Eigen gives back the eigevalues in + // **increasing order** while we store them in **descreasing order**. + original_index = i; + if (order == PCAOrdering::ascending) + original_index = pcadimension - i - 1; + eigenvalues_[i] = (float)eigenvalues[original_index]; + eigenvectors_[i] = ticl::io_v1::Trackster::Vector( + eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); + sigmasPCA_[i] = std::sqrt(sigmasEigen[original_index]); + } + original_index = 0; if (order == PCAOrdering::ascending) - original_index = pcadimension - i - 1; - eigenvalues_[i] = (float)eigenvalues[original_index]; - eigenvectors_[i] = ticl::Trackster::Vector( - eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); - sigmasPCA_[i] = std::sqrt(sigmasEigen[original_index]); - } - original_index = 0; - if (order == PCAOrdering::ascending) - original_index = pcadimension - 1; - if (eigenvectors_[0].z() * barycenter_.z() < 0.0) { - eigenvectors_[0] = -ticl::Trackster::Vector( - eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); - } + original_index = pcadimension - 1; + if (eigenvectors_[0].z() * barycenter_.z() < 0.0) { + eigenvectors_[0] = -ticl::io_v1::Trackster::Vector( + eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); + } - // Now also update the pt part of the Trackster, using the PCA as direction - // raw_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_energy_).perp2()); - // raw_em_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_em_energy_).perp2()); - } - void zeroProbabilities() { - for (auto &p : id_probabilities_) { - p = 0.f; + // Now also update the pt part of the Trackster, using the PCA as direction + // raw_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_energy_).perp2()); + // raw_em_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_em_energy_).perp2()); } - } - inline void setProbabilities(float *probs) { - for (float &p : id_probabilities_) { - p = *(probs++); + void zeroProbabilities() { + for (auto &p : id_probabilities_) { + p = 0.f; + } } - } - inline void setIdProbability(ParticleType type, float value) { id_probabilities_[int(type)] = value; } + inline void setProbabilities(float *probs) { + for (float &p : id_probabilities_) { + p = *(probs++); + } + } + inline void setIdProbability(ParticleType type, float value) { id_probabilities_[int(type)] = value; } - inline void setBoundaryTime(float t) { boundTime_ = t; }; + inline void setBoundaryTime(float t) { boundTime_ = t; }; - inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; } - inline const std::vector &vertices() const { return vertices_; } - inline const unsigned int vertices(int index) const { return vertices_[index]; } - inline const std::vector &vertex_multiplicity() const { return vertex_multiplicity_; } - inline const float vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } - inline const std::vector > &edges() const { return edges_; } - inline const edm::ProductID &seedID() const { return seedID_; } - inline const int seedIndex() const { return seedIndex_; } - inline const float time() const { return time_; } - inline const float timeError() const { return timeError_; } - inline const float regressed_energy() const { return regressed_energy_; } - inline const float raw_energy() const { return raw_energy_; } - inline const float raw_em_energy() const { return raw_em_energy_; } - inline const float raw_pt() const { return raw_pt_; } - inline const float raw_em_pt() const { return raw_em_pt_; } - inline const float boundaryTime() const { return boundTime_; }; - inline const Vector &barycenter() const { return barycenter_; } - inline const std::array &eigenvalues() const { return eigenvalues_; } - inline const std::array &eigenvectors() const { return eigenvectors_; } - inline const Vector &eigenvectors(int index) const { return eigenvectors_[index]; } - inline const std::array &sigmas() const { return sigmas_; } - inline const std::array &sigmasPCA() const { return sigmasPCA_; } - inline const std::array &id_probabilities() const { return id_probabilities_; } - inline const float id_probabilities(int index) const { return id_probabilities_[index]; } - inline const std::vector &trackIdxs() const { return track_idxs_; } + inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; } + inline const std::vector &vertices() const { return vertices_; } + inline const unsigned int vertices(int index) const { return vertices_[index]; } + inline const std::vector &vertex_multiplicity() const { return vertex_multiplicity_; } + inline const float vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } + inline const std::vector > &edges() const { return edges_; } + inline const edm::ProductID &seedID() const { return seedID_; } + inline const int seedIndex() const { return seedIndex_; } + inline const float time() const { return time_; } + inline const float timeError() const { return timeError_; } + inline const float regressed_energy() const { return regressed_energy_; } + inline const float raw_energy() const { return raw_energy_; } + inline const float raw_em_energy() const { return raw_em_energy_; } + inline const float raw_pt() const { return raw_pt_; } + inline const float raw_em_pt() const { return raw_em_pt_; } + inline const float boundaryTime() const { return boundTime_; }; + inline const Vector &barycenter() const { return barycenter_; } + inline const std::array &eigenvalues() const { return eigenvalues_; } + inline const std::array &eigenvectors() const { return eigenvectors_; } + inline const Vector &eigenvectors(int index) const { return eigenvectors_[index]; } + inline const std::array &sigmas() const { return sigmas_; } + inline const std::array &sigmasPCA() const { return sigmasPCA_; } + inline const std::array &id_probabilities() const { return id_probabilities_; } + inline const float id_probabilities(int index) const { return id_probabilities_[index]; } + inline const std::vector &trackIdxs() const { return track_idxs_; } - // convenience method to return the ID probability for a certain particle type - inline float id_probability(ParticleType type) const { - // probabilities are stored in the same order as defined in the ParticleType enum - return id_probabilities_[(int)type]; - } + // convenience method to return the ID probability for a certain particle type + inline float id_probability(ParticleType type) const { + // probabilities are stored in the same order as defined in the ParticleType enum + return id_probabilities_[(int)type]; + } - private: - Vector barycenter_; - float regressed_energy_ = 0.f; - float raw_energy_ = 0.f; - // -99, -1 if not available. ns units otherwise - float boundTime_; - float time_; - float timeError_; + private: + Vector barycenter_; + float regressed_energy_ = 0.f; + float raw_energy_ = 0.f; + // -99, -1 if not available. ns units otherwise + float boundTime_; + float time_; + float timeError_; - // trackster ID probabilities - std::array id_probabilities_; + // trackster ID probabilities + std::array id_probabilities_; - // The vertices of the DAG are the indices of the - // 2d objects in the global collection - std::vector vertices_; - std::vector vertex_multiplicity_; - float raw_pt_ = 0.f; - float raw_em_pt_ = 0.f; - float raw_em_energy_ = 0.f; + // The vertices of the DAG are the indices of the + // 2d objects in the global collection + std::vector vertices_; + std::vector vertex_multiplicity_; + float raw_pt_ = 0.f; + float raw_em_pt_ = 0.f; + float raw_em_energy_ = 0.f; - // Product ID of the seeding collection used to create the Trackster. - // For GlobalSeeding the ProductID is set to 0. For track-based seeding - // this is the ProductID of the track-collection used to create the - // seeding-regions. - edm::ProductID seedID_; + // Product ID of the seeding collection used to create the Trackster. + // For GlobalSeeding the ProductID is set to 0. For track-based seeding + // this is the ProductID of the track-collection used to create the + // seeding-regions. + edm::ProductID seedID_; - // For Global Seeding the index is fixed to one. For track-based seeding, - // the index is the index of the track originating the seeding region that - // created the trackster. For track-based seeding the pointer to the track - // can be cooked using the previous ProductID and this index. - int seedIndex_; - std::vector track_idxs_; + // For Global Seeding the index is fixed to one. For track-based seeding, + // the index is the index of the track originating the seeding region that + // created the trackster. For track-based seeding the pointer to the track + // can be cooked using the previous ProductID and this index. + int seedIndex_; + std::vector track_idxs_; - std::array eigenvectors_; - std::array eigenvalues_; - std::array sigmas_; - std::array sigmasPCA_; + std::array eigenvectors_; + std::array eigenvalues_; + std::array sigmas_; + std::array sigmasPCA_; - // The edges connect two vertices together in a directed doublet - // ATTENTION: order matters! - // A doublet generator should create edges in which: - // the first element is on the inner layer and - // the outer element is on the outer layer. - std::vector > edges_; + // The edges connect two vertices together in a directed doublet + // ATTENTION: order matters! + // A doublet generator should create edges in which: + // the first element is on the inner layer and + // the outer element is on the outer layer. + std::vector > edges_; - // TICL iteration producing the trackster - uint8_t iterationIndex_; - inline void removeDuplicates() { - auto vtx_sorted{vertices_}; - std::sort(std::begin(vtx_sorted), std::end(vtx_sorted)); - for (unsigned int iLC = 1; iLC < vtx_sorted.size(); ++iLC) { - if (vtx_sorted[iLC] == vtx_sorted[iLC - 1]) { - // Clean up duplicate LCs - const auto lcIdx = vtx_sorted[iLC]; - const auto firstEl = std::find(vertices_.begin(), vertices_.end(), lcIdx); - const auto firstPos = std::distance(std::begin(vertices_), firstEl); - auto iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); - while (iDup != vertices_.end()) { - vertex_multiplicity_.erase(vertex_multiplicity_.begin() + std::distance(std::begin(vertices_), iDup)); - vertices_.erase(iDup); - vertex_multiplicity_[firstPos] -= 1; - iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); - }; + // TICL iteration producing the trackster + uint8_t iterationIndex_; + inline void removeDuplicates() { + auto vtx_sorted{vertices_}; + std::sort(std::begin(vtx_sorted), std::end(vtx_sorted)); + for (unsigned int iLC = 1; iLC < vtx_sorted.size(); ++iLC) { + if (vtx_sorted[iLC] == vtx_sorted[iLC - 1]) { + // Clean up duplicate LCs + const auto lcIdx = vtx_sorted[iLC]; + const auto firstEl = std::find(vertices_.begin(), vertices_.end(), lcIdx); + const auto firstPos = std::distance(std::begin(vertices_), firstEl); + auto iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); + while (iDup != vertices_.end()) { + vertex_multiplicity_.erase(vertex_multiplicity_.begin() + std::distance(std::begin(vertices_), iDup)); + vertices_.erase(iDup); + vertex_multiplicity_[firstPos] -= 1; + iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); + }; + } } } - } - inline void operator+=(const Trackster &other) { - // use getters on other - raw_energy_ += other.raw_energy(); - raw_em_energy_ += other.raw_em_energy(); - // add vertices and multiplicities - std::copy(std::begin(other.vertices()), std::end(other.vertices()), std::back_inserter(vertices_)); - std::copy(std::begin(other.vertex_multiplicity()), - std::end(other.vertex_multiplicity()), - std::back_inserter(vertex_multiplicity_)); - } - }; + inline void operator+=(const Trackster &other) { + // use getters on other + raw_energy_ += other.raw_energy(); + raw_em_energy_ += other.raw_em_energy(); + // add vertices and multiplicities + std::copy(std::begin(other.vertices()), std::end(other.vertices()), std::back_inserter(vertices_)); + std::copy(std::begin(other.vertex_multiplicity()), + std::end(other.vertex_multiplicity()), + std::back_inserter(vertex_multiplicity_)); + } + }; + } // namespace io_v1 + using Trackster = io_v1::Trackster; typedef std::vector TracksterCollection; } // namespace ticl diff --git a/DataFormats/HGCalReco/interface/TracksterFwd.h b/DataFormats/HGCalReco/interface/TracksterFwd.h index 24c16078cf84d..8c178d8fc8c54 100644 --- a/DataFormats/HGCalReco/interface/TracksterFwd.h +++ b/DataFormats/HGCalReco/interface/TracksterFwd.h @@ -2,7 +2,10 @@ #define DataFormats_HGCalReco_TracksterFwd_h namespace ticl { - class Trackster; -} + namespace io_v1 { + class Trackster; + } + using Trackster = io_v1::Trackster; +} // namespace ticl #endif diff --git a/DataFormats/HGCalReco/src/classes_def.xml b/DataFormats/HGCalReco/src/classes_def.xml index f2201a40ca46d..5199c7fc85f48 100644 --- a/DataFormats/HGCalReco/src/classes_def.xml +++ b/DataFormats/HGCalReco/src/classes_def.xml @@ -1,22 +1,13 @@ - - - - - - - - - - - + + - - - - - + + + + + @@ -68,7 +59,7 @@ - + diff --git a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h index 559ca9d08b364..4c73ff74f14cb 100644 --- a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h +++ b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h @@ -27,55 +27,59 @@ namespace trigger { - /// Transient book-keeping EDProduct filled by HLTFilter module to - /// record physics objects firing the filter (never persistet in - /// production; same functionality but different implementation - /// compared to the old HLT data model's HLTFilterObjectWithRefs - /// class) - class TriggerFilterObjectWithRefs : public TriggerRefsCollections { - /// data members - private: - int path_; - int module_; - std::vector collectionTags_; - - /// methods - public: - /// constructors - TriggerFilterObjectWithRefs() : TriggerRefsCollections(), path_(-9), module_(-9), collectionTags_() {} - - TriggerFilterObjectWithRefs(int path, int module) - : TriggerRefsCollections(), path_(path), module_(module), collectionTags_() {} - - /// accessors - int path() const { return path_; } - int module() const { return module_; } - - /// collectionTags - void addCollectionTag(const edm::InputTag& collectionTag) { collectionTags_.push_back(collectionTag.encode()); } - - void getCollectionTags(std::vector& collectionTags) const { - const trigger::size_type n(collectionTags_.size()); - collectionTags.resize(n); - for (trigger::size_type i = 0; i != n; ++i) { - collectionTags[i] = edm::InputTag(collectionTags_[i]); + namespace io_v1 { + /// Transient book-keeping EDProduct filled by HLTFilter module to + /// record physics objects firing the filter (never persistet in + /// production; same functionality but different implementation + /// compared to the old HLT data model's HLTFilterObjectWithRefs + /// class) + class TriggerFilterObjectWithRefs : public TriggerRefsCollections { + /// data members + private: + int path_; + int module_; + std::vector collectionTags_; + + /// methods + public: + /// constructors + TriggerFilterObjectWithRefs() : TriggerRefsCollections(), path_(-9), module_(-9), collectionTags_() {} + + TriggerFilterObjectWithRefs(int path, int module) + : TriggerRefsCollections(), path_(path), module_(module), collectionTags_() {} + + /// accessors + int path() const { return path_; } + int module() const { return module_; } + + /// collectionTags + void addCollectionTag(const edm::InputTag& collectionTag) { collectionTags_.push_back(collectionTag.encode()); } + + void getCollectionTags(std::vector& collectionTags) const { + const trigger::size_type n(collectionTags_.size()); + collectionTags.resize(n); + for (trigger::size_type i = 0; i != n; ++i) { + collectionTags[i] = edm::InputTag(collectionTags_[i]); + } } - } - - /// low-level technical accessor - const std::vector& getCollectionTagsAsStrings() const { return collectionTags_; } - - /// utility - void swap(TriggerFilterObjectWithRefs& other) { - TriggerRefsCollections::swap(other); // swap base instance - std::swap(path_, other.path_); - std::swap(module_, other.module_); - std::swap(collectionTags_, other.collectionTags_); // use specialized version for STL containers - } - }; - - // picked up via argument dependent lookup, e-g- by boost::swap() - inline void swap(TriggerFilterObjectWithRefs& first, TriggerFilterObjectWithRefs& second) { first.swap(second); } + + /// low-level technical accessor + const std::vector& getCollectionTagsAsStrings() const { return collectionTags_; } + + /// utility + void swap(TriggerFilterObjectWithRefs& other) { + TriggerRefsCollections::swap(other); // swap base instance + std::swap(path_, other.path_); + std::swap(module_, other.module_); + std::swap(collectionTags_, other.collectionTags_); // use specialized version for STL containers + } + }; + + // picked up via argument dependent lookup, e-g- by boost::swap() + inline void swap(TriggerFilterObjectWithRefs& first, TriggerFilterObjectWithRefs& second) { first.swap(second); } + } // namespace io_v1 + + using TriggerFilterObjectWithRefs = io_v1::TriggerFilterObjectWithRefs; } // namespace trigger diff --git a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h index 5029b91eb2ece..b0759b6be1ceb 100644 --- a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h +++ b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h @@ -2,7 +2,11 @@ #define HLTReco_TriggerFilterObjectWithRefsFwd_h namespace trigger { - class TriggerFilterObjectWithRefs; -} + namespace io_v1 { + class TriggerFilterObjectWithRefs; + } + using TriggerFilterObjectWithRefs = io_v1::TriggerFilterObjectWithRefs; + +} // namespace trigger #endif diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index 4d35592dc998c..b33506004fd51 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -1,28 +1,27 @@ - - + + - - + + - - + + - - + + - - - + + @@ -39,8 +38,8 @@ - - + + @@ -61,13 +60,13 @@ - + - - + + diff --git a/DataFormats/L1CSCTrackFinder/interface/TrackStub.h b/DataFormats/L1CSCTrackFinder/interface/TrackStub.h index 697798aea6d28..33e3232cf6d8f 100644 --- a/DataFormats/L1CSCTrackFinder/interface/TrackStub.h +++ b/DataFormats/L1CSCTrackFinder/interface/TrackStub.h @@ -18,57 +18,59 @@ #include namespace csctf { + namespace io_v1 { + class TrackStub : public CSCCorrelatedLCTDigi { + public: + TrackStub() {} + TrackStub(const CSCCorrelatedLCTDigi &, const DetId &); + TrackStub(const CSCCorrelatedLCTDigi &, const DetId &, const unsigned &phi, const unsigned &eta); - class TrackStub : public CSCCorrelatedLCTDigi { - public: - TrackStub() {} - TrackStub(const CSCCorrelatedLCTDigi &, const DetId &); - TrackStub(const CSCCorrelatedLCTDigi &, const DetId &, const unsigned &phi, const unsigned &eta); + /// set Eta and Phi from integer values. + void setEtaPacked(const unsigned &eta_) { theEta_ = eta_; } + void setPhiPacked(const unsigned &phi_) { thePhi_ = phi_; } - /// set Eta and Phi from integer values. - void setEtaPacked(const unsigned &eta_) { theEta_ = eta_; } - void setPhiPacked(const unsigned &phi_) { thePhi_ = phi_; } + /// return the Eta Value of this stub's position. + double etaValue() const { return (theEta_ * theEtaBinning + CSCTFConstants::minEta); } + /// return the Phi Value of this stub's position in local coordinates. + double phiValue() const { return (thePhi_ * thePhiBinning); } - /// return the Eta Value of this stub's position. - double etaValue() const { return (theEta_ * theEtaBinning + CSCTFConstants::minEta); } - /// return the Phi Value of this stub's position in local coordinates. - double phiValue() const { return (thePhi_ * thePhiBinning); } + /// Return the binned eta for this stub. + unsigned etaPacked() const { return theEta_; } + /// Return the binned phi for this stub. - /// Return the binned eta for this stub. - unsigned etaPacked() const { return theEta_; } - /// Return the binned phi for this stub. + unsigned phiPacked() const { return thePhi_; } - unsigned phiPacked() const { return thePhi_; } + /// Get the digi this stub was made from. + const CSCCorrelatedLCTDigi *getDigi() const { return dynamic_cast(this); } + DetId getDetId() const { return DetId(theDetId_); } - /// Get the digi this stub was made from. - const CSCCorrelatedLCTDigi *getDigi() const { return dynamic_cast(this); } - DetId getDetId() const { return DetId(theDetId_); } + /// Time / Space identifiers + /// See CSCTransientDataType.h for more details. + unsigned endcap() const; + unsigned station() const; + unsigned sector() const; + unsigned subsector() const; + unsigned cscid() const; + unsigned cscidSeparateME1a() const; + int BX() const { return getBX(); } - /// Time / Space identifiers - /// See CSCTransientDataType.h for more details. - unsigned endcap() const; - unsigned station() const; - unsigned sector() const; - unsigned subsector() const; - unsigned cscid() const; - unsigned cscidSeparateME1a() const; - int BX() const { return getBX(); } + /// Comparision Operators, used for MPC sorting + bool operator>(const TrackStub &) const; + bool operator<(const TrackStub &) const; + bool operator>=(const TrackStub &rhs) const { return !(this->operator<(rhs)); } + bool operator<=(const TrackStub &rhs) const { return !(this->operator>(rhs)); } + bool operator==(const TrackStub &rhs) const { + return ((theDetId_ == rhs.theDetId_) && (*(getDigi()) == *(rhs.getDigi()))); + } + bool operator!=(const TrackStub &rhs) const { return !(this->operator==(rhs)); } - /// Comparision Operators, used for MPC sorting - bool operator>(const TrackStub &) const; - bool operator<(const TrackStub &) const; - bool operator>=(const TrackStub &rhs) const { return !(this->operator<(rhs)); } - bool operator<=(const TrackStub &rhs) const { return !(this->operator>(rhs)); } - bool operator==(const TrackStub &rhs) const { - return ((theDetId_ == rhs.theDetId_) && (*(getDigi()) == *(rhs.getDigi()))); - } - bool operator!=(const TrackStub &rhs) const { return !(this->operator==(rhs)); } - - private: - uint32_t theDetId_; - unsigned thePhi_, theEta_, link_; - static const double theEtaBinning, thePhiBinning; - }; + private: + uint32_t theDetId_; + unsigned thePhi_, theEta_, link_; + static const double theEtaBinning, thePhiBinning; + }; + } // namespace io_v1 + using TrackStub = io_v1::TrackStub; } // namespace csctf #endif diff --git a/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h b/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h index d627e5dd592dd..5412916665577 100644 --- a/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h +++ b/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h @@ -2,7 +2,10 @@ #define L1CSCTrackFinder_TrackStubFwd_h namespace csctf { - class TrackStub; -} + namespace io_v1 { + class TrackStub; + } + using TrackStub = io_v1::TrackStub; +} // namespace csctf #endif diff --git a/DataFormats/L1CSCTrackFinder/src/classes_def.xml b/DataFormats/L1CSCTrackFinder/src/classes_def.xml index 09cbc47615a35..c30f105b43713 100644 --- a/DataFormats/L1CSCTrackFinder/src/classes_def.xml +++ b/DataFormats/L1CSCTrackFinder/src/classes_def.xml @@ -1,25 +1,19 @@ - - - + + - - + + - - + + - - - - - - - + + @@ -27,8 +21,8 @@ - - + + @@ -39,7 +33,7 @@ - +