CMS 3D CMS Logo

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

DTMtime Class Reference

#include <DTMtime.h>

List of all members.

Public Types

typedef std::vector< std::pair
< DTMtimeId, DTMtimeData >
>::const_iterator 
const_iterator
 Access methods to data.

Public Member Functions

const_iterator begin () const
void clear ()
 reset content
 DTMtime ()
 DTMtime (const std::string &version)
const_iterator end () const
int get (int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
int get (int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTVelocityUnits::type unit) const
int get (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
int get (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &mTime, float &mTrms, DTVelocityUnits::type unit) const
int get (const DTSuperLayerId &id, float &mTime, float &mTrms, DTTimeUnits::type unit) const
int get (const DTSuperLayerId &id, float &mTime, float &mTrms, DTVelocityUnits::type unit) const
int get (const DetId &id, float &mTime, float &mTrms, DTTimeUnits::type unit) const
int get (const DetId &id, float &mTime, float &mTrms, DTVelocityUnits::type unit) const
int set (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float mTime, float mTrms, DTVelocityUnits::type unit)
int set (const DetId &id, float mTime, float mTrms, DTTimeUnits::type unit)
int set (const DetId &id, float mTime, float mTrms, DTVelocityUnits::type unit)
int set (const DTSuperLayerId &id, float mTime, float mTrms, DTVelocityUnits::type unit)
int set (int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTTimeUnits::type unit)
int set (int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTVelocityUnits::type unit)
int set (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float mTime, float mTrms, DTTimeUnits::type unit)
int set (const DTSuperLayerId &id, float mTime, float mTrms, DTTimeUnits::type unit)
int setSLMtime (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float mTime, float mTrms, DTTimeUnits::type unit)
int setSLMtime (int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTTimeUnits::type unit)
int setSLMtime (const DTSuperLayerId &id, float mTime, float mTrms, DTTimeUnits::type unit)
int setSLMtime (const DetId &id, float mTime, float mTrms, DTTimeUnits::type unit)
void setUnit (float unit)
int slMtime (int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
 get content
int slMtime (const DetId &id, float &mTime, float &mTrms, DTTimeUnits::type unit) const
int slMtime (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
int slMtime (const DTSuperLayerId &id, float &mTime, float &mTrms, DTTimeUnits::type unit) const
float unit () const
std::string & version ()
const std::string & version () const
 access version
 ~DTMtime ()

Private Member Functions

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

Private Attributes

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

Detailed Description

Description: Class to hold drift tubes mean-times ( SL by SL mean-time calculation )

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

Definition at line 69 of file DTMtime.h.


Member Typedef Documentation

typedef std::vector< std::pair<DTMtimeId, DTMtimeData> >::const_iterator DTMtime::const_iterator

Access methods to data.

Definition at line 256 of file DTMtime.h.


Constructor & Destructor Documentation

DTMtime::DTMtime ( )

Constructor

Definition at line 34 of file DTMtime.cc.

References dataList, and dBuf.

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

Definition at line 42 of file DTMtime.cc.

References dataList, and dBuf.

                                          :
  dataVersion( version ),
  nsPerCount( 25.0 / 32.0 ) {
  dataList.reserve( 1000 );
  dBuf = 0;
}
DTMtime::~DTMtime ( )

Destructor

Definition at line 69 of file DTMtime.cc.

References dBuf.

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

Member Function Documentation

DTMtime::const_iterator DTMtime::begin ( void  ) const

Definition at line 439 of file DTMtime.cc.

References dataList.

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

read and store full content

Definition at line 456 of file DTMtime.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::insert(), and DTMtimeId::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 DTMtimeId& 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 );
    chanKey.push_back( chan.  layerId );
    chanKey.push_back( chan.   cellId );
    dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );

  }

  return;

}
void DTMtime::clear ( void  )

reset content

Definition at line 257 of file DTMtime.cc.

References dataList, and dBuf.

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

Definition at line 444 of file DTMtime.cc.

References dataList.

                                         {
  return dataList.end();
}
int DTMtime::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const

Definition at line 86 of file DTMtime.cc.

References unit().

Referenced by DTLinearDriftFromDBAlgo::compute().

                                               {
  return get( wheelId, stationId, sectorId,
                 slId,         0,        0,
                mTime, mTrms, unit );

}
int DTMtime::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float &  mTime,
float &  mTrms,
DTVelocityUnits::type  unit 
) const

Definition at line 162 of file DTMtime.cc.

References DTVelocityUnits::cm_per_count, DTVelocityUnits::cm_per_ns, DTTimeUnits::counts, nsPerCount, and ntuplemaker::status.

                                                   {
  int status = get( wheelId, stationId, sectorId,
                       slId,   layerId,   cellId,
                      mTime, mTrms, DTTimeUnits::counts );
  if ( unit == DTVelocityUnits::cm_per_count ) {
    mTime  = 2.1 / mTime;
    mTrms *= mTime;
  }
  if ( unit == DTVelocityUnits::cm_per_ns ) {
    mTime  = 2.1 / mTime;
    mTrms *= mTime;
    mTime /= nsPerCount;
  }
  return status;
}
int DTMtime::get ( const DTSuperLayerId id,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const

Definition at line 187 of file DTMtime.cc.

References unit().

                                               {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(), 0, 0,
              mTime, mTrms, unit );
}
int DTMtime::get ( const DTSuperLayerId id,
float &  mTime,
float &  mTrms,
DTVelocityUnits::type  unit 
) const

