#include <CaloBox.h>
Public Member Functions | |
CaloBox (double centerEta, double centerPhi, double dEta, double dPhi, unsigned nEta, unsigned nPhi) | |
std::ostream & | dump (std::ostream &stream, double norm=1.0, std::string rowDelim="\n") const |
const std::map< std::pair< int, int >, double > & | energies () const |
bool | fill (double eta, double phi, double energy) |
void | reset () |
void | test () |
virtual | ~CaloBox () |
Public Attributes | |
double | centerEta_ |
double | centerPhi_ |
double | dEta_ |
double | dPhi_ |
int | etaNegBound_ |
int | etaPosBound_ |
unsigned | nEta_ |
unsigned | nPhi_ |
int | phiNegBound_ |
int | phiPosBound_ |
Private Member Functions | |
CaloBox () | |
Private Attributes | |
std::map< std::pair< int, int > , double > | energies_ |
CaloBox::CaloBox | ( | double | centerEta, |
double | centerPhi, | ||
double | dEta, | ||
double | dPhi, | ||
unsigned | nEta, | ||
unsigned | nPhi | ||
) |
Definition at line 15 of file CaloBox.cc.
References gather_cfg::cout, etaNegBound_, etaPosBound_, nEta_, nPhi_, phiNegBound_, phiPosBound_, and reset().
: centerEta_(centerEta), centerPhi_(centerPhi), dEta_(dEta), dPhi_(dPhi), nEta_(nEta), nPhi_(nPhi) { if (nEta_ % 2 != 1) { cout << __PRETTY_FUNCTION__ << ": should use odd numbers for nEta and nPhi as CaloBox won't be symmetric otherwise!\n"; etaPosBound_ = (nEta / 2); etaNegBound_ = -1 * static_cast<int> ((nEta / 2) + 1); } else { etaPosBound_ = (nEta - 1) / 2; etaNegBound_ = -1 * static_cast<int> ((nEta - 1) / 2); } if (nPhi_ % 2 != 1) { cout << __PRETTY_FUNCTION__ << ": should use odd numbers for nEta and nPhi as CaloBox won't be symmetric otherwise!\n"; phiPosBound_ = (nPhi / 2); phiNegBound_ = -1 * static_cast<int> ((nPhi / 2) + 1); } else { phiPosBound_ = (nPhi - 1) / 2; phiNegBound_ = -1 * static_cast<int> ((nPhi - 1) / 2); } reset(); //cout << "CaloBox with n+ " << etaPosBound_ << ", n- " << etaNegBound_ // << ", p+ " << phiPosBound_ << ", p-" << phiNegBound_ << "\n"; }
CaloBox::~CaloBox | ( | ) | [virtual] |
Definition at line 57 of file CaloBox.cc.
{ }
pftools::CaloBox::CaloBox | ( | ) | [private] |
std::ostream& pftools::CaloBox::dump | ( | std::ostream & | stream, |
double | norm = 1.0 , |
||
std::string | rowDelim = "\n" |
||
) | const |
Referenced by pftools::operator<<().
const std::map<std::pair<int, int>, double>& pftools::CaloBox::energies | ( | ) | const [inline] |
bool CaloBox::fill | ( | double | eta, |
double | phi, | ||
double | energy | ||
) |
Definition at line 61 of file CaloBox.cc.
References centerEta_, centerPhi_, dEta_, dPhi_, energies_, relval_parameters_module::energy, etaNegBound_, etaPosBound_, combine::key, phiNegBound_, and phiPosBound_.
Referenced by test().
{ int etaDiv = static_cast<int>(floor((eta - centerEta_ + dEta_ / 2.0) / dEta_)); int phiDiv = static_cast<int>(floor((phi - centerPhi_ + dPhi_ / 2.0) / dPhi_)); //cout << "Testing for " << etaDiv << ", " << phiDiv << "\n"; if (etaDiv >= 0 && etaDiv > etaPosBound_) return false; if (etaDiv < 0 && etaDiv < etaNegBound_) return false; if (phiDiv >= 0 && phiDiv > phiPosBound_) return false; if (phiDiv < 0 && phiDiv < phiNegBound_) return false; pair<int, int> key(etaDiv, phiDiv); energies_[key] += energy; return true; }
void CaloBox::reset | ( | void | ) |
Definition at line 48 of file CaloBox.cc.
References trackerHits::c, energies_, etaNegBound_, etaPosBound_, phiNegBound_, phiPosBound_, pos, and alignCSCRings::r.
Referenced by CaloBox().
{ for (int r = phiPosBound_; r >= phiNegBound_; --r) { for (int c = etaNegBound_; c <= etaPosBound_; ++c) { std::pair<int, int> pos(c, r); energies_[pos] = 0.0; } } }
void CaloBox::test | ( | void | ) |
Definition at line 103 of file CaloBox.cc.
References prof2calltree::count, gather_cfg::cout, fill(), and convertSQLiteXML::ok.
{ CaloBox cb(0.0, 0.0, 1.0, 1.0, 5, 5); unsigned count(0); bool ok(false); ok = cb.fill(2, 1, 10); if (!ok) cout << "Box fill failed! Count = " << count << "\n"; ++count; ok = cb.fill(-1, 2, 20); if (!ok) cout << "Box fill failed! Count = " << count << "\n"; ++count; ok = cb.fill(-2, 5, 10); if (!ok) cout << "Box fill failed! Count = " << count << "\n"; ++count; ok = cb.fill(0.1, 1.3, 10); if (!ok) cout << "Box fill failed! Count = " << count << "\n"; ++count; ok = cb.fill(-1.4, 1.6, 10); if (!ok) cout << "Box fill failed! Count = " << count << "\n"; ++count; cout << cb; }
double pftools::CaloBox::centerEta_ |
Definition at line 27 of file CaloBox.h.
Referenced by fill(), and pftools::operator<<().
double pftools::CaloBox::centerPhi_ |
Definition at line 28 of file CaloBox.h.
Referenced by fill(), and pftools::operator<<().
double pftools::CaloBox::dEta_ |
double pftools::CaloBox::dPhi_ |
std::map<std::pair<int, int>, double> pftools::CaloBox::energies_ [private] |
Definition at line 48 of file CaloBox.h.
Referenced by energies(), fill(), and reset().
unsigned pftools::CaloBox::nEta_ |
unsigned pftools::CaloBox::nPhi_ |