-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36337 from hgc-tpg/hgc-tpg-integration-211202
[HGCAL trigger] Migration to new code structure - First pass
- Loading branch information
Showing
67 changed files
with
3,182 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalAlgoWrapperBase_h__ | ||
#define __L1Trigger_L1THGCal_HGCalAlgoWrapperBase_h__ | ||
|
||
#include "L1Trigger/L1THGCal/interface/HGCalAlgoWrapperBaseT.h" | ||
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "DataFormats/L1THGCal/interface/HGCalCluster.h" | ||
#include "DataFormats/L1THGCal/interface/HGCalMulticluster.h" | ||
|
||
#include "DataFormats/L1THGCal/interface/HGCalTowerMap.h" | ||
|
||
typedef HGCalAlgoWrapperBaseT< | ||
std::pair<const std::vector<edm::Ptr<l1t::HGCalCluster>>, const std::vector<std::pair<GlobalPoint, double>>>, | ||
std::pair<l1t::HGCalMulticlusterBxCollection&, l1t::HGCalClusterBxCollection&>, | ||
std::pair<const HGCalTriggerGeometryBase* const, const edm::ParameterSet&>> | ||
HGCalHistoClusteringWrapperBase; | ||
|
||
typedef HGCalAlgoWrapperBaseT<std::vector<edm::Ptr<l1t::HGCalTowerMap>>, | ||
l1t::HGCalTowerBxCollection, | ||
std::pair<const HGCalTriggerGeometryBase* const, const edm::ParameterSet&>> | ||
HGCalTowerMapsWrapperBase; | ||
|
||
typedef HGCalAlgoWrapperBaseT<l1t::HGCalMulticlusterBxCollection, | ||
l1t::HGCalMulticlusterBxCollection, | ||
std::pair<const HGCalTriggerGeometryBase* const, const edm::ParameterSet&>> | ||
HGCalStage2FilteringWrapperBase; | ||
|
||
typedef HGCalAlgoWrapperBaseT<std::vector<edm::Ptr<l1t::HGCalTriggerCell>>, | ||
std::vector<edm::Ptr<l1t::HGCalTriggerCell>>, | ||
std::tuple<const HGCalTriggerGeometryBase* const, const unsigned&, const uint32_t&>> | ||
HGCalStage1TruncationWrapperBase; | ||
|
||
#include "FWCore/PluginManager/interface/PluginFactory.h" | ||
typedef edmplugin::PluginFactory<HGCalHistoClusteringWrapperBase*(const edm::ParameterSet&)> | ||
HGCalHistoClusteringWrapperBaseFactory; | ||
typedef edmplugin::PluginFactory<HGCalTowerMapsWrapperBase*(const edm::ParameterSet&)> HGCalTowerMapsWrapperBaseFactory; | ||
typedef edmplugin::PluginFactory<HGCalStage2FilteringWrapperBase*(const edm::ParameterSet&)> | ||
HGCalStage2FilteringWrapperBaseFactory; | ||
typedef edmplugin::PluginFactory<HGCalStage1TruncationWrapperBase*(const edm::ParameterSet&)> | ||
HGCalStage1TruncationWrapperBaseFactory; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalAlgoWrapperBaseT_h__ | ||
#define __L1Trigger_L1THGCal_HGCalAlgoWrapperBaseT_h__ | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include <string> | ||
|
||
template <typename InputCollection, typename OutputCollection, typename Tparam> | ||
class HGCalAlgoWrapperBaseT { | ||
public: | ||
HGCalAlgoWrapperBaseT(const edm::ParameterSet& conf) : name_(conf.getParameter<std::string>("AlgoName")) {} | ||
|
||
virtual ~HGCalAlgoWrapperBaseT() {} | ||
|
||
virtual void configure(const Tparam& parameters) = 0; | ||
virtual void process(const InputCollection& inputCollection, OutputCollection& outputCollection) const = 0; | ||
|
||
const std::string& name() const { return name_; } | ||
|
||
private: | ||
const std::string name_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
L1Trigger/L1THGCal/interface/backend/HGCalBackendLayer1Processor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalBackendLayer1Processor_h__ | ||
#define __L1Trigger_L1THGCal_HGCalBackendLayer1Processor_h__ | ||
|
||
#include "L1Trigger/L1THGCal/interface/HGCalProcessorBase.h" | ||
|
||
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" | ||
#include "DataFormats/L1THGCal/interface/HGCalCluster.h" | ||
|
||
#include "L1Trigger/L1THGCal/interface/backend/HGCalStage1TruncationImpl.h" | ||
#include "L1Trigger/L1THGCal/interface/backend/HGCalClusteringDummyImpl.h" | ||
|
||
class HGCalBackendLayer1Processor : public HGCalBackendLayer1ProcessorBase { | ||
public: | ||
HGCalBackendLayer1Processor(const edm::ParameterSet& conf); | ||
|
||
void run(const edm::Handle<l1t::HGCalTriggerCellBxCollection>& collHandle, | ||
l1t::HGCalClusterBxCollection& collCluster2D) override; | ||
|
||
private: | ||
std::unique_ptr<HGCalClusteringDummyImpl> clusteringDummy_; | ||
std::unique_ptr<HGCalStage1TruncationImpl> truncation_; | ||
}; | ||
|
||
#endif |
25 changes: 25 additions & 0 deletions
25
L1Trigger/L1THGCal/interface/backend/HGCalBackendStage1Processor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalBackendStage1Processor_h__ | ||
#define __L1Trigger_L1THGCal_HGCalBackendStage1Processor_h__ | ||
|
||
#include "L1Trigger/L1THGCal/interface/HGCalProcessorBase.h" | ||
#include "L1Trigger/L1THGCal/interface/HGCalAlgoWrapperBase.h" | ||
|
||
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" | ||
#include "DataFormats/L1THGCal/interface/HGCalCluster.h" | ||
|
||
#include "L1Trigger/L1THGCal/interface/backend/HGCalStage1TruncationImpl.h" | ||
#include "L1Trigger/L1THGCal/interface/backend/HGCalClusteringDummyImpl.h" | ||
|
||
class HGCalBackendStage1Processor : public HGCalBackendStage1ProcessorBase { | ||
public: | ||
HGCalBackendStage1Processor(const edm::ParameterSet& conf); | ||
|
||
void run(const std::pair<uint32_t, std::vector<edm::Ptr<l1t::HGCalTriggerCell>>>& fpga_id_tcs, | ||
std::vector<edm::Ptr<l1t::HGCalTriggerCell>>& truncated_tcs) override; | ||
|
||
private: | ||
std::unique_ptr<HGCalStage1TruncationWrapperBase> truncationWrapper_; | ||
const edm::ParameterSet conf_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#ifndef L1Trigger_L1THGCal_HGCalCluster_SA_h | ||
#define L1Trigger_L1THGCal_HGCalCluster_SA_h | ||
|
||
#include <vector> | ||
|
||
namespace l1thgcfirmware { | ||
|
||
class HGCalCluster { | ||
public: | ||
HGCalCluster(float x, | ||
float y, | ||
float z, | ||
int zside, | ||
unsigned int layer, | ||
float eta, | ||
float phi, | ||
float pt, | ||
float mipPt, | ||
unsigned int index_cmssw) | ||
: x_(x), | ||
y_(y), | ||
z_(z), | ||
zside_(zside), | ||
layer_(layer), | ||
eta_(eta), | ||
phi_(phi), | ||
pt_(pt), | ||
mipPt_(mipPt), | ||
index_cmssw_(index_cmssw) {} | ||
|
||
~HGCalCluster() = default; | ||
|
||
float x() const { return x_; } | ||
float y() const { return y_; } | ||
float z() const { return z_; } | ||
float zside() const { return zside_; } | ||
unsigned int layer() const { return layer_; } | ||
float eta() const { return eta_; } | ||
float phi() const { return phi_; } | ||
float pt() const { return pt_; } | ||
float mipPt() const { return mipPt_; } | ||
unsigned int index_cmssw() const { return index_cmssw_; } | ||
|
||
private: | ||
float x_; | ||
float y_; | ||
float z_; | ||
int zside_; | ||
unsigned int layer_; | ||
float eta_; | ||
float phi_; | ||
float pt_; | ||
float mipPt_; | ||
unsigned int index_cmssw_; | ||
}; | ||
|
||
typedef std::vector<HGCalCluster> HGCalClusterSACollection; | ||
|
||
} // namespace l1thgcfirmware | ||
|
||
#endif |
56 changes: 56 additions & 0 deletions
56
L1Trigger/L1THGCal/interface/backend/HGCalHistoClusteringConfig_SA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalHistoCluteringConfig_SA_h__ | ||
#define __L1Trigger_L1THGCal_HGCalHistoCluteringConfig_SA_h__ | ||
|
||
#include <vector> | ||
|
||
namespace l1thgcfirmware { | ||
|
||
class ClusterAlgoConfig { | ||
public: | ||
ClusterAlgoConfig(const double midRadius, | ||
const double dr, | ||
const std::vector<double>& dr_byLayer_coefficientA, | ||
const std::vector<double>& dr_byLayer_coefficientB, | ||
const float ptC3dThreshold) | ||
: midRadius_(midRadius), | ||
dr_(dr), | ||
dr_byLayer_coefficientA_(dr_byLayer_coefficientA), | ||
dr_byLayer_coefficientB_(dr_byLayer_coefficientB), | ||
ptC3dThreshold_(ptC3dThreshold) {} | ||
|
||
void setParameters(double midRadius, | ||
double dr, | ||
const std::vector<double>& dr_byLayer_coefficientA, | ||
const std::vector<double>& dr_byLayer_coefficientB, | ||
float ptC3dThreshold) { | ||
midRadius_ = midRadius; | ||
dr_ = dr; | ||
dr_byLayer_coefficientA_ = dr_byLayer_coefficientA; | ||
dr_byLayer_coefficientB_ = dr_byLayer_coefficientB; | ||
ptC3dThreshold_ = ptC3dThreshold; | ||
} | ||
|
||
void setParameters(const ClusterAlgoConfig& newConfig) { | ||
setParameters(newConfig.midRadius(), | ||
newConfig.dr(), | ||
newConfig.dr_byLayer_coefficientA(), | ||
newConfig.dr_byLayer_coefficientB(), | ||
newConfig.ptC3dThreshold()); | ||
} | ||
double midRadius() const { return midRadius_; } | ||
double dr() const { return dr_; } | ||
const std::vector<double>& dr_byLayer_coefficientA() const { return dr_byLayer_coefficientA_; } | ||
const std::vector<double>& dr_byLayer_coefficientB() const { return dr_byLayer_coefficientB_; } | ||
float ptC3dThreshold() const { return ptC3dThreshold_; } | ||
|
||
private: | ||
double midRadius_; | ||
double dr_; | ||
std::vector<double> dr_byLayer_coefficientA_; | ||
std::vector<double> dr_byLayer_coefficientB_; | ||
float ptC3dThreshold_; | ||
}; | ||
|
||
} // namespace l1thgcfirmware | ||
|
||
#endif |
33 changes: 33 additions & 0 deletions
33
L1Trigger/L1THGCal/interface/backend/HGCalHistoClusteringImpl_SA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef __L1Trigger_L1THGCal_HGCalHistoClusteringImplSA_h__ | ||
#define __L1Trigger_L1THGCal_HGCalHistoClusteringImplSA_h__ | ||
|
||
#include "L1Trigger/L1THGCal/interface/backend/HGCalCluster_SA.h" | ||
#include "L1Trigger/L1THGCal/interface/backend/HGCalSeed_SA.h" | ||
#include "L1Trigger/L1THGCal/interface/backend/HGCalMulticluster_SA.h" | ||
#include "L1Trigger/L1THGCal/interface/backend/HGCalHistoClusteringConfig_SA.h" | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <memory> | ||
|
||
class HGCalHistoClusteringImplSA { | ||
public: | ||
HGCalHistoClusteringImplSA() = default; | ||
~HGCalHistoClusteringImplSA() = default; | ||
|
||
void runAlgorithm() const; | ||
|
||
std::vector<l1thgcfirmware::HGCalMulticluster> clusterSeedMulticluster_SA( | ||
const std::vector<l1thgcfirmware::HGCalCluster>& clusters, | ||
const std::vector<l1thgcfirmware::HGCalSeed>& seeds, | ||
std::vector<l1thgcfirmware::HGCalCluster>& rejected_clusters, | ||
const l1thgcfirmware::ClusterAlgoConfig& configuration) const; | ||
|
||
void finalizeClusters_SA(const std::vector<l1thgcfirmware::HGCalMulticluster>&, | ||
const std::vector<l1thgcfirmware::HGCalCluster>&, | ||
std::vector<l1thgcfirmware::HGCalMulticluster>&, | ||
std::vector<l1thgcfirmware::HGCalCluster>&, | ||
const l1thgcfirmware::ClusterAlgoConfig& configuration) const; | ||
}; | ||
|
||
#endif |
57 changes: 57 additions & 0 deletions
57
L1Trigger/L1THGCal/interface/backend/HGCalMulticluster_SA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#ifndef L1Trigger_L1THGCal_HGCalMulticluster_SA_h | ||
#define L1Trigger_L1THGCal_HGCalMulticluster_SA_h | ||
|
||
#include "L1Trigger/L1THGCal/interface/backend/HGCalCluster_SA.h" | ||
|
||
#include <vector> | ||
|
||
namespace l1thgcfirmware { | ||
|
||
class HGCalMulticluster { | ||
public: | ||
HGCalMulticluster() | ||
: centre_x_(0), | ||
centre_y_(0), | ||
centre_z_(0), | ||
centreProj_x_(0), | ||
centreProj_y_(0), | ||
centreProj_z_(0), | ||
mipPt_(0), | ||
sumPt_() {} | ||
|
||
HGCalMulticluster(const l1thgcfirmware::HGCalCluster& tc, float fraction = 1.); | ||
|
||
void addConstituent(const l1thgcfirmware::HGCalCluster& tc, bool updateCentre = true, float fraction = 1.); | ||
|
||
~HGCalMulticluster() = default; | ||
|
||
const std::vector<l1thgcfirmware::HGCalCluster>& constituents() const { return constituents_; } | ||
|
||
unsigned size() const { return constituents_.size(); } | ||
|
||
float sumPt() const { return sumPt_; } | ||
|
||
private: | ||
// Could replace this with own simple implementation of GlobalPoint? | ||
// Or just a struct? | ||
float centre_x_; | ||
float centre_y_; | ||
float centre_z_; | ||
|
||
float centreProj_x_; | ||
float centreProj_y_; | ||
float centreProj_z_; | ||
|
||
float mipPt_; | ||
float sumPt_; | ||
|
||
std::vector<l1thgcfirmware::HGCalCluster> constituents_; | ||
|
||
void updateP4AndPosition(const l1thgcfirmware::HGCalCluster& tc, bool updateCentre = true, float fraction = 1.); | ||
}; | ||
|
||
typedef std::vector<HGCalMulticluster> HGCalMulticlusterSACollection; | ||
|
||
} // namespace l1thgcfirmware | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef L1Trigger_L1THGCal_HGCalSeed_SA_h | ||
#define L1Trigger_L1THGCal_HGCalSeed_SA_h | ||
|
||
namespace l1thgcfirmware { | ||
|
||
class HGCalSeed { | ||
public: | ||
HGCalSeed(float x, float y, float z, float energy) : x_(x), y_(y), z_(z), energy_(energy) {} | ||
|
||
~HGCalSeed(){}; | ||
|
||
float x() const { return x_; } | ||
float y() const { return y_; } | ||
float z() const { return z_; } | ||
float energy() const { return energy_; } | ||
|
||
private: | ||
float x_; | ||
float y_; | ||
float z_; | ||
float energy_; | ||
}; | ||
|
||
typedef std::vector<HGCalSeed> HGCalSeedSACollection; | ||
|
||
} // namespace l1thgcfirmware | ||
|
||
#endif |
Oops, something went wrong.