CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
DataReducer< T > Class Template Reference

#include <DataReducer.h>

Classes

class  MyData
 

Public Types

typedef std::pair< EcalLogicID, TDataItem
 
typedef std::map< EcalLogicID, TDataMap
 
typedef std::list< MyData< T >
>::iterator 
iterator
 
typedef std::list< std::pair
< Tm, DataMap > >::iterator 
list_iterator
 
typedef std::map< EcalLogicID,
T >::iterator 
map_iterator
 
typedef DataReducer< Tself
 

Public Member Functions

 DataReducer ()
 
void getReducedDataList (std::list< std::pair< Tm, DataMap > > *my_new_list)
 
void setDataList (std::list< MyData< T > > _list)
 
 ~DataReducer ()
 

Static Public Attributes

static const int TIMELIMIT = 60
 

Private Attributes

std::list< MyData< T > > m_list
 
bool m_printout
 

Detailed Description

template<typename T>
class DataReducer< T >

Definition at line 20 of file DataReducer.h.

Member Typedef Documentation

template<typename T>
typedef std::pair<EcalLogicID, T> DataReducer< T >::DataItem

Definition at line 23 of file DataReducer.h.

template<typename T>
typedef std::map<EcalLogicID, T> DataReducer< T >::DataMap

Definition at line 24 of file DataReducer.h.

template<typename T>
typedef std::list<MyData<T> >::iterator DataReducer< T >::iterator

Definition at line 42 of file DataReducer.h.

template<typename T>
typedef std::list<std::pair<Tm, DataMap> >::iterator DataReducer< T >::list_iterator

Definition at line 25 of file DataReducer.h.

template<typename T>
typedef std::map<EcalLogicID, T>::iterator DataReducer< T >::map_iterator

Definition at line 26 of file DataReducer.h.

template<typename T>
typedef DataReducer<T> DataReducer< T >::self

Definition at line 22 of file DataReducer.h.

Constructor & Destructor Documentation

template<typename T>
DataReducer< T >::DataReducer ( )
inline

Definition at line 44 of file DataReducer.h.

References DataReducer< T >::m_printout.

44 { m_printout = false; };
bool m_printout
Definition: DataReducer.h:166
template<typename T>
DataReducer< T >::~DataReducer ( )
inline

Definition at line 45 of file DataReducer.h.

45 {};

Member Function Documentation

template<typename T>
void DataReducer< T >::getReducedDataList ( std::list< std::pair< Tm, DataMap > > *  my_new_list)
inline

Definition at line 54 of file DataReducer.h.

References gather_cfg::cout, ztail::d, createTree::dd, EcalLogicID::getLogicID(), mps_fire::i, DataReducer< T >::m_list, DataReducer< T >::m_printout, Tm::microsTime(), Tm::str(), submitPVValidationJobs::t, and DataReducer< T >::TIMELIMIT.

Referenced by RunDCSHVDat::fetchHistoricalData().

