CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
FWCollectionSummaryTableManager Class Reference

#include <Fireworks/Core/interface/FWCollectionSummaryTableManager.h>

Inheritance diagram for FWCollectionSummaryTableManager:
FWTableManagerBase

Public Member Functions

virtual void buttonReleasedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 
virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const
 
 FWCollectionSummaryTableManager (FWEventItem *iCollection, const TGGC *iContext, const TGGC *iHighlightContext, FWCollectionSummaryWidget *)
 
virtual std::vector< std::string > getTitles () const
 returns the title names for each column More...
 
virtual bool hasRowHeaders () const
 Returns 'true' if this table has row headers. Defaults return value is false. More...
 
virtual int numberOfColumns () const
 Number of columns in the table. More...
 
virtual int numberOfRows () const
 Number of rows in the table. More...
 
virtual FWTableCellRendererBaserowHeader (int iSortedRowNumber) const
 Returns the renderer for the row header for the sorted row number iSortedRowNumber. More...
 
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 underlying data More...
 
virtual ~FWCollectionSummaryTableManager ()
 
- Public Member Functions inherited from FWTableManagerBase
virtual void buttonPressedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 Called if mouse button pressed in Row Header, defaults is to do nothing. More...
 
virtual unsigned int cellHeight () const
 require all cells to be the same height More...
 
 ClassDef (FWTableManagerBase, 0)
 
void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes. More...
 
 FWTableManagerBase ()
 
virtual bool hasLabelHeaders () const
 
virtual std::vector< unsigned int > maxWidthForColumns () const
 for each column in the table this returns the present maximum width for that column More...
 
void sort (int iCol, bool iSortOrder)
 Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder is 'true'. More...
 
int sortColumn (void)
 The current sort column. More...
 
bool sortOrder (void)
 The current sort order for the table. More...
 
void visualPropertiesChanged ()
 Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes. More...
 
virtual ~FWTableManagerBase ()
 

Protected Member Functions

virtual void implSort (int iCol, bool iSortOrder)
 Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'. More...
 

Private Member Functions

void dataChanged ()
 
 FWCollectionSummaryTableManager (const FWCollectionSummaryTableManager &)
 
const
FWCollectionSummaryTableManager
operator= (const FWCollectionSummaryTableManager &)
 

Private Attributes

FWTextTableCellRenderer m_bodyRenderer
 
FWEventItemm_collection
 
FWCollectionSummaryModelCellRenderer m_renderer
 
std::vector< int > m_sortedToUnsortedIndicies
 
std::vector< boost::shared_ptr
< FWItemValueGetter > > 
m_valueGetters
 
FWCollectionSummaryWidgetm_widget
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 36 of file FWCollectionSummaryTableManager.h.

Constructor & Destructor Documentation

FWCollectionSummaryTableManager::FWCollectionSummaryTableManager ( FWEventItem iCollection,
const TGGC *  iContext,
const TGGC *  iHighlightContext,
FWCollectionSummaryWidget iWidget 
)

Definition at line 36 of file FWCollectionSummaryTableManager.cc.

References FWEventItem::changed_, dataChanged(), FWTableManagerBase::dataChanged(), eta(), FWEventItem::itemChanged_, m_collection, m_valueGetters, FWEventItem::modelType(), phi, pos, and FWEventItem::purpose().

