From 416f488ad79e68e8952b5eb1e59d2969f4e87983 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 12 Jun 2024 22:00:52 +0200 Subject: [PATCH 1/2] Move commons.h to DataFormats/HGCalReco to break cyclic dep --- DataFormats/HGCalReco/interface/TICLCandidate.h | 2 +- {RecoHGCal/TICL => DataFormats/HGCalReco}/interface/commons.h | 0 RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h | 2 +- RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h | 2 +- RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h | 2 +- RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h | 2 +- RecoHGCal/TICL/plugins/SimTrackstersProducer.cc | 2 +- RecoHGCal/TICL/plugins/TICLDumper.cc | 2 +- Validation/HGCalValidation/src/TICLCandidateValidator.cc | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename {RecoHGCal/TICL => DataFormats/HGCalReco}/interface/commons.h (100%) diff --git a/DataFormats/HGCalReco/interface/TICLCandidate.h b/DataFormats/HGCalReco/interface/TICLCandidate.h index 8752c9bf27a15..a2b3d9f266ed2 100644 --- a/DataFormats/HGCalReco/interface/TICLCandidate.h +++ b/DataFormats/HGCalReco/interface/TICLCandidate.h @@ -7,7 +7,7 @@ #include "DataFormats/Math/interface/Point3D.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "commons.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/RecoHGCal/TICL/interface/commons.h b/DataFormats/HGCalReco/interface/commons.h similarity index 100% rename from RecoHGCal/TICL/interface/commons.h rename to DataFormats/HGCalReco/interface/commons.h diff --git a/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h b/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h index 507777de13d29..c78069f5e8878 100644 --- a/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h +++ b/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h @@ -13,7 +13,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/ValueMap.h" #include "RecoHGCal/TICL/interface/GlobalCache.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "DataFormats/HGCalReco/interface/commons.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "PhysicsTools/TensorFlow/interface/TensorFlow.h" diff --git a/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h b/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h index 8f016ef31ec8a..713d36b3d32ad 100644 --- a/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h +++ b/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h @@ -19,7 +19,7 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" #include "RecoHGCal/TICL/interface/GlobalCache.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "DataFormats/HGCalReco/interface/commons.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "CommonTools/RecoAlgos/interface/MultiVectorManager.h" diff --git a/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h b/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h index 3b8b5db320b08..bc3324c8fe4a3 100644 --- a/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h +++ b/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h @@ -16,7 +16,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/ValueMap.h" #include "RecoHGCal/TICL/interface/GlobalCache.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "DataFormats/HGCalReco/interface/commons.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "CommonTools/RecoAlgos/interface/MultiVectorManager.h" diff --git a/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h b/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h index f9ee077015062..6aef995b7623e 100644 --- a/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h +++ b/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h @@ -4,7 +4,7 @@ #include #include #include "RecoHGCal/TICL/plugins/LinkingAlgoBase.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "DataFormats/HGCalReco/interface/commons.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/ESHandle.h" diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 0b86d999ac80c..71207dded04b6 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -39,7 +39,7 @@ #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "DataFormats/HGCalReco/interface/commons.h" #include "TrackstersPCA.h" #include diff --git a/RecoHGCal/TICL/plugins/TICLDumper.cc b/RecoHGCal/TICL/plugins/TICLDumper.cc index 1a02ffbd2e015..1d3f039eebc7d 100644 --- a/RecoHGCal/TICL/plugins/TICLDumper.cc +++ b/RecoHGCal/TICL/plugins/TICLDumper.cc @@ -52,7 +52,7 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "SimDataFormats/Associations/interface/TracksterToSimTracksterHitLCAssociator.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "DataFormats/HGCalReco/interface/commons.h" // TFileService #include "FWCore/ServiceRegistry/interface/Service.h" diff --git a/Validation/HGCalValidation/src/TICLCandidateValidator.cc b/Validation/HGCalValidation/src/TICLCandidateValidator.cc index a892227d370d2..93d3ee91a284b 100644 --- a/Validation/HGCalValidation/src/TICLCandidateValidator.cc +++ b/Validation/HGCalValidation/src/TICLCandidateValidator.cc @@ -3,7 +3,7 @@ #include #include "Validation/HGCalValidation/interface/TICLCandidateValidator.h" -#include "RecoHGCal/TICL/interface/commons.h" +#include "DataFormats/HGCalReco/interface/commons.h" TICLCandidateValidator::TICLCandidateValidator( edm::EDGetTokenT> ticlCandidates, From 5e23d509dfe1879902b643a1b75c893da4260bbb Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Thu, 13 Jun 2024 14:24:24 +0200 Subject: [PATCH 2/2] merge commons.h in to Common.h --- DataFormats/HGCalReco/interface/Common.h | 40 ++++++++++++++++ .../HGCalReco/interface/TICLCandidate.h | 2 +- DataFormats/HGCalReco/interface/commons.h | 47 ------------------- .../interface/PatternRecognitionAlgoBase.h | 2 +- .../interface/TICLInterpretationAlgoBase.h | 2 +- .../TICL/interface/TracksterLinkingAlgoBase.h | 2 +- RecoHGCal/TICL/plugins/HGCGraph.h | 1 - .../plugins/LinkingAlgoByDirectionGeometric.h | 2 +- .../TICL/plugins/SimTrackstersProducer.cc | 2 +- RecoHGCal/TICL/plugins/TICLDumper.cc | 1 - .../src/TICLCandidateValidator.cc | 2 +- 11 files changed, 47 insertions(+), 56 deletions(-) delete mode 100644 DataFormats/HGCalReco/interface/commons.h diff --git a/DataFormats/HGCalReco/interface/Common.h b/DataFormats/HGCalReco/interface/Common.h index 9f30a5ab8e45b..98ba79210b19d 100644 --- a/DataFormats/HGCalReco/interface/Common.h +++ b/DataFormats/HGCalReco/interface/Common.h @@ -5,6 +5,8 @@ #include #include +#include "DataFormats/HGCalReco/interface/Trackster.h" + namespace ticl { struct TileConstants { static constexpr float minEta = 1.5f; @@ -32,4 +34,42 @@ namespace ticl { typedef std::vector > TICLClusterFilterMask; } // namespace ticl +namespace ticl { + + //constants + constexpr double mpion = 0.13957; + constexpr float mpion2 = mpion * mpion; + typedef math::XYZVectorF Vector; + + inline Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge) { + if (pdgId == 111) { + return Trackster::ParticleType::neutral_pion; + } else { + pdgId = std::abs(pdgId); + if (pdgId == 22) { + return Trackster::ParticleType::photon; + } else if (pdgId == 11) { + return Trackster::ParticleType::electron; + } else if (pdgId == 13) { + return Trackster::ParticleType::muon; + } else { + bool isHadron = (pdgId > 100 and pdgId < 900) or (pdgId > 1000 and pdgId < 9000); + if (isHadron) { + if (charge != 0) { + return Trackster::ParticleType::charged_hadron; + } else { + return Trackster::ParticleType::neutral_hadron; + } + } else { + return Trackster::ParticleType::unknown; + } + } + } + } + + // verbosity levels for ticl algorithms + enum VerbosityLevel { None = 0, Basic, Advanced, Expert, Guru }; + +} // namespace ticl + #endif // DataFormats_HGCalReco_Common_h diff --git a/DataFormats/HGCalReco/interface/TICLCandidate.h b/DataFormats/HGCalReco/interface/TICLCandidate.h index a2b3d9f266ed2..fa8428f88a9f2 100644 --- a/DataFormats/HGCalReco/interface/TICLCandidate.h +++ b/DataFormats/HGCalReco/interface/TICLCandidate.h @@ -7,7 +7,7 @@ #include "DataFormats/Math/interface/Point3D.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "commons.h" +#include "Common.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/DataFormats/HGCalReco/interface/commons.h b/DataFormats/HGCalReco/interface/commons.h deleted file mode 100644 index 528687d8e063c..0000000000000 --- a/DataFormats/HGCalReco/interface/commons.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef RecoHGCal_TICL_interface_commons_h -#define RecoHGCal_TICL_interface_commons_h -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" -#include "DataFormats/HGCalReco/interface/Trackster.h" -#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" - -namespace ticl { - - //constants - constexpr double mpion = 0.13957; - constexpr float mpion2 = mpion * mpion; - typedef math::XYZVectorF Vector; - - inline Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge) { - if (pdgId == 111) { - return Trackster::ParticleType::neutral_pion; - } else { - pdgId = std::abs(pdgId); - if (pdgId == 22) { - return Trackster::ParticleType::photon; - } else if (pdgId == 11) { - return Trackster::ParticleType::electron; - } else if (pdgId == 13) { - return Trackster::ParticleType::muon; - } else { - bool isHadron = (pdgId > 100 and pdgId < 900) or (pdgId > 1000 and pdgId < 9000); - if (isHadron) { - if (charge != 0) { - return Trackster::ParticleType::charged_hadron; - } else { - return Trackster::ParticleType::neutral_hadron; - } - } else { - return Trackster::ParticleType::unknown; - } - } - } - } - - // verbosity levels for ticl algorithms - enum VerbosityLevel { None = 0, Basic, Advanced, Expert, Guru }; - -} // namespace ticl - -#endif diff --git a/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h b/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h index c78069f5e8878..2658443104721 100644 --- a/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h +++ b/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h @@ -13,7 +13,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/ValueMap.h" #include "RecoHGCal/TICL/interface/GlobalCache.h" -#include "DataFormats/HGCalReco/interface/commons.h" +#include "DataFormats/HGCalReco/interface/Common.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "PhysicsTools/TensorFlow/interface/TensorFlow.h" diff --git a/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h b/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h index 713d36b3d32ad..5790c655a0c75 100644 --- a/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h +++ b/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h @@ -19,7 +19,7 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" #include "RecoHGCal/TICL/interface/GlobalCache.h" -#include "DataFormats/HGCalReco/interface/commons.h" +#include "DataFormats/HGCalReco/interface/Common.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "CommonTools/RecoAlgos/interface/MultiVectorManager.h" diff --git a/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h b/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h index bc3324c8fe4a3..2500cf54fa737 100644 --- a/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h +++ b/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h @@ -16,7 +16,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/ValueMap.h" #include "RecoHGCal/TICL/interface/GlobalCache.h" -#include "DataFormats/HGCalReco/interface/commons.h" +#include "DataFormats/HGCalReco/interface/Common.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "CommonTools/RecoAlgos/interface/MultiVectorManager.h" diff --git a/RecoHGCal/TICL/plugins/HGCGraph.h b/RecoHGCal/TICL/plugins/HGCGraph.h index 2b597db404fe4..04a12086ffda1 100644 --- a/RecoHGCal/TICL/plugins/HGCGraph.h +++ b/RecoHGCal/TICL/plugins/HGCGraph.h @@ -6,7 +6,6 @@ #include -#include "DataFormats/HGCalReco/interface/Common.h" #include "DataFormats/HGCalReco/interface/TICLLayerTile.h" #include "DataFormats/HGCalReco/interface/TICLSeedingRegion.h" #include "HGCDoublet.h" diff --git a/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h b/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h index 6aef995b7623e..e2ce116e08981 100644 --- a/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h +++ b/RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h @@ -4,7 +4,7 @@ #include #include #include "RecoHGCal/TICL/plugins/LinkingAlgoBase.h" -#include "DataFormats/HGCalReco/interface/commons.h" +#include "DataFormats/HGCalReco/interface/Common.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/ESHandle.h" diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 71207dded04b6..048b9f8af5b49 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -39,7 +39,7 @@ #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h" -#include "DataFormats/HGCalReco/interface/commons.h" +#include "DataFormats/HGCalReco/interface/Common.h" #include "TrackstersPCA.h" #include diff --git a/RecoHGCal/TICL/plugins/TICLDumper.cc b/RecoHGCal/TICL/plugins/TICLDumper.cc index 1d3f039eebc7d..e4d2a05b068f2 100644 --- a/RecoHGCal/TICL/plugins/TICLDumper.cc +++ b/RecoHGCal/TICL/plugins/TICLDumper.cc @@ -52,7 +52,6 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "SimDataFormats/Associations/interface/TracksterToSimTracksterHitLCAssociator.h" -#include "DataFormats/HGCalReco/interface/commons.h" // TFileService #include "FWCore/ServiceRegistry/interface/Service.h" diff --git a/Validation/HGCalValidation/src/TICLCandidateValidator.cc b/Validation/HGCalValidation/src/TICLCandidateValidator.cc index 93d3ee91a284b..61f76c8bd8fe3 100644 --- a/Validation/HGCalValidation/src/TICLCandidateValidator.cc +++ b/Validation/HGCalValidation/src/TICLCandidateValidator.cc @@ -3,7 +3,7 @@ #include #include "Validation/HGCalValidation/interface/TICLCandidateValidator.h" -#include "DataFormats/HGCalReco/interface/commons.h" +#include "DataFormats/HGCalReco/interface/Common.h" TICLCandidateValidator::TICLCandidateValidator( edm::EDGetTokenT> ticlCandidates,