CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
DTTPGParameters Class Reference

#include <DTTPGParameters.h>

Public Types

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

Public Member Functions

const_iterator begin () const
 
void clear ()
 reset content More...
 
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 More...
 
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 (int wheelId, int stationId, int sectorId, DTTimeUnits::type unit) const
 
float totalTime (const DTChamberId &id, DTTimeUnits::type unit) const
 
float unit () const
 
const std::string & version () const
 access version More...
 
std::string & version ()
 
 ~DTTPGParameters ()
 

Private Member Functions

void cacheMap () const
 read and store full content More...
 
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.

34  :
35  dataVersion( " " ),
36  nsPerCount( 25.0 / 32.0 ),
37  clockLength( 32 ) {
38  dataList.reserve( 250 );
39  dBuf = 0;
40 }
DTBufferTree< int, int > * dBuf
std::string dataVersion
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
DTTPGParameters::DTTPGParameters ( const std::string &  version)

Definition at line 43 of file DTTPGParameters.cc.

References dataList, and dBuf.

43  :
45  nsPerCount( 25.0 / 32.0 ),
46  clockLength( 32 ) {
47  dataList.reserve( 250 );
48  dBuf = 0;
49 }
const std::string & version() const
access version
DTBufferTree< int, int > * dBuf
std::string dataVersion
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
DTTPGParameters::~DTTPGParameters ( )

Destructor

Definition at line 68 of file DTTPGParameters.cc.

References dBuf.

68  {
69 // DTDataBuffer<int,int>::dropBuffer( mapName() );
70  delete dBuf;
71 }
DTBufferTree< int, int > * 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().

263  {
264  return dataList.begin();
265 }
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
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().

280  {
281 
282 // std::string mName = mapName();
283 // DTBufferTree<int,int>* dBuf =
284 // DTDataBuffer<int,int>::openBuffer( mName );
285  DTBufferTree<int,int>** pBuf;
286  pBuf = const_cast<DTBufferTree<int,int>**>( &dBuf );
287  *pBuf = new DTBufferTree<int,int>;
288 
289  int entryNum = 0;
290  int entryMax = dataList.size();
291  std::vector<int> chanKey;
292  chanKey.reserve(3);
293  while ( entryNum < entryMax ) {
294 
295  const DTTPGParametersId& chan = dataList[entryNum].first;
296 
297  chanKey.clear();
298  chanKey.push_back( chan. wheelId );
299  chanKey.push_back( chan.stationId );
300  chanKey.push_back( chan. sectorId );
301  dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );
302 
303  }
304 
305  return;
306 
307 }
int insert(ElementKey fKey, ElementKey lKey, const Content &cont)
DTBufferTree< int, int > * dBuf
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
void DTTPGParameters::clear ( void  )
int DTTPGParameters::clock ( ) const

Definition at line 158 of file DTTPGParameters.cc.

References clockLength.

Referenced by setClock(), and totalTime().

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

Definition at line 268 of file DTTPGParameters.cc.

References dataList.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and DTLocalTriggerSynchTest::endJob().

268  {
269  return dataList.end();
270 }
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
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 Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), DTConfigPedestals::getOffset(), betterConfigParser.BetterConfigParser::getResultingSection(), and DTConfigPedestals::print().

90  {
91 
92  nc = 0;
93  ph = 0.0;
94 
95 // std::string mName = mapName();
96 // DTBufferTree<int,int>* dBuf =
97 // DTDataBuffer<int,int>::findBuffer( mName );
98 // if ( dBuf == 0 ) {
99 // cacheMap();
100 // dBuf =
101 // DTDataBuffer<int,int>::findBuffer( mName );
102 // }
103  if ( dBuf == 0 ) cacheMap();
104 
105  std::vector<int> chanKey;
106  chanKey.reserve(3);
107  chanKey.push_back( wheelId );
108  chanKey.push_back( stationId );
109  chanKey.push_back( sectorId );
110  int ientry;
111  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
112  if ( !searchStatus ) {
113  const DTTPGParametersData& data( dataList[ientry].second );
114  nc = data.nClock;
115  ph = data.tPhase;
116  if ( unit == DTTimeUnits::ns ) {
117  ph *= nsPerCount;
118  }
119  }
120 
121  return searchStatus;
122 
123 }
U second(std::pair< T, U > const &p)
DTBufferTree< int, int > * dBuf
int find(ElementKey fKey, ElementKey lKey, Content &cont)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
float unit() const
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
void cacheMap() const
read and store full content
int DTTPGParameters::get ( const DTChamberId id,
int &  nc,
float &  ph,
DTTimeUnits::type  unit 
) const
std::string DTTPGParameters::mapName ( ) const
private

