Fork me on GitHub

Changeset 391 in svn


Ignore:
Timestamp:
May 18, 2009, 6:49:32 PM (16 years ago)
Author:
Xavier Rouby
Message:

new 'D_CaloTower::getElement() const' method

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/interface/CaloUtil.h

    r264 r391  
    125125    D_CaloTower& operator[](const unsigned int i) {return _calotowers[i];}
    126126    const D_CaloTower& getElement(const float eta, const float phi) ;
     127    const D_CaloTower& getElement(const float eta, const float phi) const;
    127128    void addTower(const D_CaloTower& tower);
    128129    // sorts the elements with respect to their eta
  • trunk/src/CaloUtil.cc

    r264 r391  
    216216  return dummyTower; // if not found
    217217}
     218
     219const D_CaloTower& D_CaloTowerList::getElement(const float eta, const float phi) const {
     220  if(!_sorted) cout << "Warning: unsorted list!";
     221  for (unsigned int i=0; i< _calotowers.size(); i++) {
     222        if(_calotowers[i].getEta() == eta &&
     223           _calotowers[i].getPhi() == phi )
     224                return _calotowers[i];
     225  }
     226  return dummyTower; // if not found
     227}
     228
Note: See TracChangeset for help on using the changeset viewer.