CMS 3D CMS Logo

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

DTRangeT0 Class Reference

#include <DTRangeT0.h>

List of all members.

Public Types

typedef std::vector< std::pair
< DTRangeT0Id, DTRangeT0Data >
>::const_iterator 
const_iterator
 Access methods to data.

Public Member Functions

const_iterator begin () const
void clear ()
 reset content
 DTRangeT0 ()
 DTRangeT0 (const std::string &version)
const_iterator end () const
int get (int wheelId, int stationId, int sectorId, int slId, int &t0min, int &t0max) const
int get (const DTSuperLayerId &id, int &t0min, int &t0max) const
int set (const DTSuperLayerId &id, int t0min, int t0max)
int set (int wheelId, int stationId, int sectorId, int slId, int t0min, int t0max)
int setSLRangeT0 (const DTSuperLayerId &id, int t0min, int t0max)
int setSLRangeT0 (int wheelId, int stationId, int sectorId, int slId, int t0min, int t0max)
int slRangeT0 (const DTSuperLayerId &id, int &t0min, int &t0max) const
int slRangeT0 (int wheelId, int stationId, int sectorId, int slId, int &t0min, int &t0max) const
 get content
const std::string & version () const
 access version
std::string & version ()
 ~DTRangeT0 ()

Private Member Functions

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

Private Attributes

std::vector< std::pair
< DTRangeT0Id, DTRangeT0Data > > 
dataList
std::string dataVersion
DTBufferTree< int, int > * dBuf

Detailed Description

Description: Class to hold drift tubes T0 range ( SL by SL min - max T0 )

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

Definition at line 64 of file DTRangeT0.h.


Member Typedef Documentation

Access methods to data.

Definition at line 134 of file DTRangeT0.h.


Constructor & Destructor Documentation

DTRangeT0::DTRangeT0 ( )

Constructor

Definition at line 34 of file DTRangeT0.cc.

References dataList, and dBuf.

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

Definition at line 41 of file DTRangeT0.cc.

References dataList, and dBuf.

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

Destructor

Definition at line 65 of file DTRangeT0.cc.

References dBuf.

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

Member Function Documentation

DTRangeT0::const_iterator DTRangeT0::begin ( void  ) const

Definition at line 214 of file DTRangeT0.cc.

References dataList.

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

read and store full content

Definition at line 231 of file DTRangeT0.cc.

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

    const DTRangeT0Id& 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 DTRangeT0::clear ( void  )

reset content

Definition at line 143 of file DTRangeT0.cc.

References dataList, and dBuf.

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

Definition at line 219 of file DTRangeT0.cc.

References dataList.

                                             {
  return dataList.end();
}
int DTRangeT0::get ( const DTSuperLayerId id,
int &  t0min,
int &  t0max 
) const

Definition at line 121 of file DTRangeT0.cc.

                                          {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(),
              t0min, t0max );
}
int DTRangeT0::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int &  t0min,
int &  t0max 
) const

Definition at line 82 of file DTRangeT0.cc.

References cacheMap(), runTheMatrix::data, dataList, dBuf, DTBufferTree< Key, Content >::find(), edm::second(), DTRangeT0Data::t0max, and DTRangeT0Data::t0min.

                                          {

  t0min =
  t0max = 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 DTRangeT0Data& data( dataList[ientry].second );
    t0min = data.t0min;
    t0max = data.t0max;
  }

  return searchStatus;

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

Definition at line 224 of file DTRangeT0.cc.

References dataVersion, and AlCaRecoCosmics_cfg::name.

                                   {
  std::stringstream name;
  name << dataVersion << "_map_RangeT0" << this;
  return name.str();
}
int DTRangeT0::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  t0min,
int  t0max 
)

Definition at line 152 of file DTRangeT0.cc.

References cacheMap(), runTheMatrix::data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), combine::key, edm::second(), DTRangeT0Id::stationId, DTRangeT0Data::t0max, and DTRangeT0Data::t0min.

Referenced by DTRangeT0Handler::getNewObjects().

                                    {

//  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 ) {
    DTRangeT0Data& data( dataList[ientry].second );
    data.t0min = t0min;
    data.t0max = t0max;
    return -1;
  }
  else {
    DTRangeT0Id key;
    key.  wheelId =   wheelId;
    key.stationId = stationId;
    key. sectorId =  sectorId;
    key.     slId =      slId;
    DTRangeT0Data data;
    data.t0min = t0min;
    data.t0max = t0max;
    ientry = dataList.size();
    dataList.push_back( std::pair<DTRangeT0Id,DTRangeT0Data>( key, data ) );
    dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
    return 0;
  }

  return 99;

}
int DTRangeT0::set ( const DTSuperLayerId id,
int  t0min,
int  t0max 
)

Definition at line 203 of file DTRangeT0.cc.

                                {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(),
              t0min, t0max );
}
int DTRangeT0::setSLRangeT0 ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  t0min,
int  t0max 
) [inline]

Definition at line 110 of file DTRangeT0.h.

      { return set( wheelId, stationId, sectorId, slId, t0min, t0max ); };
int DTRangeT0::setSLRangeT0 ( const DTSuperLayerId id,
int  t0min,
int  t0max 
) [inline]

Definition at line 117 of file DTRangeT0.h.

References ExpressReco_HICollisions_FallBack::id.

      { return set( id, t0min, t0max ); };
int DTRangeT0::slRangeT0 ( const DTSuperLayerId id,
int &  t0min,
int &  t0max 
) const [inline]

Definition at line 88 of file DTRangeT0.h.

References ExpressReco_HICollisions_FallBack::id.

      { return get( id, t0min, t0max ); };
int DTRangeT0::slRangeT0 ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int &  t0min,
int &  t0max 
) const [inline]

get content

Operations

Definition at line 80 of file DTRangeT0.h.

      { return get( wheelId, stationId, sectorId, slId,
                    t0min, t0max ); };
const std::string & DTRangeT0::version ( ) const

access version

Definition at line 133 of file DTRangeT0.cc.

References dataVersion.

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

Definition at line 138 of file DTRangeT0.cc.

References dataVersion.

                              {
  return dataVersion;
}

Member Data Documentation

std::vector< std::pair<DTRangeT0Id,DTRangeT0Data> > DTRangeT0::dataList [private]

Definition at line 142 of file DTRangeT0.h.

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

std::string DTRangeT0::dataVersion [private]

Definition at line 140 of file DTRangeT0.h.

Referenced by mapName(), and version().

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

Definition at line 144 of file DTRangeT0.h.

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