CMS 3D CMS Logo

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

◆ DataItem

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

Definition at line 23 of file DataReducer.h.

◆ DataMap

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

Definition at line 24 of file DataReducer.h.

◆ iterator

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

Definition at line 42 of file DataReducer.h.

◆ list_iterator

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

Definition at line 25 of file DataReducer.h.

◆ map_iterator

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

Definition at line 26 of file DataReducer.h.

◆ self

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

Definition at line 22 of file DataReducer.h.

Constructor & Destructor Documentation

◆ DataReducer()

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

Definition at line 44 of file DataReducer.h.

44 { m_printout = false; };

References DataReducer< T >::m_printout.

◆ ~DataReducer()

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

Definition at line 45 of file DataReducer.h.

45 {};

Member Function Documentation

◆ getReducedDataList()

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.

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  };

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

Referenced by RunDCSHVDat::fetchHistoricalData().

◆ setDataList()

template<typename T>
void DataReducer< T >::setDataList ( std::list< MyData< T > >  _list)
inline

Definition at line 49 of file DataReducer.h.

49  {
50  m_list = _list;
51  m_list.sort();
52  };

References DataReducer< T >::m_list.

Referenced by RunDCSHVDat::fetchHistoricalData().

Member Data Documentation

◆ m_list

template<typename T>
std::list<MyData<T> > DataReducer< T >::m_list
private

◆ m_printout

template<typename T>
bool DataReducer< T >::m_printout
private

◆ TIMELIMIT

template<typename T>
const int DataReducer< T >::TIMELIMIT = 60
static

Definition at line 47 of file DataReducer.h.

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

mps_fire.i
i
Definition: mps_fire.py:428
DataReducer::TIMELIMIT
static const int TIMELIMIT
Definition: DataReducer.h:47
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DataReducer::map_iterator
std::map< EcalLogicID, T >::iterator map_iterator
Definition: DataReducer.h:26
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
DataReducer::m_printout
bool m_printout
Definition: DataReducer.h:166
DataReducer::DataItem
std::pair< EcalLogicID, T > DataItem
Definition: DataReducer.h:23
DataReducer::DataMap
std::map< EcalLogicID, T > DataMap
Definition: DataReducer.h:24
EcalLogicID
Definition: EcalLogicID.h:7
RandomServiceHelper.t3
t3
Definition: RandomServiceHelper.py:258
createTree.dd
string dd
Definition: createTree.py:154
Tm
Definition: Tm.h:13
DataReducer::list_iterator
std::list< std::pair< Tm, DataMap > >::iterator list_iterator
Definition: DataReducer.h:25
DataReducer::m_list
std::list< MyData< T > > m_list
Definition: DataReducer.h:161
Tm::microsTime
uint64_t microsTime() const
Definition: Tm.cc:96
T
long double T
Definition: Basic3DVectorLD.h:48
DataReducer::iterator
std::list< MyData< T > >::iterator iterator
Definition: DataReducer.h:42
ztail.d
d
Definition: ztail.py:151
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644