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
FWCaloTowerSliceSelector Class Reference

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

Inheritance diagram for FWCaloTowerSliceSelector:
FWFromSliceSelector

Public Member Functions

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

Private Member Functions

bool matchCell (const TEveCaloData::CellId_t &iCell, const CaloTower &tower) const
 

Private Attributes

TH2F * m_hist
 

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 FWCaloTowerSliceSelector.h.

Constructor & Destructor Documentation

FWCaloTowerSliceSelector::FWCaloTowerSliceSelector ( TH2F *  h,
const FWEventItem i 
)

Definition at line 26 of file FWCaloTowerSliceSelector.cc.

26  :
28  m_hist(h)
29 {
30 }
FWFromSliceSelector(const FWEventItem *)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
FWCaloTowerSliceSelector::~FWCaloTowerSliceSelector ( )
virtual

Definition at line 32 of file FWCaloTowerSliceSelector.cc.

33 {
34 }

Member Function Documentation

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

Reimplemented from FWFromSliceSelector.

Definition at line 84 of file FWCaloTowerSliceSelector.cc.

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

85 {
86  if (!m_item) return;
87 
88  const CaloTowerCollection* towers=0;
89  m_item->get(towers);
90  assert(0!=towers);
91  int index = 0;
92 
93  FWChangeSentry sentry(*(m_item->changeManager()));
94  for(CaloTowerCollection::const_iterator tower = towers->begin(); tower != towers->end(); ++tower,++index)
95  {
97  {
98  if (matchCell(iCell, *tower))
99  {
100  m_item->select(index);
101  break;
102  }
103  }
104  }
105 }
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< CaloTower >::const_iterator const_iterator
const FWEventItem * m_item
bool matchCell(const TEveCaloData::CellId_t &iCell, const CaloTower &tower) const
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
const_iterator end() const
void select(int iIndex) const
Definition: FWEventItem.cc:251
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
const_iterator begin() const
void FWCaloTowerSliceSelector::doUnselect ( const TEveCaloData::CellId_t &  iCell)
virtual

Reimplemented from FWFromSliceSelector.

Definition at line 108 of file FWCaloTowerSliceSelector.cc.

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

109 {
110  if (!m_item) return;
111 
112  // std::cout <<" doUnselect "<<std::endl;
113 
114  const CaloTowerCollection* towers=0;
115  m_item->get(towers);
116  assert(0!=towers);
117  int index = 0;
118  FWChangeSentry sentry(*(m_item->changeManager()));
119  for(CaloTowerCollection::const_iterator tower = towers->begin(); tower != towers->end(); ++tower,++index)
120  {
122  m_item->modelInfo(index).isSelected()) {
123  if (matchCell(iCell, *tower))
124  {
125  // std::cout <<" doUnselect "<<index<<std::endl;
126  m_item->unselect(index);
127  break;
128  }
129  }
130  }
131 }
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< CaloTower >::const_iterator const_iterator
void unselect(int iIndex) const
Definition: FWEventItem.cc:240
const FWEventItem * m_item
bool matchCell(const TEveCaloData::CellId_t &iCell, const CaloTower &tower) const
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
const_iterator end() const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
const_iterator begin() const
bool FWCaloTowerSliceSelector::matchCell ( const TEveCaloData::CellId_t &  iCell,
const CaloTower tower 
) const
private

Definition at line 42 of file FWCaloTowerSliceSelector.cc.

References reco::LeafCandidate::eta(), CaloTower::ietaAbs(), m_hist, match(), reco::LeafCandidate::phi(), and w().

Referenced by doSelect(), and doUnselect().

43 {
44  bool match = false;
45  int idx = m_hist->FindBin(tower.eta(), tower.phi());
46  int nBinsX = m_hist->GetXaxis()->GetNbins() + 2;
47 
48  int etaBin, phiBin, w, newPhiBin;
49  m_hist->GetBinXYZ(idx, etaBin, phiBin, w);
50 
51  if (tower.ietaAbs() > 39)
52  {
53  newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
54  if (newPhiBin <= 0) newPhiBin = 71;
55 
56  idx = etaBin + newPhiBin*nBinsX;
57  match |= (idx == iCell.fTower);
58 
59  idx += nBinsX;
60  match |= (idx == iCell.fTower);
61 
62  idx += nBinsX;
63  if (newPhiBin == 71)
64  idx = etaBin + 1*nBinsX;
65  match |= (idx == iCell.fTower);
66 
67  idx += nBinsX;
68  match |= (idx == iCell.fTower);
69  }
70  else if (tower.ietaAbs() > 20)
71  {
72  newPhiBin = ((phiBin + 1) / 2) * 2 -1;
73  idx = etaBin + newPhiBin*nBinsX;
74  match = ( idx == iCell.fTower || idx + nBinsX == iCell.fTower);
75  }
76  else
77  {
78  match = ( idx == iCell.fTower);
79  }
80  return match;
81 }
virtual double eta() const
momentum pseudorapidity
int ietaAbs() const
Definition: CaloTower.h:155
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
virtual double phi() const
momentum azimuthal angle
T w() const

Member Data Documentation

TH2F* FWCaloTowerSliceSelector::m_hist
private

Definition at line 41 of file FWCaloTowerSliceSelector.h.

Referenced by matchCell().