CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWHGTowerSliceSelector Class Reference

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

Inheritance diagram for FWHGTowerSliceSelector:
FWFromSliceSelector

Public Member Functions

virtual void doSelect (const TEveCaloData::CellId_t &)
 
virtual void doUnselect (const TEveCaloData::CellId_t &)
 
 FWHGTowerSliceSelector (const FWEventItem *i, TEveCaloDataVec *data)
 
virtual ~FWHGTowerSliceSelector ()
 
- Public Member Functions inherited from FWFromSliceSelector
FWModelChangeManagerchangeManager () const
 
void clear ()
 
 FWFromSliceSelector (const FWEventItem *)
 
void reset ()
 
virtual ~FWFromSliceSelector ()
 

Private Member Functions

bool findBinFromId (HGCalDetId &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 31 of file FWHGTowerSliceSelector.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file FWHGTowerSliceSelector.h.

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

Definition at line 37 of file FWHGTowerSliceSelector.h.

References doSelect(), doUnselect(), and findBinFromId().

37 {}

Member Function Documentation

void FWHGTowerSliceSelector::doSelect ( const TEveCaloData::CellId_t &  iCell)
virtual

Reimplemented from FWFromSliceSelector.

Definition at line 34 of file FWHGTowerSliceSelector.cc.

References edm::SortedCollection< T, SORT >::begin(), FWEventItem::changeManager(), edm::SortedCollection< T, SORT >::end(), findBinFromId(), FWEventItem::get(), hfClusterShapes_cfi::hits, hcalTTPDigis_cfi::id, diffTreeTool::index, FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWEventItem::ModelInfo::m_displayProperties, FWFromSliceSelector::m_item, FWEventItem::modelInfo(), and FWEventItem::select().

Referenced by ~FWHGTowerSliceSelector().

35 {
36  if (!m_item) return;
37 
38  const HGCRecHitCollection* hits=0;
39  m_item->get(hits);
40  assert(0!=hits);
41 
42  int index = 0;
43  FWChangeSentry sentry(*(m_item->changeManager()));
44  for(HGCRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index)
45  {
46  HGCalDetId id ((*it).detid().rawId());
47  if (findBinFromId(id, iCell.fTower) &&
49  !m_item->modelInfo(index).isSelected()) {
50  // std::cout <<" doSelect "<<index<<std::endl;
51  m_item->select(index);
52  }
53  }
54 }
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:132
bool isSelected() const
Definition: FWEventItem.h:71
bool findBinFromId(HGCalDetId &id, int tower) const
void get(const T *&oData) const
Definition: FWEventItem.h:85
std::vector< HGCRecHit >::const_iterator const_iterator
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
const_iterator end() const
void select(int iIndex) const
Definition: FWEventItem.cc:252
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const_iterator begin() const
void FWHGTowerSliceSelector::doUnselect ( const TEveCaloData::CellId_t &  iCell)
virtual

Reimplemented from FWFromSliceSelector.

Definition at line 57 of file FWHGTowerSliceSelector.cc.

References edm::SortedCollection< T, SORT >::begin(), FWEventItem::changeManager(), edm::SortedCollection< T, SORT >::end(), findBinFromId(), FWEventItem::get(), hfClusterShapes_cfi::hits, hcalTTPDigis_cfi::id, diffTreeTool::index, FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWEventItem::ModelInfo::m_displayProperties, FWFromSliceSelector::m_item, FWEventItem::modelInfo(), and FWEventItem::unselect().

Referenced by ~FWHGTowerSliceSelector().

58 {
59  if (!m_item) return;
60 
61  const HGCRecHitCollection* hits=0;
62  m_item->get(hits);
63  assert(0!=hits);
64 
65  int index = 0;
66  FWChangeSentry sentry(*(m_item->changeManager()));
67  for(HGCRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index)
68  {
69  HGCalDetId id ((*it).detid().rawId());
70  if (findBinFromId(id, iCell.fTower) &&
72  m_item->modelInfo(index).isSelected()) {
73  // std::cout <<" doUnselect "<<index<<std::endl;
74  m_item->unselect(index);
75  }
76  }
77 }
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:132
bool isSelected() const
Definition: FWEventItem.h:71
bool findBinFromId(HGCalDetId &id, int tower) const
void get(const T *&oData) const
Definition: FWEventItem.h:85
std::vector< HGCRecHit >::const_iterator const_iterator
void unselect(int iIndex) const
Definition: FWEventItem.cc:241
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
const_iterator end() const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const_iterator begin() const
bool FWHGTowerSliceSelector::findBinFromId ( HGCalDetId id,
int  tower 
) const
private

Definition at line 80 of file FWHGTowerSliceSelector.cc.

References stringResolutionProvider_cfi::eta, fwLog, FWGeometry::getCorners(), FWEventItem::getGeom(), mps_fire::i, fwlog::kInfo, FWFromSliceSelector::m_item, m_vecData, phi, and DetId::rawId().

Referenced by doSelect(), doUnselect(), and ~FWHGTowerSliceSelector().

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

Member Data Documentation

TEveCaloDataVec* FWHGTowerSliceSelector::m_vecData
private

Definition at line 44 of file FWHGTowerSliceSelector.h.

Referenced by findBinFromId().