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...
 
 DTTtrig (const DTTtrig &src)=delete
 
std::string mapName () const
 
DTTtrigoperator= (const DTTtrig &rhs)=delete
 

Private Attributes

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

Detailed Description

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

Date:
2008/12/11 09:44:53
Revision:
1.8
Author
Paolo Ronchese INFN Padova

Definition at line 72 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 179 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 = nullptr;
39 }
float nsPerCount
Definition: DTTtrig.h:197
std::atomic< DTBufferTree< int, int > * > dBuf
Definition: DTTtrig.h:202
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:199
std::string dataVersion
Definition: DTTtrig.h:196
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 = nullptr;
47 }
float nsPerCount
Definition: DTTtrig.h:197
const std::string & version() const
access version
Definition: DTTtrig.cc:242
std::atomic< DTBufferTree< int, int > * > dBuf
Definition: DTTtrig.h:202
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:199
std::string dataVersion
Definition: DTTtrig.h:196
DTTtrig::~DTTtrig ( )

Destructor

Definition at line 70 of file DTTtrig.cc.

References dBuf.

70  {
71 // DTDataBuffer<int,int>::dropBuffer( mapName() );
72  delete dBuf;
73 }
std::atomic< DTBufferTree< int, int > * > dBuf
Definition: DTTtrig.h:202
DTTtrig::DTTtrig ( const DTTtrig src)
privatedelete

Member Function Documentation

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

Definition at line 376 of file DTTtrig.cc.

References dataList.

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

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

read and store full content

Definition at line 393 of file DTTtrig.cc.

References dataList, dBuf, and DTTtrigId::stationId.

Referenced by get(), and set().

393  {
394 
395 // std::string mName = mapName();
396 // DTBufferTree<int,int>* dBuf =
397 // DTDataBuffer<int,int>::openBuffer( mName );
398 //
399  auto pBuf = new DTBufferTree<int,int>;
400 
401  int entryNum = 0;
402  int entryMax = dataList.size();
403  std::vector<int> chanKey;
404  chanKey.reserve(6);
405  while ( entryNum < entryMax ) {
406 
407  const DTTtrigId& chan = dataList[entryNum].first;
408 
409  chanKey.clear();
410  chanKey.push_back( chan. wheelId );
411  chanKey.push_back( chan.stationId );
412  chanKey.push_back( chan. sectorId );
413  chanKey.push_back( chan. slId );
414  chanKey.push_back( chan. layerId );
415  chanKey.push_back( chan. cellId );
416  pBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );
417  }
418 
419  //atomically try to swap this to become dBuf
420  DTBufferTree<int,int>* expect = nullptr;
421  bool exchanged = dBuf.compare_exchange_strong(expect, pBuf, std::memory_order_acq_rel);
422  if(!exchanged) {
423  //some other thread beat us to this so need to get rid of the work we did
424  delete pBuf;
425  }
426 
427  return;
428 
429 }
int stationId
Definition: DTTtrig.h:49
std::atomic< DTBufferTree< int, int > * > dBuf
Definition: DTTtrig.h:202
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:199
void DTTtrig::clear ( void  )
DTTtrig::const_iterator DTTtrig::end ( void  ) const

Definition at line 381 of file DTTtrig.cc.

References dataList.

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

381  {
382  return dataList.end();
383 }
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:199
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 101 of file DTTtrig.cc.

References cacheMap(), data, dataList, dBuf, spr::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().

110  {
111 
112  tTrig =
113  tTrms =
114  kFact = 0.0;
115 
116 // std::string mName = mapName();
117 // DTBufferTree<int,int>* dBuf =
118 // DTDataBuffer<int,int>::findBuffer( mName );
119 // if ( dBuf == 0 ) {
120 // cacheMap();
121 // dBuf =
122 // DTDataBuffer<int,int>::findBuffer( mName );
123 // }
124  if (!dBuf.load(std::memory_order_acquire)) cacheMap();
125 
126  std::vector<int> chanKey;
127  chanKey.reserve(6);
128  chanKey.push_back( wheelId );
129  chanKey.push_back( stationId );
130  chanKey.push_back( sectorId );
131  chanKey.push_back( slId );
132  chanKey.push_back( layerId );
133  chanKey.push_back( cellId );
134  int ientry;
135  int searchStatus = (*dBuf.load(std::memory_order_acquire)).find( chanKey.begin(), chanKey.end(), ientry );
136  if ( !searchStatus ) {
137  const DTTtrigData& data( dataList[ientry].second );
138  tTrig = data.tTrig;
139  tTrms = data.tTrms;
140  kFact = data.kFact;
141  if ( unit == DTTimeUnits::ns ) {
142  tTrig *= nsPerCount;
143  tTrms *= nsPerCount;
144  }
145  }
146 
147  return searchStatus;
148 
149 }
float nsPerCount
Definition: DTTtrig.h:197
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::atomic< DTBufferTree< int, int > * > dBuf
Definition: DTTtrig.h:202
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:199
U second(std::pair< T, U > const &p)
float unit() const
Definition: DTTtrig.cc:236
void cacheMap() const
read and store full content
Definition: DTTtrig.cc:393
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 152 of file DTTtrig.cc.

References unit().

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

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

Definition at line 165 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().

