CMS 3D CMS Logo

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

DTTPGParameters Class Reference

#include <DTTPGParameters.h>

List of all members.

Public Types

typedef std::vector< std::pair
< DTTPGParametersId,
DTTPGParametersData >
>::const_iterator 
const_iterator
 Access methods to data.

Public Member Functions

const_iterator begin () const
void clear ()
 reset content
int clock () const
 DTTPGParameters ()
 DTTPGParameters (const std::string &version)
const_iterator end () const
int get (int wheelId, int stationId, int sectorId, int &nc, float &ph, DTTimeUnits::type unit) const
 get content
int get (const DTChamberId &id, int &nc, float &ph, DTTimeUnits::type unit) const
int set (int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
int set (const DTChamberId &id, int nc, float ph, DTTimeUnits::type unit)
void setClock (int clock)
void setUnit (float unit)
float totalTime (const DTChamberId &id, DTTimeUnits::type unit) const
float totalTime (int wheelId, int stationId, int sectorId, DTTimeUnits::type unit) const
float unit () const
std::string & version ()
const std::string & version () const
 access version
 ~DTTPGParameters ()

Private Member Functions

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

Private Attributes

int clockLength
std::vector< std::pair
< DTTPGParametersId,
DTTPGParametersData > > 
dataList
std::string dataVersion
DTBufferTree< int, int > * dBuf
float nsPerCount

Detailed Description

Description: Class to hold drift tubes TPG parameters

Date:
2010/01/20 18:20:08
Revision:
1.3
Author:
Paolo Ronchese INFN Padova

Definition at line 63 of file DTTPGParameters.h.


Member Typedef Documentation

Access methods to data.

Definition at line 122 of file DTTPGParameters.h.


Constructor & Destructor Documentation

DTTPGParameters::DTTPGParameters ( )

Constructor

Definition at line 34 of file DTTPGParameters.cc.

References dataList, and dBuf.

                                :
  dataVersion( " " ),
  nsPerCount( 25.0 / 32.0 ),
  clockLength( 32 ) {
  dataList.reserve( 250 );
  dBuf = 0;
}
DTTPGParameters::DTTPGParameters ( const std::string &  version)

Definition at line 43 of file DTTPGParameters.cc.

References dataList, and dBuf.

                                                          :
  dataVersion( version ),
  nsPerCount( 25.0 / 32.0 ),
  clockLength( 32 ) {
  dataList.reserve( 250 );
  dBuf = 0;
}
DTTPGParameters::~DTTPGParameters ( )

Destructor

Definition at line 68 of file DTTPGParameters.cc.

References dBuf.

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

Member Function Documentation

DTTPGParameters::const_iterator DTTPGParameters::begin ( void  ) const

Definition at line 263 of file DTTPGParameters.cc.

References dataList.

Referenced by DTLocalTriggerSynchTest::endJob().

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

read and store full content

Definition at line 280 of file DTTPGParameters.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::insert(), and DTTPGParametersId::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(3);
  while ( entryNum < entryMax ) {

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

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

  }

  return;

}
void DTTPGParameters::clear ( void  )

reset content

Definition at line 179 of file DTTPGParameters.cc.

References dataList, and dBuf.

                            {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
  dBuf = 0;
  dataList.clear();
  return;
}
int DTTPGParameters::clock ( ) const

Definition at line 158 of file DTTPGParameters.cc.

References clockLength.

Referenced by setClock(), and totalTime().

                                 {
  return clockLength;
}
DTTPGParameters::const_iterator DTTPGParameters::end ( void  ) const

Definition at line 268 of file DTTPGParameters.cc.

References dataList.

Referenced by DTLocalTriggerSynchTest::endJob().

                                                         {
  return dataList.end();
}
int DTTPGParameters::get ( int  wheelId,
int  stationId,
int  sectorId,
int &  nc,
float &  ph,
DTTimeUnits::type  unit 
) const

get content

Operations

Definition at line 85 of file DTTPGParameters.cc.

References cacheMap(), AlCaHLTBitMon_QueryRunRegistry::data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTTPGParametersData::nClock, DTTimeUnits::ns, nsPerCount, edm::second(), and DTTPGParametersData::tPhase.

Referenced by DTConfigPedestals::getOffset(), and DTConfigPedestals::print().

                                                       {

  nc = 0;
  ph = 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(3);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
  if ( !searchStatus ) {
    const DTTPGParametersData& data( dataList[ientry].second );
    nc = data.nClock;
    ph = data.tPhase;
    if ( unit == DTTimeUnits::ns ) {
      ph *= nsPerCount;
    }
  }

  return searchStatus;

}
int DTTPGParameters::get ( const DTChamberId id,
int &  nc,
float &  ph,
DTTimeUnits::type  unit 
) const

