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 FWPFCandidateTowerSliceSelector

Public Member Functions

virtual bool aggregatePhiCells () const
 
virtual void doSelect (const TEveCaloData::CellId_t &)
 
virtual void doUnselect (const TEveCaloData::CellId_t &)
 
 FWHistSliceSelector (TH2F *h, const FWEventItem *item)
 
virtual ~FWHistSliceSelector ()
 
- 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 ( TH2F *  h,
const FWEventItem item 
)

Definition at line 10 of file FWHistSliceSelector.cc.

References h, and m_hist.

10  :
12 {
13  m_hist = h;
14 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
FWFromSliceSelector(const FWEventItem *)
FWHistSliceSelector::~FWHistSliceSelector ( )
virtual

Definition at line 17 of file FWHistSliceSelector.cc.

18 {}

Member Function Documentation

virtual bool FWHistSliceSelector::aggregatePhiCells ( ) const
inlinevirtual
void FWHistSliceSelector::doSelect ( const TEveCaloData::CellId_t &  iCell)
virtual

Reimplemented from FWFromSliceSelector.

Definition at line 73 of file FWHistSliceSelector.cc.

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

74 {
75  if (!m_item) return;
76 
77  FWChangeSentry sentry(*(m_item->changeManager()));
78  size_t size = m_item->size();
79  for (size_t index =0; index < size; ++index)
80  {
82  {
83  if (matchCell(iCell, index))
84  {
86  break;
87  }
88  }
89  }
90 }
size
Write out results.
bool matchCell(const TEveCaloData::CellId_t &iCell, int idx) const
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:132
bool isSelected() const
Definition: FWEventItem.h:71
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
size_t size() const
Definition: FWEventItem.cc:550
void select(int iIndex) const
Definition: FWEventItem.cc:252
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
void FWHistSliceSelector::doUnselect ( const TEveCaloData::CellId_t &  iCell)
virtual

Reimplemented from FWFromSliceSelector.

Definition at line 93 of file FWHistSliceSelector.cc.

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

94 {
95  if (!m_item) return;
96 
97  // std::cout <<" doUnselect "<<std::endl;
98 
99  FWChangeSentry sentry(*(m_item->changeManager()));
100 
101  size_t size = m_item->size();
102  for (size_t index =0; index < size; ++index)
103  {
106  if (matchCell(iCell, index))
107  {
108  // std::cout <<" doUnselect "<<index<<std::endl;
110  break;
111  }
112  }
113  }
114 }
size
Write out results.
bool matchCell(const TEveCaloData::CellId_t &iCell, int idx) const
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:132
bool isSelected() const
Definition: FWEventItem.h:71
void unselect(int iIndex) const
Definition: FWEventItem.cc:241
const FWEventItem * m_item
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:61
size_t size() const
Definition: FWEventItem.cc:550
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
virtual void FWHistSliceSelector::getItemEntryEtaPhi ( int  itemIdx,
float &  eta,
float &  phi 
) const
protectedpure virtual
bool FWHistSliceSelector::matchCell ( const TEveCaloData::CellId_t &  iCell,
int  idx 
) const
protected

Definition at line 21 of file FWHistSliceSelector.cc.

References Abs(), aggregatePhiCells(), stringResolutionProvider_cfi::eta, conversionPostprocessing_cfi::etaBin, getItemEntryEtaPhi(), training_settings::idx, m_hist, match(), phi, conversionPostprocessing_cfi::phiBin, and w.

Referenced by aggregatePhiCells(), doSelect(), and doUnselect().

22 {
23  float eta, phi;
24  getItemEntryEtaPhi(itemIdx, eta, phi);
25 
26  int idx = m_hist->FindBin(eta, phi);
27  int nBinsX = m_hist->GetXaxis()->GetNbins() + 2;
28 
29  int etaBin, phiBin, w, newPhiBin;
30  m_hist->GetBinXYZ(idx, etaBin, phiBin, w);
31 
32  if (aggregatePhiCells()) {
33  bool match= false;
34  if (TMath::Abs(eta) > 4.716)
35  {
36  newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
37  if (newPhiBin <= 0) newPhiBin = 71;
38 
39  idx = etaBin + newPhiBin*nBinsX;
40  match |= (idx == iCell.fTower);
41 
42  idx += nBinsX;
43  match |= (idx == iCell.fTower);
44 
45  idx += nBinsX;
46  if (newPhiBin == 71)
47  idx = etaBin + 1*nBinsX;
48  match |= (idx == iCell.fTower);
49 
50  idx += nBinsX;
51  match |= (idx == iCell.fTower);
52  }
53  else if (TMath::Abs(eta) > 1.873)
54  {
55  newPhiBin = ((phiBin + 1) / 2) * 2 -1;
56  idx = etaBin + newPhiBin*nBinsX;
57  match = ( idx == iCell.fTower || idx + nBinsX == iCell.fTower);
58  }
59  else
60  {
61  match = ( idx == iCell.fTower);
62  }
63 
64  return match;
65  }
66  else
67  {
68  return idx == iCell.fTower;
69  }
70 }
virtual void getItemEntryEtaPhi(int itemIdx, float &eta, float &phi) const =0
const double w
Definition: UKUtility.cc:23
T Abs(T a)
Definition: MathUtil.h:49
virtual bool aggregatePhiCells() const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

Member Data Documentation

TH2F* FWHistSliceSelector::m_hist
protected

Definition at line 22 of file FWHistSliceSelector.h.

Referenced by FWHistSliceSelector(), and matchCell().