CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
FWHistSliceSelector Class Referenceabstract

#include <FWHistSliceSelector.h>

Inheritance diagram for FWHistSliceSelector:
FWFromSliceSelector FWCaloTowerSliceSelector FWCandidateTowerSliceSelector FWHGCalMultiClusterSliceSelector FWPFCandidateTowerSliceSelector

Public Member Functions

virtual bool aggregatePhiCells () const
 
void doSelect (const TEveCaloData::CellId_t &) override
 
void doUnselect (const TEveCaloData::CellId_t &) override
 
 FWHistSliceSelector (TH2F *h, const FWEventItem *item)
 
 ~FWHistSliceSelector () override
 
- Public Member Functions inherited from FWFromSliceSelector
FWModelChangeManagerchangeManager () const
 
void clear ()
 
 FWFromSliceSelector (const FWEventItem *)
 
void reset ()
 
virtual ~FWFromSliceSelector ()
 

Protected Member Functions

virtual void getItemEntryEtaPhi (int itemIdx, float &eta, float &phi) const =0
 
bool matchCell (const TEveCaloData::CellId_t &iCell, int idx) const
 

Protected Attributes

TH2F * m_hist
 
- Protected Attributes inherited from FWFromSliceSelector
const FWEventItemm_item
 

Detailed Description

Definition at line 7 of file FWHistSliceSelector.h.

Constructor & Destructor Documentation

◆ FWHistSliceSelector()

FWHistSliceSelector::FWHistSliceSelector ( TH2F *  h,
const FWEventItem item 
)

Definition at line 10 of file FWHistSliceSelector.cc.

References h, and m_hist.

◆ ~FWHistSliceSelector()

FWHistSliceSelector::~FWHistSliceSelector ( )
override

Definition at line 12 of file FWHistSliceSelector.cc.

12 {}

Member Function Documentation

◆ aggregatePhiCells()

virtual bool FWHistSliceSelector::aggregatePhiCells ( ) const
inlinevirtual

Reimplemented in FWCandidateTowerSliceSelector, and FWPFCandidateTowerSliceSelector.

Definition at line 15 of file FWHistSliceSelector.h.

15 { return true; }

Referenced by FWCaloDataHistProxyBuilder::addEntryToTEveCaloData(), and matchCell().

◆ doSelect()

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

◆ doUnselect()

void FWHistSliceSelector::doUnselect ( const TEveCaloData::CellId_t &  iCell)
overridevirtual

Reimplemented from FWFromSliceSelector.

Definition at line 74 of file FWHistSliceSelector.cc.

74  {
75  if (!m_item)
76  return;
77 
78  // std::cout <<" doUnselect "<<std::endl;
79 
80  FWChangeSentry sentry(*(m_item->changeManager()));
81 
82  size_t size = m_item->size();
83  for (size_t index = 0; index < size; ++index) {
85  if (matchCell(iCell, index)) {
86  // std::cout <<" doUnselect "<<index<<std::endl;
88  break;
89  }
90  }
91  }
92 }

References FWEventItem::changeManager(), FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWEventItem::ModelInfo::m_displayProperties, FWFromSliceSelector::m_item, matchCell(), FWEventItem::modelInfo(), FWEventItem::size(), findQualityFiles::size, and FWEventItem::unselect().

◆ getItemEntryEtaPhi()

virtual void FWHistSliceSelector::getItemEntryEtaPhi ( int  itemIdx,
float &  eta,
float &  phi 
) const
protectedpure virtual

◆ matchCell()

bool FWHistSliceSelector::matchCell ( const TEveCaloData::CellId_t &  iCell,
int  idx 
) const
protected

Definition at line 14 of file FWHistSliceSelector.cc.

14  {
15  float eta, phi;
16  getItemEntryEtaPhi(itemIdx, eta, phi);
17 
18  int idx = m_hist->FindBin(eta, phi);
19  int nBinsX = m_hist->GetXaxis()->GetNbins() + 2;
20 
21  int etaBin, phiBin, w, newPhiBin;
22  m_hist->GetBinXYZ(idx, etaBin, phiBin, w);
23 
24  if (aggregatePhiCells()) {
25  bool match = false;
26  if (TMath::Abs(eta) > 4.716) {
27  newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
28  if (newPhiBin <= 0)
29  newPhiBin = 71;
30 
31  idx = etaBin + newPhiBin * nBinsX;
32  match |= (idx == iCell.fTower);
33 
34  idx += nBinsX;
35  match |= (idx == iCell.fTower);
36 
37  idx += nBinsX;
38  if (newPhiBin == 71)
39  idx = etaBin + 1 * nBinsX;
40  match |= (idx == iCell.fTower);
41 
42  idx += nBinsX;
43  match |= (idx == iCell.fTower);
44  } else if (TMath::Abs(eta) > 1.873) {
45  newPhiBin = ((phiBin + 1) / 2) * 2 - 1;
46  idx = etaBin + newPhiBin * nBinsX;
47  match = (idx == iCell.fTower || idx + nBinsX == iCell.fTower);
48  } else {
49  match = (idx == iCell.fTower);
50  }
51 
52  return match;
53  } else {
54  return idx == iCell.fTower;
55  }
56 }

References Abs(), aggregatePhiCells(), PVValHelper::eta, etaBin(), getItemEntryEtaPhi(), charmTagsComputerCvsB_cfi::idx, m_hist, match(), phi, BeamMonitor_cff::phiBin, and w.

Referenced by doSelect(), and doUnselect().

Member Data Documentation

◆ m_hist

TH2F* FWHistSliceSelector::m_hist
protected

Definition at line 21 of file FWHistSliceSelector.h.

Referenced by FWHistSliceSelector(), and matchCell().

FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
FWDisplayProperties::isVisible
bool isVisible() const
Definition: FWDisplayProperties.h:51
etaBin
int etaBin(const l1t::HGCalMulticluster *cl)
Definition: L1EGammaEEProducer.cc:19
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:75
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
FWEventItem::select
void select(int iIndex) const
Definition: FWEventItem.cc:224
FWEventItem::changeManager
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:123
Abs
T Abs(T a)
Definition: MathUtil.h:49
PVValHelper::eta
Definition: PVValidationHelpers.h:69
w
const double w
Definition: UKUtility.cc:23
FWChangeSentry
Definition: FWModelChangeManager.h:68
FWHistSliceSelector::m_hist
TH2F * m_hist
Definition: FWHistSliceSelector.h:21
FWEventItem::unselect
void unselect(int iIndex) const
Definition: FWEventItem.cc:215
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
FWEventItem::ModelInfo::isSelected
bool isSelected() const
Definition: FWEventItem.h:65
FWFromSliceSelector::m_item
const FWEventItem * m_item
Definition: FWFromSliceSelector.h:49
FWHistSliceSelector::aggregatePhiCells
virtual bool aggregatePhiCells() const
Definition: FWHistSliceSelector.h:15
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
FWHistSliceSelector::getItemEntryEtaPhi
virtual void getItemEntryEtaPhi(int itemIdx, float &eta, float &phi) const =0
DDAxes::phi
FWHistSliceSelector::matchCell
bool matchCell(const TEveCaloData::CellId_t &iCell, int idx) const
Definition: FWHistSliceSelector.cc:14
FWEventItem::ModelInfo::m_displayProperties
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:59
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
FWFromSliceSelector::FWFromSliceSelector
FWFromSliceSelector(const FWEventItem *)
Definition: FWFromSliceSelector.cc:30
FWEventItem::size
size_t size() const
Definition: FWEventItem.cc:457
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443