#include <Fireworks/Calo/interface/FWHFTowerSliceSelector.h>
Public Member Functions | |
virtual void | doSelect (const TEveCaloData::CellId_t &) |
virtual void | doUnselect (const TEveCaloData::CellId_t &) |
FWHFTowerSliceSelector (const FWEventItem *i, TEveCaloDataVec *data) | |
virtual | ~FWHFTowerSliceSelector () |
Private Member Functions | |
bool | findBinFromId (HcalDetId &id, int tower) const |
Private Attributes | |
TEveCaloDataVec * | m_vecData |
Description: [one line class summary]
Usage: <usage>
Definition at line 32 of file FWHFTowerSliceSelector.h.
FWHFTowerSliceSelector::FWHFTowerSliceSelector | ( | const FWEventItem * | i, |
TEveCaloDataVec * | data | ||
) | [inline] |
Definition at line 35 of file FWHFTowerSliceSelector.h.
: FWFromSliceSelector(i), m_vecData(data) {}
virtual FWHFTowerSliceSelector::~FWHFTowerSliceSelector | ( | ) | [inline, virtual] |
Definition at line 38 of file FWHFTowerSliceSelector.h.
{}
void FWHFTowerSliceSelector::doSelect | ( | const TEveCaloData::CellId_t & | iCell | ) | [virtual] |
Reimplemented from FWFromSliceSelector.
Definition at line 35 of file FWHFTowerSliceSelector.cc.
References edm::SortedCollection< T, SORT >::begin(), FWEventItem::changeManager(), edm::SortedCollection< T, SORT >::end(), findBinFromId(), FWEventItem::get(), errorMatrix2Lands_multiChannel::id, getHLTprescales::index, FWFromSliceSelector::m_item, FWEventItem::modelInfo(), and FWEventItem::select().
{ if (!m_item) return; const HFRecHitCollection* hits=0; m_item->get(hits); assert(0!=hits); int index = 0; FWChangeSentry sentry(*(m_item->changeManager())); for(HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index) { HcalDetId id ((*it).detid().rawId()); if (findBinFromId(id, iCell.fTower) && m_item->modelInfo(index).m_displayProperties.isVisible() && !m_item->modelInfo(index).isSelected()) { // std::cout <<" doSelect "<<index<<std::endl; m_item->select(index); } } }
void FWHFTowerSliceSelector::doUnselect | ( | const TEveCaloData::CellId_t & | iCell | ) | [virtual] |
Reimplemented from FWFromSliceSelector.
Definition at line 58 of file FWHFTowerSliceSelector.cc.
References edm::SortedCollection< T, SORT >::begin(), FWEventItem::changeManager(), edm::SortedCollection< T, SORT >::end(), findBinFromId(), FWEventItem::get(), errorMatrix2Lands_multiChannel::id, getHLTprescales::index, FWFromSliceSelector::m_item, FWEventItem::modelInfo(), and FWEventItem::unselect().
{ if (!m_item) return; const HFRecHitCollection* hits=0; m_item->get(hits); assert(0!=hits); int index = 0; FWChangeSentry sentry(*(m_item->changeManager())); for(HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index) { HcalDetId id ((*it).detid().rawId()); if (findBinFromId(id, iCell.fTower) && m_item->modelInfo(index).m_displayProperties.isVisible() && m_item->modelInfo(index).isSelected()) { // std::cout <<" doUnselect "<<index<<std::endl; m_item->unselect(index); } } }
bool FWHFTowerSliceSelector::findBinFromId | ( | HcalDetId & | id, |
int | tower | ||
) | const [private] |
Definition at line 81 of file FWHFTowerSliceSelector.cc.
References eta(), prof2calltree::front, fwLog, FWGeometry::getCorners(), FWEventItem::getGeom(), i, j, fwlog::kInfo, FWFromSliceSelector::m_item, m_vecData, phi, and DetId::rawId().
Referenced by doSelect(), and doUnselect().
{ TEveCaloData::vCellId_t cellIds; const float* corners = m_item->getGeom()->getCorners( detId.rawId()); if( corners == 0 ) { fwLog( fwlog::kInfo ) << "FWHFTowerSliceSelector cannot get geometry for DetId: "<< detId.rawId() << ". Ignored.\n"; return false; } std::vector<TEveVector> front( 4 ); float eta = 0, phi = 0; int j = 0; for( int i = 0; i < 4; ++i ) { front[i] = TEveVector( corners[j], corners[j + 1], corners[j + 2] ); j +=3; eta += front[i].Eta(); phi += front[i].Phi(); } eta /= 4; phi /= 4; const TEveCaloData::CellGeom_t &cg = m_vecData->GetCellGeom()[tower] ; if(( eta >= cg.fEtaMin && eta <= cg.fEtaMax) && (phi >= cg.fPhiMin && phi <= cg.fPhiMax)) { return true; } return false; }
TEveCaloDataVec* FWHFTowerSliceSelector::m_vecData [private] |
Definition at line 45 of file FWHFTowerSliceSelector.h.
Referenced by findBinFromId().