test
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 30 of file FWCaloTowerSliceSelector.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file FWCaloTowerSliceSelector.cc.

25  :
27  m_hist(h)
28 {
29 }
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 31 of file FWCaloTowerSliceSelector.cc.

32 {
33 }

Member Function Documentation

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

Reimplemented from FWFromSliceSelector.

Definition at line 83 of file FWCaloTowerSliceSelector.cc.

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

84 {
85  if (!m_item) return;
86 
87  const CaloTowerCollection* towers=0;
88  m_item->get(towers);
89  assert(0!=towers);
90  int index = 0;
91 
92  FWChangeSentry sentry(*(m_item->changeManager()));
93  for(CaloTowerCollection::const_iterator tower = towers->begin(); tower != towers->end(); ++tower,++index)
94  {
96  {
97  if (matchCell(iCell, *tower))
98  {
99  m_item->select(index);
100  break;
101  }
102  }
103  }
104 }
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< 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:60
const_iterator end() const
void select(int iIndex) const
Definition: FWEventItem.cc:250
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 107 of file FWCaloTowerSliceSelector.cc.

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

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

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

Referenced by doSelect(), and doUnselect().

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

Member Data Documentation

TH2F* FWCaloTowerSliceSelector::m_hist
private

Definition at line 40 of file FWCaloTowerSliceSelector.h.

Referenced by matchCell().