Definition at line 273 of file DTTPGParameters.cc.

References dataVersion, and mergeVDriftHistosByStation::name.

273  {
274  std::stringstream name;
275  name << dataVersion << "_map_TTPG" << this;
276  return name.str();
277 }
std::string dataVersion
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(), betterConfigParser.BetterConfigParser::getGeneral(), DTTPGParametersHandler::getNewObjects(), and set().

193  {
194 
195  if ( unit == DTTimeUnits::ns ) {
196  ph /= nsPerCount;
197  }
198 
199 // std::string mName = mapName();
200 // DTBufferTree<int,int>* dBuf =
201 // DTDataBuffer<int,int>::findBuffer( mName );
202 // if ( dBuf == 0 ) {
203 // cacheMap();
204 // dBuf =
205 // DTDataBuffer<int,int>::findBuffer( mName );
206 // }
207  if ( dBuf == 0 ) cacheMap();
208  std::vector<int> chanKey;
209  chanKey.reserve(3);
210  chanKey.push_back( wheelId );
211  chanKey.push_back( stationId );
212  chanKey.push_back( sectorId );
213  int ientry;
214  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
215 
216  if ( !searchStatus ) {
218  data.nClock = nc;
219  data.tPhase = ph;
220  return -1;
221  }
222  else {
224  key. wheelId = wheelId;
225  key.stationId = stationId;
226  key. sectorId = sectorId;
228  data.nClock = nc;
229  data.tPhase = ph;
230  ientry = dataList.size();
231  dataList.push_back( std::pair<DTTPGParametersId,
232  DTTPGParametersData>( key, data ) );
233  dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
234  return 0;
235  }
236 
237  return 99;
238 
239 }
int insert(ElementKey fKey, ElementKey lKey, const Content &cont)
U second(std::pair< T, U > const &p)
DTBufferTree< int, int > * dBuf
int find(ElementKey fKey, ElementKey lKey, Content &cont)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
list key
Definition: combine.py:13
float unit() const
std::vector< std::pair< DTTPGParametersId, DTTPGParametersData > > dataList
void cacheMap() const
read and store full content
int DTTPGParameters::set ( const DTChamberId id,
int  nc,
float  ph,
DTTimeUnits::type  unit 
)

Definition at line 242 of file DTTPGParameters.cc.

References set(), and relativeConstraints::station.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

245  {
246  return set( id.wheel(),
247  id.station(),
248  id.sector(),
249  nc, ph, unit );
250 }
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
float unit() const
void DTTPGParameters::setClock ( int  clock)

Definition at line 253 of file DTTPGParameters.cc.

References clock(), and clockLength.

253  {
254  clockLength = clock;
255 }
int clock() const
void DTTPGParameters::setUnit ( float  unit)

Definition at line 258 of file DTTPGParameters.cc.

References nsPerCount, and unit().

258  {
259  nsPerCount = unit;
260 }
float unit() const
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().

140  {
141  int cl = 0;
142  float ph = 0.0;
143  get( wheelId, stationId, sectorId, cl, ph, unit );
144  if ( unit == DTTimeUnits::ns ) return ( cl * clock() * nsPerCount ) + ph;
145  else return ( cl * clock() ) + ph;
146 }
int clock() const
float cl
Definition: Combine.cc:71
float unit() const
float DTTPGParameters::totalTime ( const DTChamberId id,
DTTimeUnits::type  unit 
) const

Definition at line 149 of file DTTPGParameters.cc.

References relativeConstraints::station, and totalTime().

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

Definition at line 163 of file DTTPGParameters.cc.

References nsPerCount.

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

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

access version

Definition at line 169 of file DTTPGParameters.cc.

References dataVersion.

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

Definition at line 174 of file DTTPGParameters.cc.

References dataVersion.

174  {
175  return dataVersion;
176 }
std::string dataVersion

Member Data Documentation

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.

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().