54  {
55  /* ***************************************
56  to get reduced data list
57  *************************************** */
58 
59  std::cout << " we are in getReducedDataList " << std::endl;
60  // std::list< std::pair< Tm, DataMap > > my_new_list ;
61  iterator i;
62  std::cout << " created iterator " << std::endl;
63 
64  bool firstpass = true;
65  unsigned int s_old = 0;
66  for (i = m_list.begin(); i != m_list.end(); i++) {
67  Tm t = (*i).m_iData.first;
68  DataItem d = (*i).m_iData.second;
69  bool new_time_change = true;
70 
71  DataMap the_data;
72  list_iterator it_good = my_new_list->end();
73 
74  if (!firstpass) {
75  list_iterator it;
76  int last_state = -1;
77  for (it = my_new_list->begin(); it != my_new_list->end(); ++it) {
78  // check on the state
79 
80  std::pair<Tm, DataMap> pair_new_list = *it;
81 
82  Tm t_l = pair_new_list.first;
83  DataMap dd = pair_new_list.second;
84  map_iterator ip;
85  for (ip = dd.begin(); ip != dd.end(); ++ip) {
86  EcalLogicID ecid = ip->first;
87  T dcs_dat = ip->second;
88  if (ecid.getLogicID() == d.first.getLogicID())
89  last_state = dcs_dat.getStatus();
90  }
91 
92  long long diff_time = (t.microsTime() - t_l.microsTime()) / 1000000;
93  if (diff_time < 0)
94  diff_time = -diff_time;
95  if (diff_time < TIMELIMIT) {
96  // data change happened at the same moment
97 
98  new_time_change = false;
99  // add data to the list
100  the_data = pair_new_list.second;
101  it_good = it;
102  }
103  }
104 
105  if (last_state != d.second.getStatus()) {
106  if (!new_time_change) {
107  std::pair<Tm, DataMap> pair_new_list = *it_good;
108  Tm t_good = pair_new_list.first;
109  the_data = pair_new_list.second;
110  the_data.insert(d);
111  std::pair<Tm, DataMap> pair_new_good;
112  pair_new_good.first = t_good;
113  pair_new_good.second = the_data;
114 
115  my_new_list->erase(it_good);
116  my_new_list->push_back(pair_new_good);
117 
118  } else if (new_time_change) {
119  std::pair<Tm, DataMap> p_new;
120  p_new.first = t;
121  DataMap a_map;
122  a_map.insert(d);
123  p_new.second = a_map;
124  my_new_list->push_back(p_new);
125  }
126  }
127  list_iterator it3;
128  if (my_new_list->size() > s_old) {
129  s_old = my_new_list->size();
130  if (m_printout) {
131  std::cout << "************" << std::endl;
132  for (it3 = my_new_list->begin(); it3 != my_new_list->end(); ++it3) {
133  std::pair<Tm, DataMap> pair_new_list3 = *it3;
134  Tm t3 = pair_new_list3.first;
135  std::cout << " T =" << t3.str() << std::endl;
136  }
137  std::cout << "************" << std::endl;
138  }
139  }
140 
141  } else {
142  // first pass write it anyway
143  std::pair<Tm, DataMap> p_new;
144  p_new.first = t;
145  DataMap a_map;
146  a_map.insert(d);
147  p_new.second = a_map;
148  my_new_list->insert(my_new_list->begin(), p_new);
149  firstpass = false;
150  }
151  }
152 
153  if (m_printout) {
154  list_iterator it3;
155  for (it3 = my_new_list->begin(); it3 != my_new_list->end(); ++it3) {
156  std::pair<Tm, DataMap> pair_new_list3 = *it3;
157  Tm t3 = pair_new_list3.first;
158  std::cout << " T =" << t3.str() << std::endl;
159  }
160  }
161  };
static const int TIMELIMIT
Definition: DataReducer.h:47
std::map< EcalLogicID, T >::iterator map_iterator
Definition: DataReducer.h:26
std::map< EcalLogicID, T > DataMap
Definition: DataReducer.h:24
uint64_t microsTime() const
Definition: Tm.cc:96
tuple d
Definition: ztail.py:151
bool m_printout
Definition: DataReducer.h:166
std::pair< EcalLogicID, T > DataItem
Definition: DataReducer.h:23
std::list< std::pair< Tm, DataMap > >::iterator list_iterator
Definition: DataReducer.h:25
std::list< MyData< T > > m_list
Definition: DataReducer.h:161
int getLogicID() const
Definition: EcalLogicID.cc:28
std::string str() const
Definition: Tm.cc:66
std::list< MyData< T > >::iterator iterator
Definition: DataReducer.h:42
tuple cout
Definition: gather_cfg.py:144
long double T
Definition: Tm.h:13
template<typename T>
void DataReducer< T >::setDataList ( std::list< MyData< T > >  _list)
inline

Definition at line 49 of file DataReducer.h.

References DataReducer< T >::m_list.

Referenced by RunDCSHVDat::fetchHistoricalData().

49  {
50  m_list = _list;
51  m_list.sort();
52  };
std::list< MyData< T > > m_list
Definition: DataReducer.h:161

Member Data Documentation

template<typename T>
std::list<MyData<T> > DataReducer< T >::m_list
private
template<typename T>
bool DataReducer< T >::m_printout
private
template<typename T>
const int DataReducer< T >::TIMELIMIT = 60
static

Definition at line 47 of file DataReducer.h.

Referenced by DataReducer< T >::getReducedDataList().