#include <DTTPGParameters.h>
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 |
Description: Class to hold drift tubes TPG parameters
Definition at line 63 of file DTTPGParameters.h.
typedef std::vector< std::pair<DTTPGParametersId, DTTPGParametersData> >::const_iterator DTTPGParameters::const_iterator |
Access methods to data.
Definition at line 122 of file DTTPGParameters.h.
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; }
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 | ) |
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(), 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(), 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.
{ clockLength = clock; }
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().
float DTTPGParameters::totalTime | ( | int | wheelId, |
int | stationId, | ||
int | sectorId, | ||
DTTimeUnits::type | unit | ||
) | const |
Definition at line 137 of file DTTPGParameters.cc.
References cl, 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 | ( | ) |
int DTTPGParameters::clockLength [private] |
Definition at line 130 of file DTTPGParameters.h.
Referenced by clock(), and setClock().
std::vector< std::pair<DTTPGParametersId,DTTPGParametersData> > DTTPGParameters::dataList [private] |
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.
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().