37  :
38  m_collection(iItem),
39  m_renderer(iContext,iHighlightContext),
40  m_bodyRenderer(iContext, iHighlightContext, FWTextTableCellRenderer::kJustifyRight),
41  m_widget(iWidget)
42 {
43  m_collection->changed_.connect(boost::bind(&FWTableManagerBase::dataChanged,this));
45 
46  //try to find the default columns
47  std::vector<std::pair<std::string,std::string> > s_names;
48  ROOT::Reflex::Type type = ROOT::Reflex::Type::ByTypeInfo(*(m_collection->modelType()->GetTypeInfo()));
49 
50  if ( type.Name() == "CaloTower" ){
51  if ( m_collection->purpose() == "ECal" ){
52  s_names.push_back(std::pair<std::string,std::string>("emEt","GeV"));
53  boost::shared_ptr<FWItemValueGetter> trans( new FWItemValueGetter(type,s_names));
54  if(trans->isValid()) m_valueGetters.push_back(trans);
55  }
56  else if ( m_collection->purpose() == "HCal" ){
57  s_names.push_back(std::pair<std::string,std::string>("hadEt","GeV"));
58  boost::shared_ptr<FWItemValueGetter> hadEt( new FWItemValueGetter(type,s_names));
59  if(hadEt->isValid()) m_valueGetters.push_back(hadEt);
60  }
61  else if (m_collection->purpose() == "HCal Outer"){
62  s_names.push_back(std::pair<std::string,std::string>("outerEt","GeV"));
63  boost::shared_ptr<FWItemValueGetter> outerEt( new FWItemValueGetter(type,s_names));
64  if(outerEt->isValid()) m_valueGetters.push_back(outerEt);
65  }
66  }
67  else if (strstr(m_collection->purpose().c_str(), "Beam Spot") ){
68 
69  s_names.push_back(std::pair<std::string,std::string>("x0","cm"));
70  {
71  boost::shared_ptr<FWItemValueGetter> pos( new FWItemValueGetter(type,s_names));
72  if(pos->isValid()) m_valueGetters.push_back(pos);
73  }
74  {
75  s_names.begin()->first = "y0";
76  boost::shared_ptr<FWItemValueGetter> pos( new FWItemValueGetter(type,s_names));
77  if(pos->isValid()) m_valueGetters.push_back(pos);
78  }
79  {
80  s_names.begin()->first = "z0";
81  boost::shared_ptr<FWItemValueGetter> pos( new FWItemValueGetter(type,s_names));
82  if(pos->isValid()) m_valueGetters.push_back(pos);
83  }
84 
85  }
86  else {
87  s_names.push_back(std::pair<std::string,std::string>("pt","GeV"));
88  s_names.push_back(std::pair<std::string,std::string>("et","GeV"));
89  s_names.push_back(std::pair<std::string,std::string>("energy","GeV"));
90  boost::shared_ptr<FWItemValueGetter> trans( new FWItemValueGetter(type,s_names));
91  if(trans->isValid()) m_valueGetters.push_back(trans);
92  }
93 
94 
95  s_names.clear();
96  s_names.push_back(std::pair<std::string,std::string>("eta",""));
97  boost::shared_ptr<FWItemValueGetter> eta( new FWItemValueGetter(type,s_names));
98  if(eta->isValid()) {
99  s_names.clear();
100  s_names.push_back(std::pair<std::string,std::string>("phi",""));
101  boost::shared_ptr<FWItemValueGetter> phi( new FWItemValueGetter(type,s_names));
102  if(phi->isValid()) {
103  m_valueGetters.push_back(eta);
104  m_valueGetters.push_back(phi);
105  }
106  }
107 
108  dataChanged();
109 }
type
Definition: HCALResponse.h:22
FWCollectionSummaryModelCellRenderer m_renderer
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
T eta() const
FWItemChangeSignal itemChanged_
Definition: FWEventItem.h:195
std::vector< boost::shared_ptr< FWItemValueGetter > > m_valueGetters
FWModelChangeSignal changed_
Definition: FWEventItem.h:192
const TClass * modelType() const
Definition: FWEventItem.cc:561
const std::string & purpose() const
Definition: FWEventItem.cc:512
Definition: DDAxes.h:10
FWCollectionSummaryTableManager::~FWCollectionSummaryTableManager ( )
virtual

Definition at line 116 of file FWCollectionSummaryTableManager.cc.

117 {
118 }
FWCollectionSummaryTableManager::FWCollectionSummaryTableManager ( const FWCollectionSummaryTableManager )
private

Member Function Documentation

void FWCollectionSummaryTableManager::buttonReleasedInRowHeader ( Int_t  row,
Event_t *  event,
Int_t  relX,
Int_t  relY 
)
virtual

Reimplemented from FWTableManagerBase.

Definition at line 168 of file FWCollectionSummaryTableManager.cc.

References FWCollectionSummaryModelCellRenderer::clickHit(), FWEventItem::ModelInfo::displayProperties(), FWDisplayProperties::isVisible(), FWCollectionSummaryWidget::itemColorClicked(), FWCollectionSummaryModelCellRenderer::kHitCheck, FWCollectionSummaryModelCellRenderer::kHitColor, FWCollectionSummaryModelCellRenderer::kMiss, m_collection, m_renderer, m_widget, FWEventItem::modelInfo(), FWEventItem::setDisplayProperties(), FWDisplayProperties::setIsVisible(), and unsortedRowNumber().

