StripChartProjector.cxx
Go to the documentation of this file.
1 
12 // For truncation warning
13 #ifdef _MSC_VER
14 #include "msdevstudio/MSconfig.h"
15 #endif
16 
17 #include "StripChartProjector.h"
18 
20 #include "datasrcs/DataSource.h"
21 
22 #include <algorithm>
23 
24 #include <climits>
25 #include <cassert>
26 
27 using std::distance;
28 using std::min_element;
29 using std::vector;
30 
31 namespace hippodraw {
32 
34  : Map2Projector()
35 {
36  addPointReps();
37 }
38 
45  : ProjectorBase ( projector ), // already done in Map2Proj, but no harm
46  Map2Projector( projector )
47 {
48  addPointReps();
49 }
50 
52 {
53  return new StripChartProjector ( *this );
54 }
55 
57 {
58  m_pointreps.clear();
59  m_pointreps.push_back ( "Line" );
60  m_pointreps.push_back ( "Symbol" );
61 }
62 
63 namespace dp = hippodraw::DataPoint2DTuple;
64 
67 void
69 fillProjectedValues ( DataSource * ntuple, bool ) const //in_range ) const
70 {
71  ntuple -> clear();
72 
73  unsigned int x_col = m_columns[0];
74  unsigned int y_col = m_columns[1];
75  unsigned int x_err = m_columns[2];
76  unsigned int y_err = m_columns[3];
77 
78  unsigned int min_row = m_ntuple -> indexOfMinElement ( x_col );
79 
80  unsigned int size = m_ntuple -> rows ();
81 
82  vector < double > row ( dp::SIZE );
83  for ( unsigned int i = min_row; i < size; i++ ) {
84 // if ( acceptRow ( i ) == false ||
85 // ( in_range == true && inRange ( i ) == false ) ) continue;
86  if ( acceptRow ( i, m_cut_list ) == false ) continue;
87 
88  row[dp::X] = m_ntuple -> valueAt ( i, x_col );
89  row[dp::Y] = m_ntuple -> valueAt ( i, y_col );
90 
91  double xe
92  = x_err < UINT_MAX ? m_ntuple -> valueAt ( i, x_err ) : 0.0;
93  double ye
94  = y_err < UINT_MAX ? m_ntuple -> valueAt ( i, y_err ) : 0.0;
95 
96  row[dp::XERR] = xe;
97  row[dp::YERR] = ye;
98  ntuple -> addRow ( row );
99  }
100  for ( unsigned int i = 0; i < min_row; i++ ) {
101  if ( acceptRow ( i, m_cut_list ) == false ||
102  inRange ( i ) == false ) continue;
103 
104  row[dp::X] = m_ntuple -> valueAt ( i, x_col );
105  row[dp::Y] = m_ntuple -> valueAt ( i, y_col );
106  double xe
107  = x_err < UINT_MAX ? m_ntuple -> valueAt ( i, x_err ) : 0.0;
108  double ye
109  = y_err < UINT_MAX ? m_ntuple -> valueAt ( i, y_err ) : 0.0;
110 
111  row[dp::XERR] = xe;
112  row[dp::YERR] = ye;
113 
114  ntuple -> addRow ( row );
115  }
116 }
117 
118 } // namespace hippodraw
119 
unsigned int i
CutList_t m_cut_list
A list of cuts that filter the projection.
Copyright (C) 2000-2005 The Board of Trustees of The Leland Stanford Junior University.
virtual bool inRange(int row) const
Checks if the entries in a given row are within the range of the axis model.
A derived class of NTupleProjector that maps 2 ntuple columns to a two dimensional projection...
Definition: Map2Projector.h:29
bool acceptRow(unsigned int i, const CutList_t &cut_list) const
For row i of the column in the DataSource, returns true if all the cuts accept the row...
ProjectorBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
std::vector< unsigned int > m_columns
A vector containing indexes to the columns of the DataSource.
hippodraw::DataSource class interface.
error on X or half bin width
virtual void addPointReps()
Function to add the acceptable point reps.
intp size(numeric::array arr)
Definition: num_util.cpp:296
const DataSource * m_ntuple
The pointer to the data source being projected.
StripChartProjector()
The following default constructor binds to the first two columns.
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
std::vector< std::string > m_pointreps
Vector of acceptable PointReps.
hippodraw::DataPointTuple namespace interface
virtual void fillProjectedValues(DataSource *ntuple, bool in_range=false) const
Fills the data source with projected values.
Base class for DataSource.
Definition: DataSource.h:55

Generated for HippoDraw Class Library by doxygen