CMS 3D CMS Logo

FWHFTowerSliceSelector.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Calo
4 // Class : FWHFTowerSliceSelector
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Alja Mrak-Tadel
10 // Created: Wed Jun 2 17:39:44 CEST 2010
11 //
12 
13 // system include files
14 
15 // user include files
16 #include "TEveVector.h"
17 #include "TEveCaloData.h"
18 #include "TH2F.h"
19 
27 
28 //
29 // member functions
30 //
31 
32 void FWHFTowerSliceSelector::doSelect(const TEveCaloData::CellId_t& iCell) {
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() &&
46  // std::cout <<" doSelect "<<index<<std::endl;
48  }
49  }
50 }
51 
52 void FWHFTowerSliceSelector::doUnselect(const TEveCaloData::CellId_t& iCell) {
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() &&
66  // std::cout <<" doUnselect "<<index<<std::endl;
68  }
69  }
70 }
71 
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 }
FWModelChangeManager.h
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
FWDisplayProperties::isVisible
bool isVisible() const
Definition: FWDisplayProperties.h:51
mps_fire.i
i
Definition: mps_fire.py:355
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
FWGeometry::getCorners
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:464
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
FWEventItem::get
void get(const T *&oData) const
Definition: FWEventItem.h:78
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
cms::cuda::assert
assert(be >=bs)
edm::SortedCollection
Definition: SortedCollection.h:49
FWEventItem::select
void select(int iIndex) const
Definition: FWEventItem.cc:224
FWEventItem::changeManager
FWModelChangeManager * changeManager() const
Definition: FWEventItem.h:123
FWHFTowerSliceSelector::findBinFromId
bool findBinFromId(HcalDetId &id, int tower) const
Definition: FWHFTowerSliceSelector.cc:72
HFRecHit.h
PVValHelper::eta
Definition: PVValidationHelpers.h:69
FWChangeSentry
Definition: FWModelChangeManager.h:68
FWGeometry.h
FWEventItem::unselect
void unselect(int iIndex) const
Definition: FWEventItem.cc:215
FWEventItem::ModelInfo::isSelected
bool isSelected() const
Definition: FWEventItem.h:65
HcalDetId
Definition: HcalDetId.h:12
FWFromSliceSelector::m_item
const FWEventItem * m_item
Definition: FWFromSliceSelector.h:49
fwLog.h
FWEventItem.h
FWHFTowerSliceSelector::doUnselect
void doUnselect(const TEveCaloData::CellId_t &) override
Definition: FWHFTowerSliceSelector.cc:52
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
DDAxes::phi
fwlog::kInfo
Definition: fwLog.h:35
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
FWHFTowerSliceSelector::m_vecData
TEveCaloDataVec * m_vecData
Definition: FWHFTowerSliceSelector.h:42
FWEventItem::ModelInfo::m_displayProperties
FWDisplayProperties m_displayProperties
Definition: FWEventItem.h:59
FWHFTowerSliceSelector.h
FWHFTowerSliceSelector::doSelect
void doSelect(const TEveCaloData::CellId_t &) override
Definition: FWHFTowerSliceSelector.cc:32
HcalRecHitCollections.h
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66