169 {
170  Int_t realRow = unsortedRowNumber(row);
171  int hit = m_renderer.clickHit(relX,relY);
173  return;
174  }
176  m_widget->itemColorClicked(realRow,event->fXRoot, event->fYRoot+12-relY);
177  return;
178  }
182  dp.setIsVisible(!dp.isVisible());
183  }
184  m_collection->setDisplayProperties(realRow,dp);
185 }
FWCollectionSummaryModelCellRenderer m_renderer
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:67
void setDisplayProperties(int iIndex, const FWDisplayProperties &) const
Definition: FWEventItem.cc:286
void itemColorClicked(int iIndex, Int_t iRootX, Int_t iRootY)
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
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...
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
void setIsVisible(bool iSet)
FWTableCellRendererBase * FWCollectionSummaryTableManager::cellRenderer ( int  iSortedRowNumber,
int  iCol 
) const
virtual
Returns the particular renderer used to handle the requested cell.  Arguments:

iSortedRowNumber: the row number from the present sort (i.e. the cell number of the view) iCol: the column number of the cell. The returned value must be used immediately and not held onto since the same Renderer can be used for subsequent calls

Implements FWTableManagerBase.

Definition at line 220 of file FWCollectionSummaryTableManager.cc.

References getHLTprescales::index, FWEventItem::ModelInfo::isSelected(), m_bodyRenderer, m_collection, m_sortedToUnsortedIndicies, m_valueGetters, FWEventItem::modelData(), FWEventItem::modelInfo(), asciidump::s, FWTextTableCellRenderer::setData(), FWEventItem::size(), and v.

221 {
222  if(iCol >= static_cast<int>(m_valueGetters.size())) {
223  return 0;
224  }
225  if(iSortedRowNumber >= static_cast<int>(m_collection->size())) {
226  m_bodyRenderer.setData("",false);
227  return &m_bodyRenderer;
228  }
229  int index = m_sortedToUnsortedIndicies[iSortedRowNumber];
230  std::stringstream s;
231  s.setf(std::ios_base::fixed,std::ios_base::floatfield);
232  s.precision(1);
233  double v = m_valueGetters[iCol]->valueFor(m_collection->modelData(index));
234  s <<v;
235  m_bodyRenderer.setData(s.str(),
236  m_collection->modelInfo(index).isSelected());
237  return &m_bodyRenderer;
238 }
bool isSelected() const
Definition: FWEventItem.h:70
std::vector< boost::shared_ptr< FWItemValueGetter > > m_valueGetters
void setData(const std::string &, bool isSelected)
size_t size() const
Definition: FWEventItem.cc:548
string s
Definition: asciidump.py:422
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:567
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
mathSSE::Vec4< T > v
void FWCollectionSummaryTableManager::dataChanged ( void  )
private

Definition at line 259 of file FWCollectionSummaryTableManager.cc.

References FWTableManagerBase::dataChanged(), i, m_collection, m_sortedToUnsortedIndicies, and FWEventItem::size().

Referenced by FWCollectionSummaryTableManager().

260 {
263  for(int i=0; i< static_cast<int>(m_collection->size());++i) {
264  m_sortedToUnsortedIndicies.push_back(i);
265  }
267 }
int i
Definition: DBlmapReader.cc:9
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
size_t size() const
Definition: FWEventItem.cc:548
std::vector< std::string > FWCollectionSummaryTableManager::getTitles ( ) const
virtual

returns the title names for each column

Implements FWTableManagerBase.

Definition at line 202 of file FWCollectionSummaryTableManager.cc.

References m_valueGetters.

202  {
203  std::vector<std::string> titles;
204  titles.reserve(m_valueGetters.size());
205  for(std::vector<boost::shared_ptr<FWItemValueGetter> >::const_iterator it = m_valueGetters.begin(), itEnd=m_valueGetters.end();
206  it != itEnd;
207  ++it) {
208  titles.push_back((*it)->valueName());
209  }
210  return titles;
211 }
std::vector< boost::shared_ptr< FWItemValueGetter > > m_valueGetters
bool FWCollectionSummaryTableManager::hasRowHeaders ( ) const
virtual

