CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

DTPerformance Class Reference

#include <DTPerformance.h>

List of all members.

Public Types

typedef std::vector< std::pair
< DTPerformanceId,
DTPerformanceData >
>::const_iterator 
const_iterator
 Access methods to data.

Public Member Functions

const_iterator begin () const
void clear ()
 reset content
 DTPerformance ()
 DTPerformance (const std::string &version)
const_iterator end () const
int get (int wheelId, int stationId, int sectorId, int slId, float &meanT0, float &meanTtrig, float &meanMtime, float &meanNoise, float &meanAfterPulse, float &meanResolution, float &meanEfficiency, DTTimeUnits::type unit) const
int get (const DTSuperLayerId &id, float &meanT0, float &meanTtrig, float &meanMtime, float &meanNoise, float &meanAfterPulse, float &meanResolution, float &meanEfficiency, DTTimeUnits::type unit) const
int set (const DTSuperLayerId &id, float meanT0, float meanTtrig, float meanMtime, float meanNoise, float meanAfterPulse, float meanResolution, float meanEfficiency, DTTimeUnits::type unit)
int set (int wheelId, int stationId, int sectorId, int slId, float meanT0, float meanTtrig, float meanMtime, float meanNoise, float meanAfterPulse, float meanResolution, float meanEfficiency, DTTimeUnits::type unit)
int setSLPerformance (int wheelId, int stationId, int sectorId, int slId, float meanT0, float meanTtrig, float meanMtime, float meanNoise, float meanAfterPulse, float meanResolution, float meanEfficiency, DTTimeUnits::type unit)
int setSLPerformance (const DTSuperLayerId &id, float meanT0, float meanTtrig, float meanMtime, float meanNoise, float meanAfterPulse, float meanResolution, float meanEfficiency, DTTimeUnits::type unit)
void setUnit (float unit)
int slPerformance (int wheelId, int stationId, int sectorId, int slId, float &meanT0, float &meanTtrig, float &meanMtime, float &meanNoise, float &meanAfterPulse, float &meanResolution, float &meanEfficiency, DTTimeUnits::type unit) const
 get content
int slPerformance (const DTSuperLayerId &id, float &meanT0, float &meanTtrig, float &meanMtime, float &meanNoise, float &meanAfterPulse, float &meanResolution, float &meanEfficiency, DTTimeUnits::type unit) const
float unit () const
std::string & version ()
const std::string & version () const
 access version
 ~DTPerformance ()

Private Member Functions

void cacheMap () const
 read and store full content
std::string mapName () const

Private Attributes

std::vector< std::pair
< DTPerformanceId,
DTPerformanceData > > 
dataList
std::string dataVersion
DTBufferTree< int, int > * dBuf
float nsPerCount

Detailed Description

Description: Class to hold drift tubes performances ( SL by SL )

Date:
2010/01/20 18:37:52
Revision:
1.4
Author:
Paolo Ronchese INFN Padova

Definition at line 69 of file DTPerformance.h.


Member Typedef Documentation

Access methods to data.

Definition at line 196 of file DTPerformance.h.


Constructor & Destructor Documentation

DTPerformance::DTPerformance ( )

Constructor

Definition at line 34 of file DTPerformance.cc.

References dataList, and dBuf.

                            :
  dataVersion( " " ) {
  dataList.reserve( 1000 );
  dBuf = 0;
}
DTPerformance::DTPerformance ( const std::string &  version)

Definition at line 41 of file DTPerformance.cc.

References dataList, and dBuf.

                                                      :
  dataVersion( version ) {
  dataList.reserve( 1000 );
  dBuf = 0;
}
DTPerformance::~DTPerformance ( )

Destructor

Definition at line 70 of file DTPerformance.cc.

References dBuf.

                              {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
}

Member Function Documentation

DTPerformance::const_iterator DTPerformance::begin ( void  ) const

Definition at line 299 of file DTPerformance.cc.

References dataList.

                                                       {
  return dataList.begin();
}
void DTPerformance::cacheMap ( ) const [private]

read and store full content

Definition at line 316 of file DTPerformance.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::insert(), and DTPerformanceId::stationId.

Referenced by get(), and set().

                                   {

//  std::string mName = mapName();
//  DTBufferTree<int,int>* dBuf =
//  DTDataBuffer<int,int>::openBuffer( mName );
  DTBufferTree<int,int>** pBuf;
  pBuf = const_cast<DTBufferTree<int,int>**>( &dBuf );
  *pBuf = new DTBufferTree<int,int>;

  int entryNum = 0;
  int entryMax = dataList.size();
  std::vector<int> chanKey;
  chanKey.reserve(6);
  while ( entryNum < entryMax ) {

    const DTPerformanceId& chan = dataList[entryNum].first;

    chanKey.clear();
    chanKey.push_back( chan.  wheelId );
    chanKey.push_back( chan.stationId );
    chanKey.push_back( chan. sectorId );
    chanKey.push_back( chan.     slId );
    dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );

  }

  return;

}
void DTPerformance::clear ( void  )

