CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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

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

FWFromSliceSelector(const FWEventItem *)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FWHFTowerSliceSelector::~FWHFTowerSliceSelector ( )
inlineoverride

Definition at line 35 of file FWHFTowerSliceSelector.h.

35 {}

Member Function Documentation

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

Reimplemented from FWFromSliceSelector.

Definition at line 32 of file FWHFTowerSliceSelector.cc.

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

32  {
33  if (!m_item)
34  return;
35 
36  const HFRecHitCollection* hits = nullptr;
37  m_item->get(hits);
38  assert(nullptr != hits);
39 
40  int index = 0;
41  FWChangeSentry sentry(*(m_item->changeManager()));
42  for (HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it, ++index) {
43  HcalDetId id((*it).detid().rawId());
44  if (findBinFromId(id, iCell.fTower) && m_item->modelInfo(index).m_displayProperties.isVisible() &&
45  !m_item->modelInfo(index).isSelected()) {
46  // std::cout <<" doSelect "<<index<<std::endl;
47  m_item->select(index);
48  }
49  }
50 }
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:123
uint16_t *__restrict__ id
bool isSelected() const
Definition: FWEventItem.h:65
void get(const T *&oData) const
Definition: FWEventItem.h:78
std::vector< T >::const_iterator const_iterator
assert(be >=bs)
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:59
const_iterator end() const
bool findBinFromId(HcalDetId &id, int tower) const
void select(int iIndex) const
Definition: FWEventItem.cc:224
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
const_iterator begin() const
void FWHFTowerSliceSelector::doUnselect ( const TEveCaloData::CellId_t &  iCell)
overridevirtual

Reimplemented from FWFromSliceSelector.

Definition at line 52 of file FWHFTowerSliceSelector.cc.

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

52  {
53  if (!m_item)
54  return;
55 
56  const HFRecHitCollection* hits = nullptr;
57  m_item->get(hits);
58  assert(nullptr != hits);
59 
60  int index = 0;
61  FWChangeSentry sentry(*(m_item->changeManager()));
62  for (HFRecHitCollection::const_iterator it = hits->begin(); it != hits->end(); ++it, ++index) {
63  HcalDetId id((*it).detid().rawId());
64  if (findBinFromId(id, iCell.fTower) && m_item->modelInfo(index).m_displayProperties.isVisible() &&
65  m_item->modelInfo(index).isSelected()) {
66  // std::cout <<" doUnselect "<<index<<std::endl;
67  m_item->unselect(index);
68  }
69  }
70 }
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:123
uint16_t *__restrict__ id
bool isSelected() const
Definition: FWEventItem.h:65
void get(const T *&oData) const
Definition: FWEventItem.h:78
std::vector< T >::const_iterator const_iterator
void unselect(int iIndex) const
Definition: FWEventItem.cc:215
assert(be >=bs)
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:59
const_iterator end() const
bool findBinFromId(HcalDetId &id, int tower) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
const_iterator begin() const
bool FWHFTowerSliceSelector::findBinFromId ( HcalDetId id,
int  tower 
) const
private

Definition at line 72 of file FWHFTowerSliceSelector.cc.

References PVValHelper::eta, fwLog, FWGeometry::getCorners(), FWEventItem::getGeom(), mps_fire::i, dqmiolumiharvest::j, fwlog::kInfo, FWFromSliceSelector::m_item, m_vecData, phi, DetId::rawId(), and hgcalTowerProducer_cfi::tower.

Referenced by doSelect(), and doUnselect().

72  {
73  TEveCaloData::vCellId_t cellIds;
74  const float* corners = m_item->getGeom()->getCorners(detId.rawId());
75  if (corners == nullptr) {
76  fwLog(fwlog::kInfo) << "FWHFTowerSliceSelector cannot get geometry for DetId: " << detId.rawId() << ". Ignored.\n";
77  return false;
78  }
79  std::vector<TEveVector> front(4);
80  float eta = 0, phi = 0;
81  int j = 0;
82  for (int i = 0; i < 4; ++i) {
83  front[i] = TEveVector(corners[j], corners[j + 1], corners[j + 2]);
84  j += 3;
85 
86  eta += front[i].Eta();
87  phi += front[i].Phi();
88  }
89  eta /= 4;
90  phi /= 4;
91 
92  const TEveCaloData::CellGeom_t& cg = m_vecData->GetCellGeom()[tower];
93  if ((eta >= cg.fEtaMin && eta <= cg.fEtaMax) && (phi >= cg.fPhiMin && phi <= cg.fPhiMax)) {
94  return true;
95  }
96 
97  return false;
98 }
const FWEventItem * m_item
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:461
#define fwLog(_level_)
Definition: fwLog.h:45
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548

Member Data Documentation

TEveCaloDataVec* FWHFTowerSliceSelector::m_vecData
private

Definition at line 42 of file FWHFTowerSliceSelector.h.

Referenced by findBinFromId().