Returns 'true' if this table has row headers. Defaults return value is false.

Reimplemented from FWTableManagerBase.

Definition at line 241 of file FWCollectionSummaryTableManager.cc.

242 {
243  return true;
244 }
void FWCollectionSummaryTableManager::implSort ( int  iCol,
bool  iSortOrder 
)
protectedvirtual

Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.

Implements FWTableManagerBase.

Definition at line 156 of file FWCollectionSummaryTableManager.cc.

References m_collection, m_sortedToUnsortedIndicies, m_valueGetters, and asciidump::s.

157 {
158  if(iSortOrder) {
159  std::multimap<double,int, std::greater<double> > s;
161  } else {
162  std::multimap<double,int, std::less<double> > s;
164  }
165 }
std::vector< boost::shared_ptr< FWItemValueGetter > > m_valueGetters
string s
Definition: asciidump.py:422
int FWCollectionSummaryTableManager::numberOfColumns ( ) const
virtual

Number of columns in the table.

Implements FWTableManagerBase.

Definition at line 197 of file FWCollectionSummaryTableManager.cc.

References m_valueGetters.

197  {
198  return m_valueGetters.size();
199 }
std::vector< boost::shared_ptr< FWItemValueGetter > > m_valueGetters
int FWCollectionSummaryTableManager::numberOfRows ( ) const
virtual

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 191 of file FWCollectionSummaryTableManager.cc.

References m_collection, and FWEventItem::size().

192 {
193  return m_collection->size();
194 }
size_t size() const
Definition: FWEventItem.cc:548
const FWCollectionSummaryTableManager& FWCollectionSummaryTableManager::operator= ( const FWCollectionSummaryTableManager )
private
FWTableCellRendererBase * FWCollectionSummaryTableManager::rowHeader ( int  iSortedRowNumber) const
virtual

Returns the renderer for the row header for the sorted row number iSortedRowNumber.

Reimplemented from FWTableManagerBase.

Definition at line 247 of file FWCollectionSummaryTableManager.cc.

References getHLTprescales::index, m_collection, m_renderer, m_sortedToUnsortedIndicies, FWCollectionSummaryModelCellRenderer::setData(), and FWEventItem::size().

248 {
249  if(iSortedRowNumber >= static_cast<int>(m_collection->size())) {
250  return 0;
251  }
252  int index = m_sortedToUnsortedIndicies[iSortedRowNumber];
254  index);
255  return &m_renderer;
256 }
FWCollectionSummaryModelCellRenderer m_renderer
size_t size() const
Definition: FWEventItem.cc:548
void setData(const FWEventItem *iItem, int iIndex)
int FWCollectionSummaryTableManager::unsortedRowNumber ( int  iSortedRowNumber) const
virtual

when passed the index to the sorted order of the rows it returns the original row number from the underlying data

Implements FWTableManagerBase.

Definition at line 214 of file FWCollectionSummaryTableManager.cc.

References m_sortedToUnsortedIndicies.

Referenced by buttonReleasedInRowHeader().

215 {
216  return m_sortedToUnsortedIndicies[iSortedRowNumber];
217 }

Member Data Documentation

FWTextTableCellRenderer FWCollectionSummaryTableManager::m_bodyRenderer
mutableprivate

Definition at line 72 of file FWCollectionSummaryTableManager.h.

Referenced by cellRenderer().

FWEventItem* FWCollectionSummaryTableManager::m_collection
private
FWCollectionSummaryModelCellRenderer FWCollectionSummaryTableManager::m_renderer
mutableprivate

Definition at line 71 of file FWCollectionSummaryTableManager.h.

Referenced by buttonReleasedInRowHeader(), and rowHeader().

std::vector<int> FWCollectionSummaryTableManager::m_sortedToUnsortedIndicies
private
std::vector<boost::shared_ptr<FWItemValueGetter> > FWCollectionSummaryTableManager::m_valueGetters
private
FWCollectionSummaryWidget* FWCollectionSummaryTableManager::m_widget
private

Definition at line 73 of file FWCollectionSummaryTableManager.h.

Referenced by buttonReleasedInRowHeader().