reset content

Definition at line 187 of file DTPerformance.cc.

References dataList, and dBuf.

                          {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
  dBuf = 0;
  dataList.clear();
  return;
}
DTPerformance::const_iterator DTPerformance::end ( void  ) const

Definition at line 304 of file DTPerformance.cc.

References dataList.

                                                     {
  return dataList.end();
}
int DTPerformance::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  meanT0,
float &  meanTtrig,
float &  meanMtime,
float &  meanNoise,
float &  meanAfterPulse,
float &  meanResolution,
float &  meanEfficiency,
DTTimeUnits::type  unit 
) const

Definition at line 87 of file DTPerformance.cc.

References cacheMap(), data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTPerformanceData::meanAfterPulse, DTPerformanceData::meanEfficiency, DTPerformanceData::meanMtime, DTPerformanceData::meanNoise, DTPerformanceData::meanResolution, DTPerformanceData::meanT0, DTPerformanceData::meanTtrig, DTTimeUnits::ns, nsPerCount, and edm::second().

                                                     {

  meanT0         =
  meanTtrig      =
  meanMtime      =
  meanNoise      =
  meanAfterPulse =
  meanResolution =
  meanEfficiency = 0.0;

//  std::string mName = mapName();
//  DTBufferTree<int,int>* dBuf =
//  DTDataBuffer<int,int>::findBuffer( mName );
//  if ( dBuf == 0 ) {
//    cacheMap();
//    dBuf =
//    DTDataBuffer<int,int>::findBuffer( mName );
//  }
  if ( dBuf == 0 ) cacheMap();

  std::vector<int> chanKey;
  chanKey.reserve(4);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
  if ( !searchStatus ) {
    const DTPerformanceData& data( dataList[ientry].second );
    meanT0         = data.meanT0;
    meanTtrig      = data.meanTtrig;
    meanMtime      = data.meanMtime;
    meanNoise      = data.meanNoise;
    meanAfterPulse = data.meanAfterPulse;
    meanResolution = data.meanResolution;
    meanEfficiency = data.meanEfficiency;
    if ( unit == DTTimeUnits::ns ) {
      meanT0    *= nsPerCount;
      meanTtrig *= nsPerCount;
      meanMtime *= nsPerCount;
    }
  }

  return searchStatus;

}
int DTPerformance::get ( const DTSuperLayerId id,
float &  meanT0,
float &  meanTtrig,
float &  meanMtime,
float &  meanNoise,
float &  meanAfterPulse,
float &  meanResolution,
float &  meanEfficiency,
DTTimeUnits::type  unit 
) const

Definition at line 147 of file DTPerformance.cc.

References unit().

                                                     {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(),
              meanT0,
              meanTtrig,
              meanMtime,
              meanNoise,
              meanAfterPulse,
              meanResolution,
              meanEfficiency,
              unit );
}
std::string DTPerformance::mapName ( ) const [private]

Definition at line 309 of file DTPerformance.cc.

References dataVersion, and mergeVDriftHistosByStation::name.

                                       {
  std::stringstream name;
  name << dataVersion << "_map_Performance" << this;
  return name.str();
}
int DTPerformance::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float  meanT0,
float  meanTtrig,
float  meanMtime,
float  meanNoise,
float  meanAfterPulse,
float  meanResolution,
float  meanEfficiency,
DTTimeUnits::type  unit 
)

Definition at line 196 of file DTPerformance.cc.

References cacheMap(), data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), combine::key, DTPerformanceData::meanAfterPulse, DTPerformanceData::meanEfficiency, DTPerformanceData::meanMtime, DTPerformanceData::meanNoise, DTPerformanceData::meanResolution, DTPerformanceData::meanT0, DTPerformanceData::meanTtrig, DTTimeUnits::ns, nsPerCount, edm::second(), and DTPerformanceId::stationId.

Referenced by DTPerformanceHandler::getNewObjects().

                                               {

  if ( unit == DTTimeUnits::ns ) {
    meanT0    /= nsPerCount;
    meanTtrig /= nsPerCount;
    meanMtime /= nsPerCount;
  }

//  std::string mName = mapName();
//  DTBufferTree<int,int>* dBuf =
//  DTDataBuffer<int,int>::findBuffer( mName );
//  if ( dBuf == 0 ) {
//    cacheMap();
//    dBuf =
//    DTDataBuffer<int,int>::findBuffer( mName );
//  }
  if ( dBuf == 0 ) cacheMap();
  std::vector<int> chanKey;
  chanKey.reserve(4);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );

  if ( !searchStatus ) {
    DTPerformanceData& data( dataList[ientry].second );
    data.meanT0         = meanT0;
    data.meanTtrig      = meanTtrig;
    data.meanMtime      = meanMtime;
    data.meanNoise      = meanNoise;
    data.meanAfterPulse = meanAfterPulse;
    data.meanResolution = meanResolution;
    data.meanEfficiency = meanEfficiency;
    return -1;
  }
  else {
    DTPerformanceId key;
    key.  wheelId =   wheelId;
    key.stationId = stationId;
    key. sectorId =  sectorId;
    key.     slId =      slId;
    DTPerformanceData data;
    data.meanT0         = meanT0;
    data.meanTtrig      = meanTtrig;
    data.meanMtime      = meanMtime;
    data.meanNoise      = meanNoise;
    data.meanAfterPulse = meanAfterPulse;
    data.meanResolution = meanResolution;
    data.meanEfficiency = meanEfficiency;
    ientry = dataList.size();
    dataList.push_back( std::pair<DTPerformanceId,DTPerformanceData>(
                        key, data ) );
    dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
    return 0;
  }

  return 99;

}
int DTPerformance::set ( const DTSuperLayerId id,
float  meanT0,
float  meanTtrig,
float  meanMtime,
float  meanNoise,
float  meanAfterPulse,
float  meanResolution,
float  meanEfficiency,
DTTimeUnits::type  unit 
)

