CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

L1TRateHelper::L1TRateHelper Class Reference

#include <L1TRateHelper.h>

List of all members.

Public Member Functions

void addOrbit (int orbit)
 Adds event with specified orbit. If the event for some reason comes late (after removal of coresponding entry from m_rateMap), it wont be accounted.
int getEarliestTime ()
 gets time of earliest event (orbit) recorded in event. Returned time -1 is invalid
int getLastTime ()
 gets time of latest event (orbit) recorded in event. Returned time -1 is invalid
int getTimeForOrbit (int orbit)
 L1TRateHelper ()
std::pair< int, int > removeAndGetRateForEarliestTime ()

Private Types

typedef std::map< int,
TRateStruct, TRateStruct
TRateMap

Private Attributes

int m_lastRemovedOrbit
TRateMap m_rateMap
int m_timeStart

Detailed Description

Definition at line 31 of file L1TRateHelper.h.


Member Typedef Documentation

Definition at line 59 of file L1TRateHelper.h.


Constructor & Destructor Documentation

L1TRateHelper::L1TRateHelper::L1TRateHelper ( ) [inline]

Definition at line 34 of file L1TRateHelper.h.


Member Function Documentation

void L1TRateHelper::L1TRateHelper::addOrbit ( int  orbit) [inline]

Adds event with specified orbit. If the event for some reason comes late (after removal of coresponding entry from m_rateMap), it wont be accounted.

Definition at line 44 of file L1TRateHelper.h.

References m_lastRemovedOrbit, and m_rateMap.

Referenced by L1TRPCTF::analyze().

{ if (orbit > m_lastRemovedOrbit) m_rateMap[orbit].add(orbit);};
int L1TRateHelper::L1TRateHelper::getEarliestTime ( ) [inline]

gets time of earliest event (orbit) recorded in event. Returned time -1 is invalid

Definition at line 47 of file L1TRateHelper.h.

References m_rateMap.

Referenced by L1TRPCTF::fillRateHistos().

                                 {
            if (m_rateMap.begin() == m_rateMap.end() ) return -1;
            return m_rateMap.begin()->second.getTime();
          };
int L1TRateHelper::L1TRateHelper::getLastTime ( ) [inline]

gets time of latest event (orbit) recorded in event. Returned time -1 is invalid

Definition at line 53 of file L1TRateHelper.h.

References m_rateMap.

                             {
            if (m_rateMap.begin() == m_rateMap.end() ) return -1;
            return m_rateMap.rbegin()->second.getTime();
          };
int L1TRateHelper::L1TRateHelper::getTimeForOrbit ( int  orbit) [inline]

Definition at line 59 of file L1TRateHelper.h.

Referenced by L1TRPCTF::fillRateHistos().

{return TRateStruct::getTimeForOrbit(orbit); };
std::pair< int, int > L1TRateHelper::L1TRateHelper::removeAndGetRateForEarliestTime ( )

returns time (in pair.first) and rate for earliest record, removes earliest record from map. Time here is measured wrt to first record removed (first call of removeAndGetRateForEarliestTime will get time value equal to 1). As consequence: time returned in pair.second is shifted wrt to time from getEarliestTime, getLastTime, getTimeForOrbit methods

Definition at line 7 of file L1TRateHelper.cc.

References m_lastRemovedOrbit, m_rateMap, and m_timeStart.

Referenced by L1TRPCTF::fillRateHistos().

                                                                 { 
  if (m_rateMap.begin() == m_rateMap.end() ) 
    return std::make_pair(-1,-1);
  
  if (m_timeStart==-1) {
    m_timeStart = m_rateMap.begin()->second.getTime()-1; // so time will start from 1
  }
  int r1 = m_rateMap.begin()->second.getTime()-m_timeStart; 
  int r2 = m_rateMap.begin()->second.m_events;
  m_lastRemovedOrbit = m_rateMap.begin()->second.m_orbitHigh;
  m_rateMap.erase(m_rateMap.begin());
  return std::make_pair(r1,r2);
}

Member Data Documentation

Definition at line 64 of file L1TRateHelper.h.

Referenced by addOrbit(), and removeAndGetRateForEarliestTime().

Definition at line 65 of file L1TRateHelper.h.

Referenced by removeAndGetRateForEarliestTime().