Definition at line 199 of file DTMtime.cc.

References unit().

                                                   {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(), 0, 0,
              mTime, mTrms, unit );
}
int DTMtime::get ( const DetId id,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const

Definition at line 211 of file DTMtime.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), unit(), DTChamberId::wheel(), and DTWireId::wire().

                                               {
  DTWireId wireId( id.rawId() );
  return get( wireId.wheel(),
              wireId.station(),
              wireId.sector(),
              wireId.superLayer(),
              wireId.layer(),
              wireId.wire(),
              mTime, mTrms, unit );
}
int DTMtime::get ( const DetId id,
float &  mTime,
float &  mTrms,
DTVelocityUnits::type  unit 
) const

Definition at line 226 of file DTMtime.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), unit(), DTChamberId::wheel(), and DTWireId::wire().

                                                   {
  DTWireId wireId( id.rawId() );
  return get( wireId.wheel(),
              wireId.station(),
              wireId.sector(),
              wireId.superLayer(),
              wireId.layer(),
              wireId.wire(),
              mTime, mTrms, unit );
}
int DTMtime::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  mTime,
float &  mTrms,
DTVelocityUnits::type  unit 
) const

Definition at line 100 of file DTMtime.cc.

References unit().

                                                   {
  return get( wheelId, stationId, sectorId,
                 slId,         0,        0,
                mTime, mTrms, unit );

}
int DTMtime::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const

Definition at line 114 of file DTMtime.cc.

References cacheMap(), runTheMatrix::data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTMtimeData::mTime, DTMtimeData::mTrms, DTTimeUnits::ns, nsPerCount, and edm::second().

                                               {

  mTime =
  mTrms = 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(6);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  chanKey.push_back(   layerId );
  chanKey.push_back(    cellId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
  if ( !searchStatus ) {
    const DTMtimeData& data( dataList[ientry].second );
    mTime = data.mTime;
    mTrms = data.mTrms;
    if ( unit == DTTimeUnits::ns ) {
      mTime *= nsPerCount;
      mTrms *= nsPerCount;
    }
  }

  return searchStatus;

}
std::string DTMtime::mapName ( ) const [private]

Definition at line 449 of file DTMtime.cc.

References dataVersion, and AlCaRecoCosmics_cfg::name.

                                 {
  std::stringstream name;
  name << dataVersion << "_map_Mtime" << this;
  return name.str();
}
int DTMtime::set ( const DetId id,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
)

Definition at line 404 of file DTMtime.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), unit(), DTChamberId::wheel(), and DTWireId::wire().

                                         {
  DTWireId wireId( id.rawId() );
  return set( wireId.wheel(),
              wireId.station(),
              wireId.sector(),
              wireId.superLayer(),
              wireId.layer(),
              wireId.wire(),
              mTime, mTrms, unit );
}
int DTMtime::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
)

Definition at line 266 of file DTMtime.cc.

References unit().

Referenced by DTVDriftCalibration::endJob(), DTMtimeHandler::getNewObjects(), and DTFakeVDriftESProducer::produce().

                                         {
  return set( wheelId, stationId, sectorId,
                 slId,         0,        0,
                mTime, mTrms, unit );
}
int DTMtime::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float  mTime,
float  mTrms,
DTVelocityUnits::type  unit 
)

Definition at line 279 of file DTMtime.cc.

References unit().

                                             {
  return set( wheelId, stationId, sectorId,
                 slId,         0,        0,
                mTime, mTrms, unit );
}
int DTMtime::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
)

Definition at line 292 of file DTMtime.cc.

References cacheMap(), runTheMatrix::data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), combine::key, DTMtimeData::mTime, DTMtimeData::mTrms, DTTimeUnits::ns, nsPerCount, edm::second(), and DTMtimeId::stationId.

                                         {

  if ( unit == DTTimeUnits::ns ) {
    mTime /= nsPerCount;
    mTrms /= 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(6);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  chanKey.push_back(   layerId );
  chanKey.push_back(    cellId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );

  if ( !searchStatus ) {
    DTMtimeData& data( dataList[ientry].second );
    data.mTime = mTime;
    data.mTrms = mTrms;
    return -1;
  }
  else {
    DTMtimeId key;
    key.  wheelId =   wheelId;
    key.stationId = stationId;
    key. sectorId =  sectorId;
    key.     slId =      slId;
    key.  layerId =   layerId;
    key.   cellId =    cellId;
    DTMtimeData data;
    data.mTime = mTime;
    data.mTrms = mTrms;
    ientry = dataList.size();
    dataList.push_back( std::pair<DTMtimeId,DTMtimeData>( key, data ) );
    dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
    return 0;
  }

  return 99;

}
int DTMtime::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float  mTime,
float  mTrms,
DTVelocityUnits::type  unit 
)

