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 #include <climits>
24 
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 

Generated for HippoDraw Class Library by doxygen