Definition at line 126 of file DTTPGParameters.cc.

References unit().

                                                       {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              nc, ph, unit );
}
std::string DTTPGParameters::mapName ( ) const [private]

Definition at line 273 of file DTTPGParameters.cc.

References dataVersion, and mergeVDriftHistosByStation::name.

                                         {
  std::stringstream name;
  name << dataVersion << "_map_TTPG" << this;
  return name.str();
}
int DTTPGParameters::set ( const DTChamberId id,
int  nc,
float  ph,
DTTimeUnits::type  unit 
)

Definition at line 242 of file DTTPGParameters.cc.

References unit().

                                                 {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              nc, ph, unit );
}
int DTTPGParameters::set ( int  wheelId,
int  stationId,
int  sectorId,
int  nc,
float  ph,
DTTimeUnits::type  unit 
)

Definition at line 188 of file DTTPGParameters.cc.

References cacheMap(), AlCaHLTBitMon_QueryRunRegistry::data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), combine::key, DTTPGParametersData::nClock, DTTimeUnits::ns, nsPerCount, edm::second(), DTTPGParametersId::stationId, and DTTPGParametersData::tPhase.

Referenced by DTConfigTrivialProducer::buildTrivialPedestals(), DTConfigDBProducer::buildTrivialPedestals(), DTLocalTriggerSynchTest::endJob(), and DTTPGParametersHandler::getNewObjects().

                                                 {

  if ( unit == DTTimeUnits::ns ) {
    ph /= 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(3);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );

  if ( !searchStatus ) {
    DTTPGParametersData& data( dataList[ientry].second );
    data.nClock = nc;
    data.tPhase = ph;
    return -1;
  }
  else {
    DTTPGParametersId key;
    key.  wheelId =   wheelId;
    key.stationId = stationId;
    key. sectorId =  sectorId;
    DTTPGParametersData data;
    data.nClock = nc;
    data.tPhase = ph;
    ientry = dataList.size();
    dataList.push_back( std::pair<DTTPGParametersId,
                                  DTTPGParametersData>( key, data ) );
    dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
    return 0;
  }

  return 99;

}
void DTTPGParameters::setClock ( int  clock)

Definition at line 253 of file DTTPGParameters.cc.

References clock(), and clockLength.

void DTTPGParameters::setUnit ( float  unit)

Definition at line 258 of file DTTPGParameters.cc.

References nsPerCount, and unit().

                                          {
  nsPerCount = unit;
}
float DTTPGParameters::totalTime ( const DTChamberId id,
DTTimeUnits::type  unit 
) const

Definition at line 149 of file DTTPGParameters.cc.

References relativeConstraints::station, and totalTime().

                                                               {
  return totalTime( id.wheel(),
                    id.station(),
                    id.sector(),
                    unit );
}
float DTTPGParameters::totalTime ( int  wheelId,
int  stationId,
int  sectorId,
DTTimeUnits::type  unit 
) const

Definition at line 137 of file DTTPGParameters.cc.

References clock(), DTTimeUnits::ns, nsPerCount, and unit().

Referenced by totalTime().

                                                               {
  int cl = 0;
  float ph = 0.0;
  get( wheelId, stationId, sectorId, cl, ph, unit );
  if ( unit == DTTimeUnits::ns ) return ( cl * clock() * nsPerCount ) + ph;
  else                           return ( cl * clock()              ) + ph;
}
float DTTPGParameters::unit ( ) const

Definition at line 163 of file DTTPGParameters.cc.

References nsPerCount.

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

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

access version

Definition at line 169 of file DTTPGParameters.cc.

References dataVersion.

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

Definition at line 174 of file DTTPGParameters.cc.

References dataVersion.

                                    {
  return dataVersion;
}

Member Data Documentation

Definition at line 130 of file DTTPGParameters.h.

Referenced by clock(), and setClock().

Definition at line 132 of file DTTPGParameters.h.

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

std::string DTTPGParameters::dataVersion [private]

Definition at line 128 of file DTTPGParameters.h.

Referenced by mapName(), and version().

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

Definition at line 134 of file DTTPGParameters.h.

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

float DTTPGParameters::nsPerCount [private]

Definition at line 129 of file DTTPGParameters.h.

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