Definition at line 355 of file DTMtime.cc.

References DTVelocityUnits::cm_per_count, DTVelocityUnits::cm_per_ns, DTTimeUnits::counts, and nsPerCount.

                                             {
  if ( unit == DTVelocityUnits::cm_per_count ) {
    mTrms /= mTime;
    mTime  = 2.1 / mTime;
  }
  if ( unit == DTVelocityUnits::cm_per_ns ) {
    mTime *= nsPerCount;
    mTrms /= mTime;
    mTime  = 2.1 / mTime;
  }
  return set( wheelId, stationId, sectorId,
                 slId,   layerId,   cellId,
                mTime, mTrms, DTTimeUnits::counts );

}
int DTMtime::set ( const DTSuperLayerId id,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
)

Definition at line 380 of file DTMtime.cc.

References unit().

                                         {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(), 0, 0,
              mTime, mTrms, unit );
}
int DTMtime::set ( const DTSuperLayerId id,
float  mTime,
float  mTrms,
DTVelocityUnits::type  unit 
)

Definition at line 392 of file DTMtime.cc.

References unit().

                                             {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(), 0, 0,
              mTime, mTrms, unit );
}
int DTMtime::set ( const DetId id,
float  mTime,
float  mTrms,
DTVelocityUnits::type  unit 
)

Definition at line 419 of file DTMtime.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), unit(), DTChamberId::wheel(), and DTWireId::wire().

                                             {
  DTWireId wireId( id.rawId() );
  return set( wireId.wheel(),
              wireId.station(),
              wireId.sector(),
              wireId.superLayer(),
              wireId.layer(),
              wireId.wire(),
              mTime, mTrms, unit );
}
int DTMtime::setSLMtime ( const DTSuperLayerId id,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
) [inline]

Definition at line 193 of file DTMtime.h.

References ExpressReco_HICollisions_FallBack::id, and unit().

      { return set( id, mTime, mTrms, unit ); };
int DTMtime::setSLMtime ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
) [inline]

Definition at line 173 of file DTMtime.h.

References unit().

      { return set( wheelId, stationId, sectorId, slId, 0, 0,
                    mTime, mTrms, unit ); };
int DTMtime::setSLMtime ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
) [inline]

Definition at line 182 of file DTMtime.h.

References unit().

      { return set( wheelId, stationId, sectorId, slId, layerId, cellId,
                    mTime, mTrms, unit ); };
int DTMtime::setSLMtime ( const DetId id,
float  mTime,
float  mTrms,
DTTimeUnits::type  unit 
) [inline]

Definition at line 198 of file DTMtime.h.

References ExpressReco_HICollisions_FallBack::id, and unit().

      { return set( id, mTime, mTrms, unit ); };
void DTMtime::setUnit ( float  unit)

Definition at line 434 of file DTMtime.cc.

References nsPerCount, and unit().

                                  {
  nsPerCount = unit;
}
int DTMtime::slMtime ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const [inline]

Definition at line 94 of file DTMtime.h.

References unit().

      { return get( wheelId, stationId, sectorId, slId, layerId, cellId,
                    mTime, mTrms, unit ); };
int DTMtime::slMtime ( const DetId id,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const [inline]

Definition at line 110 of file DTMtime.h.

References ExpressReco_HICollisions_FallBack::id, and unit().

      { return get( id, mTime, mTrms, unit ); };
int DTMtime::slMtime ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const [inline]

get content

Operations

Definition at line 85 of file DTMtime.h.

References unit().

      { return get( wheelId, stationId, sectorId, slId, 0, 0,
                    mTime, mTrms, unit ); };
int DTMtime::slMtime ( const DTSuperLayerId id,
float &  mTime,
float &  mTrms,
DTTimeUnits::type  unit 
) const [inline]

Definition at line 105 of file DTMtime.h.

References ExpressReco_HICollisions_FallBack::id, and unit().

      { return get( id, mTime, mTrms, unit ); };
float DTMtime::unit ( ) const

Definition at line 241 of file DTMtime.cc.

References nsPerCount.

Referenced by get(), set(), setSLMtime(), setUnit(), and slMtime().

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

access version

Definition at line 247 of file DTMtime.cc.

References dataVersion.

Referenced by DTLinearDriftFromDBAlgo::setES().

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

Definition at line 252 of file DTMtime.cc.

References dataVersion.

                            {
  return dataVersion;
}

Member Data Documentation

std::vector< std::pair<DTMtimeId,DTMtimeData> > DTMtime::dataList [private]

Definition at line 265 of file DTMtime.h.

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

std::string DTMtime::dataVersion [private]

Definition at line 262 of file DTMtime.h.

Referenced by mapName(), and version().

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

Definition at line 267 of file DTMtime.h.

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

float DTMtime::nsPerCount [private]

Definition at line 263 of file DTMtime.h.

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