Definition at line 270 of file DTPerformance.cc.

References unit().

                                               {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(),
              meanT0,
              meanTtrig,
              meanMtime,
              meanNoise,
              meanAfterPulse,
              meanResolution,
              meanEfficiency,
              unit );
}
int DTPerformance::setSLPerformance ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float  meanT0,
float  meanTtrig,
float  meanMtime,
float  meanNoise,
float  meanAfterPulse,
float  meanResolution,
float  meanEfficiency,
DTTimeUnits::type  unit 
) [inline]

Definition at line 143 of file DTPerformance.h.

References unit().

      { return set( wheelId, stationId, sectorId, slId,
                    meanT0, meanTtrig, meanMtime, meanNoise, meanAfterPulse,
                    meanResolution, meanEfficiency, unit ); };
int DTPerformance::setSLPerformance ( const DTSuperLayerId id,
float  meanT0,
float  meanTtrig,
float  meanMtime,
float  meanNoise,
float  meanAfterPulse,
float  meanResolution,
float  meanEfficiency,
DTTimeUnits::type  unit 
) [inline]

Definition at line 158 of file DTPerformance.h.

References unit().

      { return set( id,
                    meanT0, meanTtrig, meanMtime, meanNoise, meanAfterPulse,
                    meanResolution, meanEfficiency, unit ); };
void DTPerformance::setUnit ( float  unit)

Definition at line 294 of file DTPerformance.cc.

References nsPerCount, and unit().

                                        {
  nsPerCount = unit;
}
int DTPerformance::slPerformance ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  meanT0,
float &  meanTtrig,
float &  meanMtime,
float &  meanNoise,
float &  meanAfterPulse,
float &  meanResolution,
float &  meanEfficiency,
DTTimeUnits::type  unit 
) const [inline]

get content

Operations

Definition at line 85 of file DTPerformance.h.

References unit().

      { return get( wheelId, stationId, sectorId, slId,
                    meanT0, meanTtrig, meanMtime, meanNoise, meanAfterPulse, 
                    meanResolution, meanEfficiency, unit ); };
int DTPerformance::slPerformance ( const DTSuperLayerId id,
float &  meanT0,
float &  meanTtrig,
float &  meanMtime,
float &  meanNoise,
float &  meanAfterPulse,
float &  meanResolution,
float &  meanEfficiency,
DTTimeUnits::type  unit 
) const [inline]

Definition at line 100 of file DTPerformance.h.

References unit().

      { return get( id,
                    meanT0, meanTtrig, meanMtime, meanNoise, meanAfterPulse,
                    meanResolution, meanEfficiency, unit ); };
float DTPerformance::unit ( ) const

Definition at line 171 of file DTPerformance.cc.

References nsPerCount.

Referenced by get(), set(), setSLPerformance(), setUnit(), and slPerformance().

                                {
  return nsPerCount;
}
const std::string & DTPerformance::version ( ) const

access version

Definition at line 177 of file DTPerformance.cc.

References dataVersion.

                                        {
  return dataVersion;
}
std::string & DTPerformance::version ( )

Definition at line 182 of file DTPerformance.cc.

References dataVersion.

                                  {
  return dataVersion;
}

Member Data Documentation

std::vector< std::pair<DTPerformanceId,DTPerformanceData> > DTPerformance::dataList [private]

Definition at line 205 of file DTPerformance.h.

Referenced by begin(), cacheMap(), clear(), DTPerformance(), end(), get(), and set().

std::string DTPerformance::dataVersion [private]

Definition at line 202 of file DTPerformance.h.

Referenced by mapName(), and version().

DTBufferTree<int,int>* DTPerformance::dBuf [private]

Definition at line 207 of file DTPerformance.h.

Referenced by cacheMap(), clear(), DTPerformance(), get(), set(), and ~DTPerformance().

float DTPerformance::nsPerCount [private]

Definition at line 203 of file DTPerformance.h.

Referenced by get(), set(), setUnit(), and unit().