169  {
170  DTWireId wireId( id.rawId() );
171  return get( wireId.wheel(),
172  wireId.station(),
173  wireId.sector(),
174  wireId.superLayer(),
175  wireId.layer(),
176  wireId.wire(),
177  tTrig, tTrms, kFact, unit );
178 }
float unit() const
Definition: DTTtrig.cc:236
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 192 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().

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

Definition at line 211 of file DTTtrig.cc.

References unit().

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

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

Definition at line 222 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().

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

Definition at line 386 of file DTTtrig.cc.

References dataVersion, and mergeVDriftHistosByStation::name.

386  {
387  std::stringstream name;
388  name << dataVersion << "_map_Ttrig" << this;
389  return name.str();
390 }
std::string dataVersion
Definition: DTTtrig.h:196
DTTtrig& DTTtrig::operator= ( const DTTtrig rhs)
privatedelete
int DTTtrig::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float  tTrig,
float  tTrms,
float  kFact,
DTTimeUnits::type  unit 
)

Definition at line 261 of file DTTtrig.cc.

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

268  {
269  return set( wheelId, stationId, sectorId,
270  slId, 0, 0,
271  tTrig, tTrms, kFact, unit );
272 
273 }
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
Definition: DTTtrig.cc:261
float unit() const
Definition: DTTtrig.cc:236
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 276 of file DTTtrig.cc.

References cacheMap(), data, dataList, dBuf, spr::find(), edm::eventsetup::heterocontainer::insert(), combine::key, DTTtrigData::kFact, DTTimeUnits::ns, nsPerCount, edm::second(), DTTtrigId::stationId, DTTtrigData::tTrig, and DTTtrigData::tTrms.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

285  {
286 
287  if ( unit == DTTimeUnits::ns ) {
288  tTrig /= nsPerCount;
289  tTrms /= nsPerCount;
290  }
291 
292 // std::string mName = mapName();
293 // DTBufferTree<int,int>* dBuf =
294 // DTDataBuffer<int,int>::findBuffer( mName );
295 // if ( dBuf == 0 ) {
296 // cacheMap();
297 // dBuf =
298 // DTDataBuffer<int,int>::findBuffer( mName );
299 // }
300  if (!dBuf.load(std::memory_order_acquire)) cacheMap();
301  std::vector<int> chanKey;
302  chanKey.reserve(6);
303  chanKey.push_back( wheelId );
304  chanKey.push_back( stationId );
305  chanKey.push_back( sectorId );
306  chanKey.push_back( slId );
307  chanKey.push_back( layerId );
308  chanKey.push_back( cellId );
309  int ientry;
310  int searchStatus = (*dBuf.load(std::memory_order_acquire)).find( chanKey.begin(), chanKey.end(), ientry );
311 
312  if ( !searchStatus ) {
313  DTTtrigData& data( dataList[ientry].second );
314  data.tTrig = tTrig;
315  data.tTrms = tTrms;
316  data.kFact = kFact;
317  return -1;
318  }
319  else {
320  DTTtrigId key;
321  key. wheelId = wheelId;
322  key.stationId = stationId;
323  key. sectorId = sectorId;
324  key. slId = slId;
325  key. layerId = layerId;
326  key. cellId = cellId;
328  data.tTrig = tTrig;
329  data.tTrms = tTrms;
330  data.kFact = kFact;
331  ientry = dataList.size();
332  dataList.push_back( std::pair<DTTtrigId,DTTtrigData>( key, data ) );
333  (*dBuf.load(std::memory_order_acquire)).insert( chanKey.begin(), chanKey.end(), ientry );
334  return 0;
335  }
336 
337  return 99;
338 
339 }
float nsPerCount
Definition: DTTtrig.h:197
float tTrms
Definition: DTTtrig.h:66
int stationId
Definition: DTTtrig.h:49
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::atomic< DTBufferTree< int, int > * > dBuf
Definition: DTTtrig.h:202
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:199
U second(std::pair< T, U > const &p)
float unit() const
Definition: DTTtrig.cc:236
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
void cacheMap() const
read and store full content
Definition: DTTtrig.cc:393
float kFact
Definition: DTTtrig.h:67
float tTrig
Definition: DTTtrig.h:65
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 342 of file DTTtrig.cc.

References set(), and relativeConstraints::station.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

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

Definition at line 355 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().

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

Definition at line 371 of file DTTtrig.cc.

References nsPerCount, and unit().

371  {
372  nsPerCount = unit;
373 }
float nsPerCount
Definition: DTTtrig.h:197
float unit() const
Definition: DTTtrig.cc:236
float DTTtrig::unit ( ) const

Definition at line 236 of file DTTtrig.cc.

References nsPerCount.

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

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

access version

Definition at line 242 of file DTTtrig.cc.

References dataVersion.

Referenced by DTTTrigSyncFromDB::setES().

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

Definition at line 247 of file DTTtrig.cc.

References dataVersion.

247  {
248  return dataVersion;
249 }
std::string dataVersion
Definition: DTTtrig.h:196

Member Data Documentation

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

Definition at line 199 of file DTTtrig.h.

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

std::string DTTtrig::dataVersion
private

Definition at line 196 of file DTTtrig.h.

Referenced by mapName(), and version().

std::atomic<DTBufferTree<int,int>*> DTTtrig::dBuf
mutableprivate

Definition at line 202 of file DTTtrig.h.

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

float DTTtrig::nsPerCount
private

Definition at line 197 of file DTTtrig.h.

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