CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWCollectionSummaryTableManager.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWCollectionSummaryTableManager
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Sun Feb 22 10:13:39 CST 2009
11 //
12 
13 // system include files
14 #include <sstream>
15 #include <boost/bind.hpp>
16 #include "TClass.h"
17 
18 // user include files
23 
24 //
25 // constants, enums and typedefs
26 //
27 
28 //
29 // static data member definitions
30 //
31 
32 //
33 // constructors and destructor
34 //
35 FWCollectionSummaryTableManager::FWCollectionSummaryTableManager(FWEventItem* iItem, const TGGC* iContext, const TGGC* iHighlightContext,
36  FWCollectionSummaryWidget* iWidget):
37  m_collection(iItem),
38  m_renderer(iContext,iHighlightContext),
39  m_bodyRenderer(iContext, iHighlightContext, FWTextTableCellRenderer::kJustifyRight),
40  m_widget(iWidget)
41 {
44 
45  //try to find the default columns
46  std::vector<std::pair<std::string,std::string> > s_names;
47  edm::TypeWithDict type(*(m_collection->modelType()->GetTypeInfo()));
48 
49 
50  dataChanged();
51 }
52 
54 {
56  dataChanged();
57  else
59 }
60 
61 
62 // FWCollectionSummaryTableManager::FWCollectionSummaryTableManager(const FWCollectionSummaryTableManager& rhs)
63 // {
64 // // do actual copying here;
65 // }
66 
68 {
69 }
70 
71 //
72 // assignment operators
73 //
74 // const FWCollectionSummaryTableManager& FWCollectionSummaryTableManager::operator=(const FWCollectionSummaryTableManager& rhs)
75 // {
76 // //An exception safe implementation is
77 // FWCollectionSummaryTableManager temp(rhs);
78 // swap(rhs);
79 //
80 // return *this;
81 // }
82 
83 //
84 // member functions
85 //
86 namespace {
87  template<typename S>
88  void doSort(const FWEventItem& iItem,
89  const FWItemValueGetter& iGetter, int iCol,
90  std::multimap<double,int,S>& iMap,
91  std::vector<int>& oNewSort) {
92  int size = iItem.size();
93  for(int index = 0; index < size; ++index) {
95  iMap.insert(std::make_pair(iGetter.valueFor(iItem.modelData(index), iCol),
96  index));
97  }
98  }
99  std::vector<int>::iterator itVec = oNewSort.begin();
100  for(typename std::map<double,int,S>::iterator it = iMap.begin(), itEnd = iMap.end();
101  it != itEnd;
102  ++it,++itVec) {
103  *itVec = it->second;
104  }
105  }
106 }
107 
108 void
110 {
111  if(iSortOrder) {
112  std::multimap<double,int, std::greater<double> > s;
114  } else {
115  std::multimap<double,int, std::less<double> > s;
117  }
118 }
119 
120 void
121 FWCollectionSummaryTableManager::buttonReleasedInRowHeader(Int_t row, Event_t* event, Int_t relX, Int_t relY)
122 {
123  Int_t realRow = unsortedRowNumber(row);
124  int hit = m_renderer.clickHit(relX,relY);
126  return;
127  }
129  m_widget->itemColorClicked(realRow,event->fXRoot, event->fYRoot+12-relY);
130  return;
131  }
135  dp.setIsVisible(!dp.isVisible());
136  }
137  m_collection->setDisplayProperties(realRow,dp);
138 }
139 
140 //
141 // const member functions
142 //
143 int
145 {
146  int cs= m_collection->size();
148  {
149  return cs;
150  }
151  else
152  {
153 
154  int n = 0;
155  for(int index = 0; index < cs; ++index) {
157  }
158  return n;
159  }
160 }
161 
162 int
164  return m_collection->valueGetter().numValues();
165 }
166 
167 std::vector<std::string>
169 
170 
171 
172  //return titles;
173  return m_collection->valueGetter().getTitles();
174 }
175 
176 int
178 {
179  return m_sortedToUnsortedIndicies[iSortedRowNumber];
180 }
181 
183 FWCollectionSummaryTableManager::cellRenderer(int iSortedRowNumber, int iCol) const
184 {
186  return 0;
187  }
188  if(iSortedRowNumber >= static_cast<int>(m_collection->size())) {
189  m_bodyRenderer.setData("",false);
190  return &m_bodyRenderer;
191  }
192  int index = m_sortedToUnsortedIndicies[iSortedRowNumber];
193  std::stringstream s;
194  s.setf(std::ios_base::fixed,std::ios_base::floatfield);
195  s.precision( m_collection->valueGetter().precision(iCol));
196  double v = m_collection->valueGetter().valueFor(m_collection->modelData(index), iCol);
197  s <<v;
199  return &m_bodyRenderer;
200 }
201 
202 bool
204 {
205  return true;
206 }
207 
210 {
211  if(iSortedRowNumber >= static_cast<int>(numberOfRows())) {
212  return 0;
213  }
214  int index = m_sortedToUnsortedIndicies[iSortedRowNumber];
216  index);
217  return &m_renderer;
218 }
219 
220 void
222 {
224  size_t n = numberOfRows();
225  m_sortedToUnsortedIndicies.reserve(n);
226  for(int i=0; i< static_cast<int>(m_collection->size());++i) {
228  m_sortedToUnsortedIndicies.push_back(i);
229  }
230  }
232 }
233 //
234 // static member functions
235 //
virtual FWTableCellRendererBase * rowHeader(int iSortedRowNumber) const
Returns the renderer for the row header for the sorted row number iSortedRowNumber.
type
Definition: HCALResponse.h:21
FWCollectionSummaryModelCellRenderer m_renderer
int i
Definition: DBlmapReader.cc:9
const FWItemValueGetter & valueGetter() const
one value from the model which is normally used for the popup
Definition: FWEventItem.h:121
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:67
auto_ptr< ClusterSequence > cs
virtual void implSort(int iCol, bool iSortOrder)
Called by &#39;sort&#39; method to actually handle the sorting of the rows. Arguments are the same as &#39;sort&#39;...
bool isSelected() const
Definition: FWEventItem.h:70
void setDisplayProperties(int iIndex, const FWDisplayProperties &) const
Definition: FWEventItem.cc:287
const std::string & filterExpression() const
Definition: FWEventItem.cc:616
bool filterPassed() const
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
virtual bool hasRowHeaders() const
Returns &#39;true&#39; if this table has row headers. Defaults return value is false.
virtual std::vector< std::string > getTitles() const
returns the title names for each column
virtual int numberOfRows() const
Number of rows in the table.
void itemColorClicked(int iIndex, Int_t iRootX, Int_t iRootY)
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:203
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool showFilteredEntries() const
Definition: FWEventItem.h:100
virtual int unsortedRowNumber(int iSortedRowNumber) const
when passed the index to the sorted order of the rows it returns the original row number from the und...
void setData(const std::string &, bool isSelected)
size_t size() const
Definition: FWEventItem.cc:562
std::vector< std::string > getTitles() const
void setData(const FWEventItem *iItem, int iIndex)
double valueFor(const void *, int idx) const
virtual void buttonReleasedInRowHeader(Int_t row, Event_t *event, Int_t relX, Int_t relY)
FWModelChangeSignal changed_
Definition: FWEventItem.h:200
virtual int numberOfColumns() const
Number of columns in the table.
const TClass * modelType() const
Definition: FWEventItem.cc:575
FWCollectionSummaryTableManager(FWEventItem *iCollection, const TGGC *iContext, const TGGC *iHighlightContext, FWCollectionSummaryWidget *)
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:581
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:548
UInt_t precision(int idx) const
void setIsVisible(bool iSet)
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const
tuple size
Write out results.