CMS 3D CMS Logo

FWFromTEveCaloDataSelector.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Calo
4 // Class : FWFromTEveCaloDataSelector
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Fri Oct 23 14:44:33 CDT 2009
11 //
12 
13 // system include files
14 #include <boost/bind.hpp>
15 #include <algorithm>
16 #include <cassert>
17 
18 // user include files
22 
23 //
24 // static data member definitions
25 //
26 
27 //
28 // constructors and destructor
29 //
30 FWFromTEveCaloDataSelector::FWFromTEveCaloDataSelector(TEveCaloData* iData) : m_data(iData), m_changeManager(nullptr) {
31  // reserve 3 , first slice is background
32  m_sliceSelectors.reserve(3);
33  m_sliceSelectors.push_back(new FWFromSliceSelector(nullptr));
34 }
35 
36 // FWFromTEveCaloDataSelector::FWFromTEveCaloDataSelector(const FWFromTEveCaloDataSelector& rhs)
37 // {
38 // // do actual copying here;
39 // }
40 
42  for (std::vector<FWFromSliceSelector*>::iterator i = m_sliceSelectors.begin(); i != m_sliceSelectors.end(); ++i) {
43  delete *i;
44  }
45  m_sliceSelectors.clear();
46 }
47 
48 //
49 // assignment operators
50 //
51 // const FWFromTEveCaloDataSelector& FWFromTEveCaloDataSelector::operator=(const FWFromTEveCaloDataSelector& rhs)
52 // {
53 // //An exception safe implementation is
54 // FWFromTEveCaloDataSelector temp(rhs);
55 // swap(rhs);
56 //
57 // return *this;
58 // }
59 
60 //
61 // member functions
62 //
66  std::for_each(m_sliceSelectors.begin(), m_sliceSelectors.end(), boost::bind(&FWFromSliceSelector::clear, _1));
67  const TEveCaloData::vCellId_t& cellIds = m_data->GetCellsSelected();
68  for (TEveCaloData::vCellId_t::const_iterator it = cellIds.begin(), itEnd = cellIds.end(); it != itEnd; ++it) {
69  assert(it->fSlice < static_cast<int>(m_sliceSelectors.size()));
70  m_sliceSelectors[it->fSlice]->doSelect(*it);
71  }
72 }
73 
76  //std::cout <<"FWFromTEveCaloDataSelector::doUnselect()"<<std::endl;
77 
79  const TEveCaloData::vCellId_t& cellIds = m_data->GetCellsSelected();
80  for (TEveCaloData::vCellId_t::const_iterator it = cellIds.begin(), itEnd = cellIds.end(); it != itEnd; ++it) {
81  assert(it->fSlice < static_cast<int>(m_sliceSelectors.size()));
82  m_sliceSelectors[it->fSlice]->doUnselect(*it);
83  }
84 }
85 
87  assert(iSlice > 0 && (iSlice <= static_cast<int>(m_sliceSelectors.size())));
88 
89  if (nullptr == m_changeManager) {
90  m_changeManager = iSelector->changeManager();
91  }
92 
93  if (iSlice == static_cast<int>(m_sliceSelectors.size())) {
94  m_sliceSelectors.push_back(iSelector);
95  } else {
96  assert(iSlice < static_cast<int>(m_sliceSelectors.size()));
97  m_sliceSelectors[iSlice] = iSelector;
98  }
99 }
100 
102 //
103 // const member functions
104 //
105 
106 //
107 // static member functions
108 //
FWModelChangeManager.h
FWFromTEveCaloDataSelector::FWFromTEveCaloDataSelector
FWFromTEveCaloDataSelector(TEveCaloData *)
Definition: FWFromTEveCaloDataSelector.cc:30
mps_fire.i
i
Definition: mps_fire.py:355
FWFromTEveCaloDataSelector.h
cms::cuda::assert
assert(be >=bs)
FWFromSliceSelector::clear
void clear()
Definition: FWFromSliceSelector.cc:38
FWFromTEveCaloDataSelector::addSliceSelector
void addSliceSelector(int iSlice, FWFromSliceSelector *)
Definition: FWFromTEveCaloDataSelector.cc:86
FWChangeSentry
Definition: FWModelChangeManager.h:68
FWFromTEveCaloDataSelector::m_changeManager
FWModelChangeManager * m_changeManager
Definition: FWFromTEveCaloDataSelector.h:58
FWFromTEveCaloDataSelector::m_data
TEveCaloData * m_data
Definition: FWFromTEveCaloDataSelector.h:57
FWFromTEveCaloDataSelector::resetSliceSelector
void resetSliceSelector(int iSlice)
Definition: FWFromTEveCaloDataSelector.cc:101
FWFromTEveCaloDataSelector::doSelect
void doSelect() override
Definition: FWFromTEveCaloDataSelector.cc:63
FWFromSliceSelector
Definition: FWFromSliceSelector.h:30
FWFromTEveCaloDataSelector::m_sliceSelectors
std::vector< FWFromSliceSelector * > m_sliceSelectors
Definition: FWFromTEveCaloDataSelector.h:56
FWEventItem.h
FWFromSliceSelector::changeManager
FWModelChangeManager * changeManager() const
Definition: FWFromSliceSelector.cc:55
FWFromTEveCaloDataSelector::doUnselect
void doUnselect() override
Definition: FWFromTEveCaloDataSelector.cc:74
FWFromTEveCaloDataSelector::~FWFromTEveCaloDataSelector
~FWFromTEveCaloDataSelector() override
Definition: FWFromTEveCaloDataSelector.cc:41