CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWHFTowerSliceSelector Class Reference

#include <Fireworks/Calo/interface/FWHFTowerSliceSelector.h>

Inheritance diagram for FWHFTowerSliceSelector:
FWFromSliceSelector

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 ()
 
- Public Member Functions inherited from FWFromSliceSelector
FWModelChangeManagerchangeManager () const
 
void clear ()
 
 FWFromSliceSelector (const FWEventItem *)
 
void reset ()
 
virtual ~FWFromSliceSelector ()
 

Private Member Functions

bool findBinFromId (HcalDetId &id, int tower) const
 

Private Attributes

TEveCaloDataVec * m_vecData
 

Additional Inherited Members

- Protected Attributes inherited from FWFromSliceSelector
const FWEventItemm_item
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 32 of file FWHFTowerSliceSelector.h.

Constructor & Destructor Documentation

FWHFTowerSliceSelector::FWHFTowerSliceSelector ( const FWEventItem i,
TEveCaloDataVec *  data 
)
inline

Definition at line 35 of file FWHFTowerSliceSelector.h.

35  :
FWFromSliceSelector(const FWEventItem *)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual FWHFTowerSliceSelector::~FWHFTowerSliceSelector ( )
inlinevirtual

Definition at line 38 of file FWHFTowerSliceSelector.h.

38 {}

Member Function Documentation

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, FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWEventItem::ModelInfo::m_displayProperties, FWFromSliceSelector::m_item, FWEventItem::modelInfo(), and FWEventItem::select().

36 {
37  if (!m_item) return;
38 
39  const HFRecHitCollection* hits=0;
40  m_item->get(hits);
41  assert(0!=hits);
42 
43  int index = 0;
44  FWChangeSentry sentry(*(m_item->changeManager()));
45  for(HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index)
46  {
47  HcalDetId id ((*it).detid().rawId());
48  if (findBinFromId(id, iCell.fTower) &&
50  !m_item->modelInfo(index).isSelected()) {
51  // std::cout <<" doSelect "<<index<<std::endl;
52  m_item->select(index);
53  }
54  }
55 }
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:131
bool isSelected() const
Definition: FWEventItem.h:71
void get(const T *&oData) const
Definition: FWEventItem.h:85
std::vector< T >::const_iterator const_iterator
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
const_iterator end() const
bool findBinFromId(HcalDetId &id, int tower) const
void select(int iIndex) const
Definition: FWEventItem.cc:251
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
const_iterator begin() const
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, FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWEventItem::ModelInfo::m_displayProperties, FWFromSliceSelector::m_item, FWEventItem::modelInfo(), and FWEventItem::unselect().

59 {
60  if (!m_item) return;
61 
62  const HFRecHitCollection* hits=0;
63  m_item->get(hits);
64  assert(0!=hits);
65 
66  int index = 0;
67  FWChangeSentry sentry(*(m_item->changeManager()));
68  for(HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index)
69  {
70  HcalDetId id ((*it).detid().rawId());
71  if (findBinFromId(id, iCell.fTower) &&
73  m_item->modelInfo(index).isSelected()) {
74  // std::cout <<" doUnselect "<<index<<std::endl;
75  m_item->unselect(index);
76  }
77  }
78 }
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:131
bool isSelected() const
Definition: FWEventItem.h:71
void get(const T *&oData) const
Definition: FWEventItem.h:85
std::vector< T >::const_iterator const_iterator
void unselect(int iIndex) const
Definition: FWEventItem.cc:240
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
const_iterator end() const
bool findBinFromId(HcalDetId &id, int tower) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
const_iterator begin() const
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().

82 {
83  TEveCaloData::vCellId_t cellIds;
84  const float* corners = m_item->getGeom()->getCorners( detId.rawId());
85  if( corners == 0 )
86  {
87  fwLog( fwlog::kInfo ) << "FWHFTowerSliceSelector cannot get geometry for DetId: "<< detId.rawId() << ". Ignored.\n";
88  return false;
89  }
90  std::vector<TEveVector> front( 4 );
91  float eta = 0, phi = 0;
92  int j = 0;
93  for( int i = 0; i < 4; ++i )
94  {
95  front[i] = TEveVector( corners[j], corners[j + 1], corners[j + 2] );
96  j +=3;
97 
98  eta += front[i].Eta();
99  phi += front[i].Phi();
100  }
101  eta /= 4;
102  phi /= 4;
103 
104  const TEveCaloData::CellGeom_t &cg = m_vecData->GetCellGeom()[tower] ;
105  if(( eta >= cg.fEtaMin && eta <= cg.fEtaMax) && (phi >= cg.fPhiMin && phi <= cg.fPhiMax))
106  {
107  return true;
108  }
109 
110  return false;
111 }
int i
Definition: DBlmapReader.cc:9
T eta() const
const FWEventItem * m_item
int j
Definition: DBlmapReader.cc:9
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:278
#define fwLog(_level_)
Definition: fwLog.h:51
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
Definition: DDAxes.h:10

Member Data Documentation

TEveCaloDataVec* FWHFTowerSliceSelector::m_vecData
private

Definition at line 45 of file FWHFTowerSliceSelector.h.

Referenced by findBinFromId().