Skip to content

Commit

Permalink
Merge pull request cafana#1 from ddoyle31415/master
Browse files Browse the repository at this point in the history
Adding hashing function to DMP calculator required for caching predictions
  • Loading branch information
cjbacchus authored Oct 23, 2020
2 parents 8df98ed + 14d08f5 commit 22fd646
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
15 changes: 15 additions & 0 deletions OscLib/OscCalcDMP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@

namespace osc
{
template<typename T>
TMD5*
_OscCalcDMP<T>::GetParamsHash() const
{
std::string txt = "DMP";
TMD5* ret = new TMD5;
ret->Update((unsigned char*)txt.c_str(), txt.size());
const int kNumParams = 8;
T buf[kNumParams] = {this->fRho, this->fL, this->fDmsq21, this->fDmsq32,
this->fTh12, this->fTh13, this->fTh23, this->fdCP};
ret->Update((unsigned char*)buf, sizeof(T)*kNumParams);
ret->Final();
return ret;
}


template<typename T>
void _OscCalcDMP<T>::SaveLastParams()
Expand Down
5 changes: 4 additions & 1 deletion OscLib/OscCalcDMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ namespace osc
void InvalidateCache() override { this->fCache.clear(); }

std::string Name() const{ return name;}

private:
void FillCache(std::vector<double> const & energies); // move back to private
_OscCache<T> fCache; // move back to private

private:
TMD5* GetParamsHash() const override;

int ChannelCacheIdx(int flavBefore, int flavAfter) const;

std::string name = "OscCalcDMP";
Expand Down
3 changes: 2 additions & 1 deletion OscLib/OscCalcPMNSOptEigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ namespace osc

TMD5* GetParamsHash() const override;
std::string Name() const { return name; }

private:
void FillCache(const std::vector<double> & energies);// move back to private
_OscCache<double> fCache; // move back to private

private:
std::string name = "OscCalcPMNSOptEigen";
int ChannelCacheIdx(int flavBefore, int flavAfter) const;

Expand Down

0 comments on commit 22fd646

Please sign in to comment.