CMS 3D CMS Logo

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

void doSelect (const TEveCaloData::CellId_t &) override
 
void doUnselect (const TEveCaloData::CellId_t &) override
 
 FWHFTowerSliceSelector (const FWEventItem *i, TEveCaloDataVec *data)
 
 ~FWHFTowerSliceSelector () override
 
- 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
FWHFTowerSliceSelector::~FWHFTowerSliceSelector ( )
inlineoverride

Definition at line 37 of file FWHFTowerSliceSelector.h.

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

37 {}

Member Function Documentation

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

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

Referenced by ~FWHFTowerSliceSelector().

35 {
36  if (!m_item) return;
37 
38  const HFRecHitCollection* hits=nullptr;
39  m_item->get(hits);
40  assert(nullptr!=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:132
bool isSelected() const
Definition: FWEventItem.h:71
void get(const T *&oData) const
Definition: FWEventItem.h:85
std::vector< HFRecHit >::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:252
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const_iterator begin() const
void FWHFTowerSliceSelector::doUnselect ( const TEveCaloData::CellId_t &  iCell)
overridevirtual

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(), hfClusterShapes_cfi::hits, triggerObjects_cff::id, FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWEventItem::ModelInfo::m_displayProperties, FWFromSliceSelector::m_item, FWEventItem::modelInfo(), and FWEventItem::unselect().

Referenced by ~FWHFTowerSliceSelector().

58 {
59  if (!m_item) return;
60 
61  const HFRecHitCollection* hits=nullptr;
62  m_item->get(hits);
63  assert(nullptr!=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:132
bool isSelected() const
Definition: FWEventItem.h:71
void get(const T *&oData) const
Definition: FWEventItem.h:85
std::vector< HFRecHit >::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
bool findBinFromId(HcalDetId &id, int tower) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const_iterator begin() const
bool FWHFTowerSliceSelector::findBinFromId ( HcalDetId id,
int  tower 
) const
private

Definition at line 80 of file FWHFTowerSliceSelector.cc.

References PVValHelper::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 ~FWHFTowerSliceSelector().

81 {
82  TEveCaloData::vCellId_t cellIds;
83  const float* corners = m_item->getGeom()->getCorners( detId.rawId());
84  if( corners == nullptr )
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 }
const FWEventItem * m_item
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:297
#define fwLog(_level_)
Definition: fwLog.h:50
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683

Member Data Documentation

TEveCaloDataVec* FWHFTowerSliceSelector::m_vecData
private

Definition at line 44 of file FWHFTowerSliceSelector.h.

Referenced by findBinFromId().