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
DTTtrig Class Reference

#include <DTTtrig.h>

Public Types

typedef std::vector< std::pair
< DTTtrigId, DTTtrigData >
>::const_iterator 
const_iterator
 Access methods to data. More...
 

Public Member Functions

const_iterator begin () const
 
void clear ()
 reset content More...
 
 DTTtrig ()
 
 DTTtrig (const std::string &version)
 
const_iterator end () const
 
int get (int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
 get content More...
 
int get (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
 
int get (const DTSuperLayerId &id, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
 
int get (const DetId &id, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
 
int get (int wheelId, int stationId, int sectorId, int slId, float &tTrig, DTTimeUnits::type unit) const
 
int get (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &tTrig, DTTimeUnits::type unit) const
 
int get (const DTSuperLayerId &id, float &tTrig, DTTimeUnits::type unit) const
 
int get (const DetId &id, float &tTrig, DTTimeUnits::type unit) const
 
int set (int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
 
int set (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
 
int set (const DTSuperLayerId &id, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
 
int set (const DetId &id, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
 
void setUnit (float unit)
 
float unit () const
 
const std::string & version () const
 access version More...
 
std::string & version ()
 
 ~DTTtrig ()
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Description: Class to hold drift tubes TTrigs ( SL by SL time offsets )

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

Definition at line 69 of file DTTtrig.h.

Member Typedef Documentation

typedef std::vector< std::pair<DTTtrigId, DTTtrigData> >::const_iterator DTTtrig::const_iterator

Access methods to data.

Definition at line 176 of file DTTtrig.h.

Constructor & Destructor Documentation

DTTtrig::DTTtrig ( )

Constructor

Definition at line 34 of file DTTtrig.cc.

References dataList, and dBuf.

34  :
35  dataVersion( " " ),
36  nsPerCount( 25.0 / 32.0 ) {
37  dataList.reserve( 1000 );
38  dBuf = 0;
39 }
float nsPerCount
Definition: DTTtrig.h:183
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:185
DTBufferTree< int, int > * dBuf
Definition: DTTtrig.h:187
std::string dataVersion
Definition: DTTtrig.h:182
DTTtrig::DTTtrig ( const std::string &  version)

Definition at line 42 of file DTTtrig.cc.

References dataList, and dBuf.

42  :
44  nsPerCount( 25.0 / 32.0 ) {
45  dataList.reserve( 1000 );
46  dBuf = 0;
47 }
float nsPerCount
Definition: DTTtrig.h:183
const std::string & version() const
access version
Definition: DTTtrig.cc:243
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:185
DTBufferTree< int, int > * dBuf
Definition: DTTtrig.h:187
std::string dataVersion
Definition: DTTtrig.h:182
DTTtrig::~DTTtrig ( )

Destructor

Definition at line 70 of file DTTtrig.cc.

References dBuf.

70  {
71 // DTDataBuffer<int,int>::dropBuffer( mapName() );
72  delete dBuf;
73 }
DTBufferTree< int, int > * dBuf
Definition: DTTtrig.h:187

Member Function Documentation

DTTtrig::const_iterator DTTtrig::begin ( void  ) const

Definition at line 377 of file DTTtrig.cc.

References dataList.

Referenced by DTtTrigDBValidation::beginRun(), DTTTrigCalibration::dumpTTrigMap(), and DTTTrigCalibration::plotTTrig().

377  {
378  return dataList.begin();
379 }
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:185
void DTTtrig::cacheMap ( ) const
private

read and store full content

Definition at line 394 of file DTTtrig.cc.

References dataList, dBuf, DTBufferTree< Key, Content >::insert(), and DTTtrigId::stationId.

Referenced by get(), and set().

394  {
395 
396 // std::string mName = mapName();
397 // DTBufferTree<int,int>* dBuf =
398 // DTDataBuffer<int,int>::openBuffer( mName );
399  DTBufferTree<int,int>** pBuf;
400  pBuf = const_cast<DTBufferTree<int,int>**>( &dBuf );
401  *pBuf = new DTBufferTree<int,int>;
402 
403  int entryNum = 0;
404  int entryMax = dataList.size();
405  std::vector<int> chanKey;
406  chanKey.reserve(6);
407  while ( entryNum < entryMax ) {
408 
409  const DTTtrigId& chan = dataList[entryNum].first;
410 
411  chanKey.clear();
412  chanKey.push_back( chan. wheelId );
413  chanKey.push_back( chan.stationId );
414  chanKey.push_back( chan. sectorId );
415  chanKey.push_back( chan. slId );
416  chanKey.push_back( chan. layerId );
417  chanKey.push_back( chan. cellId );
418  dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );
419 
420  }
421 
422  return;
423 
424 }
int insert(ElementKey fKey, ElementKey lKey, const Content &cont)
int stationId
Definition: DTTtrig.h:46
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:185
DTBufferTree< int, int > * dBuf
Definition: DTTtrig.h:187
void DTTtrig::clear ( void  )
DTTtrig::const_iterator DTTtrig::end ( void  ) const

Definition at line 382 of file DTTtrig.cc.

References dataList.

Referenced by DTtTrigDBValidation::beginRun(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), DTTTrigCalibration::dumpTTrigMap(), and DTTTrigCalibration::plotTTrig().

382  {
383  return dataList.end();
384 }
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:185
int DTTtrig::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  tTrig,
float &  tTrms,
float &  kFact,
DTTimeUnits::type  unit 
) const
int DTTtrig::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float &  tTrig,
float &  tTrms,
float &  kFact,
DTTimeUnits::type  unit 
) const

Definition at line 102 of file DTTtrig.cc.

References cacheMap(), data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTTtrigData::kFact, DTTimeUnits::ns, nsPerCount, edm::second(), DTTtrigData::tTrig, and DTTtrigData::tTrms.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

111  {
112 
113  tTrig =
114  tTrms =
115  kFact = 0.0;
116 
117 // std::string mName = mapName();
118 // DTBufferTree<int,int>* dBuf =
119 // DTDataBuffer<int,int>::findBuffer( mName );
120 // if ( dBuf == 0 ) {
121 // cacheMap();
122 // dBuf =
123 // DTDataBuffer<int,int>::findBuffer( mName );
124 // }
125  if ( dBuf == 0 ) cacheMap();
126 
127  std::vector<int> chanKey;
128  chanKey.reserve(6);
129  chanKey.push_back( wheelId );
130  chanKey.push_back( stationId );
131  chanKey.push_back( sectorId );
132  chanKey.push_back( slId );
133  chanKey.push_back( layerId );
134  chanKey.push_back( cellId );
135  int ientry;
136  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
137  if ( !searchStatus ) {
138  const DTTtrigData& data( dataList[ientry].second );
139  tTrig = data.tTrig;
140  tTrms = data.tTrms;
141  kFact = data.kFact;
142  if ( unit == DTTimeUnits::ns ) {
143  tTrig *= nsPerCount;
144  tTrms *= nsPerCount;
145  }
146  }
147 
148  return searchStatus;
149 
150 }
float nsPerCount
Definition: DTTtrig.h:183
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:185
DTBufferTree< int, int > * dBuf
Definition: DTTtrig.h:187
U second(std::pair< T, U > const &p)
float unit() const
Definition: DTTtrig.cc:237
void cacheMap() const
read and store full content
Definition: DTTtrig.cc:394
int find(ElementKey fKey, ElementKey lKey, Content &cont)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int DTTtrig::get ( const DTSuperLayerId id,
float &  tTrig,
float &  tTrms,
float &  kFact,
DTTimeUnits::type  unit 
) const

Definition at line 153 of file DTTtrig.cc.

References unit().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

157  {
158  return get( id.wheel(),
159  id.station(),
160  id.sector(),
161  id.superLayer(), 0, 0,
162  tTrig, tTrms, kFact, unit );
163 }
float unit() const
Definition: DTTtrig.cc:237
int DTTtrig::get ( const DetId id,
float &  tTrig,
float &  tTrms,
float &  kFact,
DTTimeUnits::type  unit 
) const

Definition at line 166 of file DTTtrig.cc.

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

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

170  {
171  DTWireId wireId( id.rawId() );
172  return get( wireId.wheel(),
173  wireId.station(),
174  wireId.sector(),
175  wireId.superLayer(),
176  wireId.layer(),
177  wireId.wire(),
178  tTrig, tTrms, kFact, unit );
179 }
float unit() const
Definition: DTTtrig.cc:237
int DTTtrig::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  tTrig,
DTTimeUnits::type  unit 
) const
int DTTtrig::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float &  tTrig,
DTTimeUnits::type  unit 
) const

Definition at line 193 of file DTTtrig.cc.

References ntuplemaker::status, and unit().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

200  {
201  float tMean;
202  float tTrms;
203  float kFact;
204  int status = get( wheelId, stationId, sectorId,
205  slId, layerId, cellId,
206  tMean, tTrms, kFact, unit );
207  tTrig = tMean + ( kFact * tTrms );
208  return status;
209 }
float unit() const
Definition: DTTtrig.cc:237
tuple status
Definition: ntuplemaker.py:245
int DTTtrig::get ( const DTSuperLayerId id,
float &  tTrig,
DTTimeUnits::type  unit 
) const

Definition at line 212 of file DTTtrig.cc.

References unit().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

214  {
215  return get( id.wheel(),
216  id.station(),
217  id.sector(),
218  id.superLayer(), 0, 0,
219  tTrig, unit );
220 }
float unit() const
Definition: DTTtrig.cc:237
int DTTtrig::get ( const DetId id,
float &  tTrig,
DTTimeUnits::type  unit 
) const

Definition at line 223 of file DTTtrig.cc.

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

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

225  {
226  DTWireId wireId( id.rawId() );
227  return get( wireId.wheel(),
228  wireId.station(),
229  wireId.sector(),
230  wireId.superLayer(),
231  wireId.layer(),
232  wireId.wire(),
233  tTrig, unit );
234 }
float unit() const
Definition: DTTtrig.cc:237
std::string DTTtrig::mapName ( ) const
private

Definition at line 387 of file DTTtrig.cc.

References dataVersion, and mergeVDriftHistosByStation::name.

387  {
388  std::stringstream name;
389  name << dataVersion << "_map_Ttrig" << this;
390  return name.str();
391 }
std::string dataVersion
Definition: DTTtrig.h:182
int DTTtrig::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float  tTrig,
float  tTrms,
float  kFact,
DTTimeUnits::type  unit 
)

Definition at line 262 of file DTTtrig.cc.

Referenced by DTTTrigCorrection::endJob(), DTTTrigCorrectionFirst::endJob(), DTTTrigOffsetCalibration::endJob(), DTTTrigCalibration::endJob(), betterConfigParser.BetterConfigParser::getGeneral(), DTTtrigHandler::getNewObjects(), DTFakeTTrigESProducer::produce(), and set().

269  {
270  return set( wheelId, stationId, sectorId,
271  slId, 0, 0,
272  tTrig, tTrms, kFact, unit );
273 
274 }
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
Definition: DTTtrig.cc:262
float unit() const
Definition: DTTtrig.cc:237
int DTTtrig::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float  tTrig,
float  tTrms,
float  kFact,
DTTimeUnits::type  unit 
)

Definition at line 277 of file DTTtrig.cc.

References cacheMap(), data, dataList, dBuf, DTBufferTree< Key, Content >::find(), DTBufferTree< Key, Content >::insert(), combine::key, DTTtrigData::kFact, DTTimeUnits::ns, nsPerCount, edm::second(), DTTtrigId::stationId, DTTtrigData::tTrig, and DTTtrigData::tTrms.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

286  {
287 
288  if ( unit == DTTimeUnits::ns ) {
289  tTrig /= nsPerCount;
290  tTrms /= nsPerCount;
291  }
292 
293 // std::string mName = mapName();
294 // DTBufferTree<int,int>* dBuf =
295 // DTDataBuffer<int,int>::findBuffer( mName );
296 // if ( dBuf == 0 ) {
297 // cacheMap();
298 // dBuf =
299 // DTDataBuffer<int,int>::findBuffer( mName );
300 // }
301  if ( dBuf == 0 ) cacheMap();
302  std::vector<int> chanKey;
303  chanKey.reserve(6);
304  chanKey.push_back( wheelId );
305  chanKey.push_back( stationId );
306  chanKey.push_back( sectorId );
307  chanKey.push_back( slId );
308  chanKey.push_back( layerId );
309  chanKey.push_back( cellId );
310  int ientry;
311  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
312 
313  if ( !searchStatus ) {
314  DTTtrigData& data( dataList[ientry].second );
315  data.tTrig = tTrig;
316  data.tTrms = tTrms;
317  data.kFact = kFact;
318  return -1;
319  }
320  else {
321  DTTtrigId key;
322  key. wheelId = wheelId;
323  key.stationId = stationId;
324  key. sectorId = sectorId;
325  key. slId = slId;
326  key. layerId = layerId;
327  key. cellId = cellId;
329  data.tTrig = tTrig;
330  data.tTrms = tTrms;
331  data.kFact = kFact;
332  ientry = dataList.size();
333  dataList.push_back( std::pair<DTTtrigId,DTTtrigData>( key, data ) );
334  dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
335  return 0;
336  }
337 
338  return 99;
339 
340 }
int insert(ElementKey fKey, ElementKey lKey, const Content &cont)
float nsPerCount
Definition: DTTtrig.h:183
float tTrms
Definition: DTTtrig.h:63
int stationId
Definition: DTTtrig.h:46
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:185
DTBufferTree< int, int > * dBuf
Definition: DTTtrig.h:187
U second(std::pair< T, U > const &p)
float unit() const
Definition: DTTtrig.cc:237
void cacheMap() const
read and store full content
Definition: DTTtrig.cc:394
float kFact
Definition: DTTtrig.h:64
int find(ElementKey fKey, ElementKey lKey, Content &cont)
float tTrig
Definition: DTTtrig.h:62
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
list key
Definition: combine.py:13
int DTTtrig::set ( const DTSuperLayerId id,
float  tTrig,
float  tTrms,
float  kFact,
DTTimeUnits::type  unit 
)

Definition at line 343 of file DTTtrig.cc.

References set(), and relativeConstraints::station.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

347  {
348  return set( id.wheel(),
349  id.station(),
350  id.sector(),
351  id.superLayer(), 0, 0,
352  tTrig, tTrms, kFact, unit );
353 }
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
Definition: DTTtrig.cc:262
float unit() const
Definition: DTTtrig.cc:237
int DTTtrig::set ( const DetId id,
float  tTrig,
float  tTrms,
float  kFact,
DTTimeUnits::type  unit 
)

Definition at line 356 of file DTTtrig.cc.

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

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

360  {
361  DTWireId wireId( id.rawId() );
362  return set( wireId.wheel(),
363  wireId.station(),
364  wireId.sector(),
365  wireId.superLayer(),
366  wireId.layer(),
367  wireId.wire(),
368  tTrig, tTrms, kFact, unit );
369 }
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
Definition: DTTtrig.cc:262
float unit() const
Definition: DTTtrig.cc:237
void DTTtrig::setUnit ( float  unit)

Definition at line 372 of file DTTtrig.cc.

References nsPerCount, and unit().

372  {
373  nsPerCount = unit;
374 }
float nsPerCount
Definition: DTTtrig.h:183
float unit() const
Definition: DTTtrig.cc:237
float DTTtrig::unit ( ) const

Definition at line 237 of file DTTtrig.cc.

References nsPerCount.

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

237  {
238  return nsPerCount;
239 }
float nsPerCount
Definition: DTTtrig.h:183
const std::string & DTTtrig::version ( ) const

access version

Definition at line 243 of file DTTtrig.cc.

References dataVersion.

243  {
244  return dataVersion;
245 }
std::string dataVersion
Definition: DTTtrig.h:182
std::string & DTTtrig::version ( )

Definition at line 248 of file DTTtrig.cc.

References dataVersion.

248  {
249  return dataVersion;
250 }
std::string dataVersion
Definition: DTTtrig.h:182

Member Data Documentation

std::vector< std::pair<DTTtrigId,DTTtrigData> > DTTtrig::dataList
private

Definition at line 185 of file DTTtrig.h.

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

std::string DTTtrig::dataVersion
private

Definition at line 182 of file DTTtrig.h.

Referenced by mapName(), and version().

DTBufferTree<int,int>* DTTtrig::dBuf
private

Definition at line 187 of file DTTtrig.h.

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

float DTTtrig::nsPerCount
private

Definition at line 183 of file DTTtrig.h.

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