CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 23 of file DataReducer.h.

Member Typedef Documentation

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

Definition at line 29 of file DataReducer.h.

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

Definition at line 30 of file DataReducer.h.

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

Definition at line 52 of file DataReducer.h.

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

Definition at line 31 of file DataReducer.h.

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

Definition at line 32 of file DataReducer.h.

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

Definition at line 28 of file DataReducer.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file DataReducer.h.

References DataReducer< T >::m_printout.

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

Definition at line 56 of file DataReducer.h.

56 {};

Member Function Documentation

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

Definition at line 67 of file DataReducer.h.

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

Referenced by RunDCSHVDat::fetchHistoricalData().

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

Definition at line 60 of file DataReducer.h.

References DataReducer< T >::m_list.

Referenced by RunDCSHVDat::fetchHistoricalData().

60  {
61 
62  m_list = _list;
63  m_list.sort();
64 
65  };
std::list< MyData< T > > m_list
Definition: DataReducer.h:188

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 58 of file DataReducer.h.

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