Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBHE: speed up + mahi move double to float #28366

Merged
21 changes: 9 additions & 12 deletions RecoLocalCalo/HcalRecAlgos/interface/EigenMatrixTypes.h
Expand Up @@ -4,23 +4,20 @@
#include <Eigen/Dense>

constexpr int MaxSVSize = 10;
constexpr int MaxFSVSize = 19;
constexpr int MaxPVSize = 10;
constexpr int MaxFSVSize = 15;
constexpr int MaxPVSize = 8;

typedef Eigen::Matrix<double, Eigen::Dynamic, 1, 0, MaxSVSize, 1> SampleVector;
typedef Eigen::Matrix<double, Eigen::Dynamic, 1, 0, MaxPVSize, 1> PulseVector;
typedef Eigen::Matrix<float, Eigen::Dynamic, 1, 0, MaxSVSize, 1> SampleVector;
typedef Eigen::Matrix<float, Eigen::Dynamic, 1, 0, MaxPVSize, 1> PulseVector;
typedef Eigen::Matrix<int, Eigen::Dynamic, 1, 0, MaxPVSize, 1> BXVector;

typedef Eigen::Matrix<double, Eigen::Dynamic, 1, 0, MaxFSVSize, 1> FullSampleVector;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxFSVSize, MaxFSVSize> FullSampleMatrix;
typedef Eigen::Matrix<float, Eigen::Dynamic, 1, 0, MaxFSVSize, 1> FullSampleVector;
typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, 0, MaxFSVSize, MaxFSVSize> FullSampleMatrix;

typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxSVSize, MaxSVSize> SampleMatrix;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxPVSize, MaxPVSize> PulseMatrix;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxSVSize, MaxPVSize> SamplePulseMatrix;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxPVSize, MaxSVSize> PulseSampleMatrix;
typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, 0, MaxSVSize, MaxSVSize> SampleMatrix;
typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, 0, MaxPVSize, MaxPVSize> PulseMatrix;
typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, 0, MaxSVSize, MaxPVSize> SamplePulseMatrix;

typedef Eigen::LLT<SampleMatrix> SampleDecompLLT;
typedef Eigen::LLT<PulseMatrix> PulseDecompLLT;
typedef Eigen::LDLT<PulseMatrix> PulseDecompLDLT;

#endif
12 changes: 6 additions & 6 deletions RecoLocalCalo/HcalRecAlgos/interface/MahiFit.h
Expand Up @@ -53,7 +53,6 @@ struct MahiNnlsWorkspace {
PulseVector aTbVec; // A-transpose b (vector)

SampleDecompLLT covDecomp;
PulseDecompLDLT pulseDecomp;
};

struct MahiDebugInfo {
Expand Down Expand Up @@ -128,16 +127,16 @@ class MahiFit {
const HcalTimeSlew* hcalTimeSlewDelay_ = nullptr;

private:
double minimize() const;
const float minimize() const;
void onePulseMinimize() const;
void updateCov() const;
void updatePulseShape(double itQ,
void updateCov(const SampleMatrix& invCovMat) const;
void updatePulseShape(const float itQ,
FullSampleVector& pulseShape,
FullSampleVector& pulseDeriv,
FullSampleMatrix& pulseCov) const;

float calculateArrivalTime() const;
double calculateChiSq() const;
float calculateArrivalTime(unsigned int iBX) const;
float calculateChiSq() const;
void nnls() const;
void resetWorkspace() const;

Expand All @@ -163,6 +162,7 @@ class MahiFit {
bool applyTimeSlew_;
HcalTimeSlew::BiasSetting slewFlavor_;
float tsDelay1GeV_ = 0.f;
float norm_ = 1.f;

bool calculateArrivalTime_;
float meanTime_;
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalCalo/HcalRecAlgos/interface/PulseShapeFunctor.h
Expand Up @@ -9,7 +9,7 @@ namespace HcalConst {
constexpr int maxPSshapeBin = 256;
constexpr int nsPerBX = 25;
constexpr float iniTimeShift = 92.5f;
constexpr double invertnsPerBx = 0.04;
constexpr float invertnsPerBx = 0.04f;
constexpr int shiftTS = 4;

} // namespace HcalConst
Expand Down