CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //
25 // static data member definitions
26 //
27 
28 //
29 // constructors and destructor
30 //
32 m_data(iData),
33 m_changeManager(0)
34 {
35  // reserve 3 , first slice is background
36  m_sliceSelectors.reserve(3);
37  m_sliceSelectors.push_back(new FWFromSliceSelector(0));
38 }
39 
40 // FWFromTEveCaloDataSelector::FWFromTEveCaloDataSelector(const FWFromTEveCaloDataSelector& rhs)
41 // {
42 // // do actual copying here;
43 // }
44 
46 {
47  for (std::vector<FWFromSliceSelector*>::iterator i = m_sliceSelectors.begin(); i != m_sliceSelectors.end(); ++i)
48  {
49  delete *i;
50  }
51  m_sliceSelectors.clear();
52 }
53 
54 //
55 // assignment operators
56 //
57 // const FWFromTEveCaloDataSelector& FWFromTEveCaloDataSelector::operator=(const FWFromTEveCaloDataSelector& rhs)
58 // {
59 // //An exception safe implementation is
60 // FWFromTEveCaloDataSelector temp(rhs);
61 // swap(rhs);
62 //
63 // return *this;
64 // }
65 
66 //
67 // member functions
68 //
69 void
71 {
74  std::for_each(m_sliceSelectors.begin(),
75  m_sliceSelectors.end(),
76  boost::bind(&FWFromSliceSelector::clear,_1));
77  const TEveCaloData::vCellId_t& cellIds = m_data->GetCellsSelected();
78  for(TEveCaloData::vCellId_t::const_iterator it = cellIds.begin(),itEnd=cellIds.end();
79  it != itEnd;
80  ++it) {
81  assert(it->fSlice < static_cast<int>(m_sliceSelectors.size()));
82  m_sliceSelectors[it->fSlice]->doSelect(*it);
83  }
84 }
85 
86 void
88 {
90  //std::cout <<"FWFromTEveCaloDataSelector::doUnselect()"<<std::endl;
91 
93  const TEveCaloData::vCellId_t& cellIds = m_data->GetCellsSelected();
94  for(TEveCaloData::vCellId_t::const_iterator it = cellIds.begin(),itEnd=cellIds.end();
95  it != itEnd;
96  ++it) {
97  assert(it->fSlice < static_cast<int>(m_sliceSelectors.size()));
98  m_sliceSelectors[it->fSlice]->doUnselect(*it);
99  }
100 }
101 
102 void
104 {
105  assert(iSlice>0 && (iSlice <= static_cast<int>(m_sliceSelectors.size())));
106 
107  if(0==m_changeManager) {
108  m_changeManager = iSelector->changeManager();
109  }
110 
111  if(iSlice ==static_cast<int>(m_sliceSelectors.size())) {
112  m_sliceSelectors.push_back(iSelector);
113  } else {
114  assert(iSlice<static_cast<int>(m_sliceSelectors.size()));
115  m_sliceSelectors[iSlice]=iSelector;
116  }
117 }
118 
119 void
121 {
122  m_sliceSelectors[iSlice]->reset();
123 }
124 //
125 // const member functions
126 //
127 
128 //
129 // static member functions
130 //
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
void addSliceSelector(int iSlice, FWFromSliceSelector *)
FWModelChangeManager * m_changeManager
FWModelChangeManager * changeManager() const
std::vector< FWFromSliceSelector * > m_sliceSelectors