CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Public Attributes | Private Attributes

DataReducer< T > Class Template Reference

#include <DataReducer.h>

List of all members.

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.

{ m_printout=false; };
template<typename T>
DataReducer< T >::~DataReducer ( ) [inline]

Definition at line 56 of file DataReducer.h.

{};

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(), matplotRender::t, and DataReducer< T >::TIMELIMIT.

Referenced by RunDCSHVDat::fetchHistoricalData().

                                                                          {
    /* *************************************** 
           to get reduced data list 
       *************************************** */

    std::cout << " we are in getReducedDataList "<< std::endl; 
    //  std::list< std::pair< Tm, DataMap > > my_new_list ;
    iterator i;
    std::cout << " created iterator "<< std::endl; 

    bool firstpass=true; 
    unsigned int s_old=0;
    for ( i=m_list.begin(); i!=m_list.end(); i++){

      Tm t = (*i).m_iData.first;
      DataItem d = (*i).m_iData.second;
      bool new_time_change=true;

      DataMap the_data;
      list_iterator it_good=my_new_list->end(); 


      if(!firstpass) {

        list_iterator it; 
        int last_state=-1;
        for(it =my_new_list->begin(); it!= my_new_list->end(); ++it) {
          
          // check on the state 
           

          std::pair< Tm, DataMap > pair_new_list = *it;

          Tm t_l = pair_new_list.first;
          DataMap dd =  pair_new_list.second;
          map_iterator ip; 
          for(ip =dd.begin(); ip!= dd.end(); ++ip) {
            EcalLogicID ecid = ip->first;
            T dcs_dat = ip->second;
            if(ecid.getLogicID()==d.first.getLogicID() ) last_state= dcs_dat.getStatus();
          }

          long long diff_time= (t.microsTime() - t_l.microsTime()) /1000000  ;
          if(diff_time<0) diff_time=-diff_time;
          if( diff_time  < TIMELIMIT ) {
            // data change happened at the same moment

            
            new_time_change=false;
            // add data to the list
            the_data = pair_new_list.second;
            it_good=it;

          }
          
        }

        if(last_state != d.second.getStatus()){
          if(!new_time_change ) {
            std::pair< Tm, DataMap > pair_new_list = *it_good;
            Tm t_good = pair_new_list.first;
            the_data = pair_new_list.second;
            the_data.insert(d);
            std::pair< Tm, DataMap > pair_new_good;
            pair_new_good.first=t_good;
            pair_new_good.second=the_data;
            
            my_new_list->erase(it_good);
            my_new_list->push_back(pair_new_good);

            
          } else if(new_time_change) {
            
            std::pair< Tm, DataMap >  p_new;
            p_new.first=t;
            DataMap a_map;
            a_map.insert( d );
            p_new.second=a_map;
            my_new_list->push_back(p_new);

          }
        }
        list_iterator it3; 
        if(my_new_list->size() > s_old) {
          s_old=my_new_list->size();
          if(m_printout){
            std::cout << "************"<< std::endl;
            for(it3 =my_new_list->begin(); it3!= my_new_list->end(); ++it3) {
              std::pair< Tm, DataMap > pair_new_list3 = *it3;
              Tm t3 = pair_new_list3.first;
              std::cout << " T =" << t3.str()<< std::endl;
            } 
            std::cout << "************"<< std::endl;
          }
        }


      } else {
        // first pass write it anyway 
          std::pair< Tm, DataMap >  p_new;
          p_new.first=t;
          DataMap a_map;
          a_map.insert( d );
          p_new.second=a_map;
          my_new_list->insert(my_new_list->begin(),p_new);
          firstpass=false; 
          
      }

    }


    if(m_printout) {
      list_iterator it3; 
      for(it3 =my_new_list->begin(); it3!= my_new_list->end(); ++it3) {
        std::pair< Tm, DataMap > pair_new_list3 = *it3;
        Tm t3 = pair_new_list3.first;
        std::cout << " T =" << t3.str()<< std::endl;
      } 
    }

  };
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().

                                                { 

    m_list = _list;
    m_list.sort();

  };

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().