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 31 of file FWHFTowerSliceSelector.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file FWHFTowerSliceSelector.h.

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

Definition at line 37 of file FWHFTowerSliceSelector.h.

37 {}

Member Function Documentation

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

Reimplemented from FWFromSliceSelector.

Definition at line 34 of file FWHFTowerSliceSelector.cc.

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

35 {
36  if (!m_item) return;
37 
38  const HFRecHitCollection* hits=0;
39  m_item->get(hits);
40  assert(0!=hits);
41 
42  int index = 0;
43  FWChangeSentry sentry(*(m_item->changeManager()));
44  for(HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index)
45  {
46  HcalDetId 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:130
bool isSelected() const
Definition: FWEventItem.h:70
void get(const T *&oData) const
Definition: FWEventItem.h:84
std::vector< HFRecHit >::const_iterator const_iterator
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:60
const_iterator end() const
bool findBinFromId(HcalDetId &id, int tower) const
void select(int iIndex) const
Definition: FWEventItem.cc:250
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 57 of file FWHFTowerSliceSelector.cc.

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

58 {
59  if (!m_item) return;
60 
61  const HFRecHitCollection* hits=0;
62  m_item->get(hits);
63  assert(0!=hits);
64 
65  int index = 0;
66  FWChangeSentry sentry(*(m_item->changeManager()));
67  for(HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it,++index)
68  {
69  HcalDetId 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:130
bool isSelected() const
Definition: FWEventItem.h:70
void get(const T *&oData) const
Definition: FWEventItem.h:84
std::vector< HFRecHit >::const_iterator const_iterator
void unselect(int iIndex) const
Definition: FWEventItem.cc:239
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:60
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 80 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().

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 ) << "FWHFTowerSliceSelector 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 }
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:277
#define fwLog(_level_)
Definition: fwLog.h:50
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
Definition: DDAxes.h:10

Member Data Documentation

TEveCaloDataVec* FWHFTowerSliceSelector::m_vecData
private

Definition at line 44 of file FWHFTowerSliceSelector.h.

Referenced by findBinFromId().