CMS 3D CMS Logo

DTT0 Class Reference

Description: Class to hold drift tubes T0s ( cell by cell time offsets ). More...

#include <CondFormats/DTObjects/interface/DTT0.h>

List of all members.

Public Types

typedef std::vector< std::pair
< DTT0Id, DTT0Data >
>::const_iterator 
const_iterator
 Access methods to data.

Public Member Functions

const_iterator begin () const
int cellT0 (const DTWireId &id, float &t0mean, float &t0rms, DTTimeUnits::type unit=DTTimeUnits::counts) const
int cellT0 (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit=DTTimeUnits::counts) const
 Operations.
void clear ()
 reset content
 DTT0 (const std::string &version)
 DTT0 ()
 Constructor.
const_iterator end () const
int get (const DTWireId &id, float &t0mean, float &t0rms, DTTimeUnits::type unit=DTTimeUnits::counts) const
int get (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit=DTTimeUnits::counts) const
int set (const DTWireId &id, float t0mean, float t0rms, DTTimeUnits::type unit=DTTimeUnits::counts)
int set (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit=DTTimeUnits::counts)
int setCellT0 (const DTWireId &id, float t0mean, float t0rms, DTTimeUnits::type unit=DTTimeUnits::counts)
int setCellT0 (int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit=DTTimeUnits::counts)
void setUnit (float unit)
float unit () const
std::string & version ()
const std::string & version () const
 access version
 ~DTT0 ()
 Destructor.

Private Member Functions

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

Private Attributes

std::vector< std::pair< DTT0Id,
DTT0Data > > 
dataList
std::string dataVersion
float nsPerCount


Detailed Description

Description: Class to hold drift tubes T0s ( cell by cell time offsets ).

Date
2007/12/07 15:00:46
Revision
1.7
Author:
Paolo Ronchese INFN Padova

Definition at line 66 of file DTT0.h.


Member Typedef Documentation

typedef std::vector< std::pair<DTT0Id, DTT0Data> >::const_iterator DTT0::const_iterator

Access methods to data.

Definition at line 155 of file DTT0.h.


Constructor & Destructor Documentation

DTT0::DTT0 (  ) 

Constructor.

Definition at line 34 of file DTT0.cc.

References dataList.

00034           :
00035   dataVersion( " " ),
00036   nsPerCount( 25.0 / 32.0 ) {
00037   dataList.reserve( 12000 );
00038 }

DTT0::DTT0 ( const std::string &  version  ) 

Definition at line 41 of file DTT0.cc.

References dataList.

00041                                     :
00042   dataVersion( version ),
00043   nsPerCount( 25.0 / 32.0 ) {
00044   dataList.reserve( 12000 );
00045 }

DTT0::~DTT0 (  ) 

Destructor.

Definition at line 67 of file DTT0.cc.

References DTDataBuffer< Key, Content >::dropBuffer(), and mapName().

00067             {
00068   DTDataBuffer<int,int>::dropBuffer( mapName() );
00069 }


Member Function Documentation

DTT0::const_iterator DTT0::begin (  )  const

Definition at line 248 of file DTT0.cc.

References dataList.

Referenced by DTTPDeadWriter::analyze(), DTt0DBValidation::beginJob(), DTT0CalibrationNew::endJob(), and DTT0Calibration::endJob().

00248                                      {
00249   return dataList.begin();
00250 }

void DTT0::cacheMap (  )  const [private]

read and store full content

Definition at line 265 of file DTT0.cc.

References dataList, DTBufferTree< Key, Content >::insert(), mapName(), DTDataBuffer< Key, Content >::openBuffer(), and DTT0Id::stationId.

Referenced by get(), and set().

00265                           {
00266 
00267   std::string mName = mapName();
00268   DTBufferTree<int,int>* dBuf =
00269   DTDataBuffer<int,int>::openBuffer( mName );
00270 
00271   int entryNum = 0;
00272   int entryMax = dataList.size();
00273   std::vector<int> chanKey;
00274   chanKey.reserve(6);
00275   while ( entryNum < entryMax ) {
00276 
00277     const DTT0Id& chan = dataList[entryNum].first;
00278 
00279     chanKey.clear();
00280     chanKey.push_back( chan.  wheelId );
00281     chanKey.push_back( chan.stationId );
00282     chanKey.push_back( chan. sectorId );
00283     chanKey.push_back( chan.     slId );
00284     chanKey.push_back( chan.  layerId );
00285     chanKey.push_back( chan.   cellId );
00286     dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );
00287 
00288   }
00289 
00290   return;
00291 
00292 }

int DTT0::cellT0 ( const DTWireId id,
float &  t0mean,
float &  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
) const [inline]

Definition at line 93 of file DTT0.h.

References unit().

00097       { return get( id, t0mean, t0rms, unit ); };

int DTT0::cellT0 ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float &  t0mean,
float &  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
) const [inline]

Operations.

get content

Definition at line 82 of file DTT0.h.

References unit().

Referenced by DTTPDeadWriter::analyze(), DTTTrigSyncFromDB::offset(), and DTTTrigSyncT0Only::offset().

00091       { return get( wheelId, stationId, sectorId, slId, layerId, cellId,
00092                     t0mean, t0rms, unit ); };

void DTT0::clear ( void   ) 

reset content

Definition at line 160 of file DTT0.cc.

References dataList, DTDataBuffer< Key, Content >::dropBuffer(), and mapName().

00160                  {
00161   DTDataBuffer<int,int>::dropBuffer( mapName() );
00162   dataList.clear();
00163   return;
00164 }

DTT0::const_iterator DTT0::end (  )  const

Definition at line 253 of file DTT0.cc.

References dataList.

Referenced by DTTPDeadWriter::analyze(), DTt0DBValidation::beginJob(), DTT0CalibrationNew::endJob(), and DTT0Calibration::endJob().

00253                                    {
00254   return dataList.end();
00255 }

int DTT0::get ( const DTWireId id,
float &  t0mean,
float &  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
) const

Definition at line 130 of file DTT0.cc.

00133                                             {
00134   return get( id.wheel(),
00135               id.station(),
00136               id.sector(),
00137               id.superLayer(),
00138               id.layer(),
00139               id.wire(),
00140               t0mean, t0rms, unit );
00141 }

int DTT0::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float &  t0mean,
float &  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
) const

Definition at line 83 of file DTT0.cc.

References cacheMap(), data, dataList, DTBufferTree< Key, Content >::find(), DTDataBuffer< Key, Content >::findBuffer(), mapName(), DTTimeUnits::ns, nsPerCount, edm::second(), DTT0Data::t0mean, and DTT0Data::t0rms.

00091                                             {
00092 
00093   t0mean =
00094   t0rms  = 0.0;
00095 
00096   std::string mName = mapName();
00097   DTBufferTree<int,int>* dBuf =
00098   DTDataBuffer<int,int>::findBuffer( mName );
00099   if ( dBuf == 0 ) {
00100     cacheMap();
00101     dBuf =
00102     DTDataBuffer<int,int>::findBuffer( mName );
00103   }
00104 
00105   std::vector<int> chanKey;
00106   chanKey.reserve(6);
00107   chanKey.push_back(   wheelId );
00108   chanKey.push_back( stationId );
00109   chanKey.push_back(  sectorId );
00110   chanKey.push_back(      slId );
00111   chanKey.push_back(   layerId );
00112   chanKey.push_back(    cellId );
00113   int ientry;
00114   int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
00115   if ( !searchStatus ) {
00116     const DTT0Data& data( dataList[ientry].second );
00117     t0mean = data.t0mean;
00118     t0rms  = data.t0rms;
00119     if ( unit == DTTimeUnits::ns ) {
00120       t0mean *= nsPerCount;
00121       t0rms  *= nsPerCount;
00122     }
00123   }
00124 
00125   return searchStatus;
00126 
00127 }

std::string DTT0::mapName (  )  const [private]

Definition at line 258 of file DTT0.cc.

References dataVersion, and name.

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

00258                               {
00259   std::stringstream name;
00260   name << dataVersion << "_map_T0" << this;
00261   return name.str();
00262 }

int DTT0::set ( const DTWireId id,
float  t0mean,
float  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
)

Definition at line 229 of file DTT0.cc.

00232                                       {
00233   return set( id.wheel(),
00234               id.station(),
00235               id.sector(),
00236               id.superLayer(),
00237               id.layer(),
00238               id.wire(),
00239               t0mean, t0rms, unit );
00240 }

int DTT0::set ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float  t0mean,
float  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
)

Definition at line 167 of file DTT0.cc.

References cacheMap(), data, dataList, DTBufferTree< Key, Content >::find(), DTDataBuffer< Key, Content >::findBuffer(), DTBufferTree< Key, Content >::insert(), getDQMSummary::key, mapName(), DTTimeUnits::ns, nsPerCount, edm::second(), DTT0Id::stationId, DTT0Data::t0mean, and DTT0Data::t0rms.

Referenced by DTT0CalibrationNew::endJob(), DTT0Calibration::endJob(), DTT0Handler::getNewObjects(), and DTFakeT0ESProducer::produce().

00175                                       {
00176 
00177   if ( unit == DTTimeUnits::ns ) {
00178     t0mean /= nsPerCount;
00179     t0rms  /= nsPerCount;
00180   }
00181 
00182   std::string mName = mapName();
00183   DTBufferTree<int,int>* dBuf =
00184   DTDataBuffer<int,int>::findBuffer( mName );
00185   if ( dBuf == 0 ) {
00186     cacheMap();
00187     dBuf =
00188     DTDataBuffer<int,int>::findBuffer( mName );
00189   }
00190   std::vector<int> chanKey;
00191   chanKey.reserve(6);
00192   chanKey.push_back(   wheelId );
00193   chanKey.push_back( stationId );
00194   chanKey.push_back(  sectorId );
00195   chanKey.push_back(      slId );
00196   chanKey.push_back(   layerId );
00197   chanKey.push_back(    cellId );
00198   int ientry;
00199   int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
00200 
00201   if ( !searchStatus ) {
00202     DTT0Data& data( dataList[ientry].second );
00203     data.t0mean = t0mean;
00204     data.t0rms  = t0rms;
00205     return -1;
00206   }
00207   else {
00208     DTT0Id key;
00209     key.  wheelId =   wheelId;
00210     key.stationId = stationId;
00211     key. sectorId =  sectorId;
00212     key.     slId =      slId;
00213     key.  layerId =   layerId;
00214     key.   cellId =    cellId;
00215     DTT0Data data;
00216     data.t0mean = t0mean;
00217     data.t0rms  = t0rms;
00218     ientry = dataList.size();
00219     dataList.push_back( std::pair<const DTT0Id,DTT0Data>( key, data ) );
00220     dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
00221     return 0;
00222   }
00223 
00224   return 99;
00225 
00226 }

int DTT0::setCellT0 ( const DTWireId id,
float  t0mean,
float  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
) [inline]

Definition at line 132 of file DTT0.h.

References unit().

00136       { return set( id, t0mean, t0rms, unit ); };

int DTT0::setCellT0 ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
int  layerId,
int  cellId,
float  t0mean,
float  t0rms,
DTTimeUnits::type  unit = DTTimeUnits::counts 
) [inline]

Definition at line 121 of file DTT0.h.

References unit().

00130       { return set( wheelId, stationId, sectorId, slId, layerId, cellId,
00131                     t0mean, t0rms, unit ); };

void DTT0::setUnit ( float  unit  ) 

Definition at line 243 of file DTT0.cc.

References nsPerCount.

00243                                {
00244   nsPerCount = unit;
00245 }

float DTT0::unit (  )  const

Definition at line 144 of file DTT0.cc.

References nsPerCount.

Referenced by cellT0(), and setCellT0().

00144                        {
00145   return nsPerCount;
00146 }

std::string & DTT0::version (  ) 

Definition at line 155 of file DTT0.cc.

References dataVersion.

00155                          {
00156   return dataVersion;
00157 }

const std::string & DTT0::version (  )  const

access version

Definition at line 150 of file DTT0.cc.

References dataVersion.

Referenced by DTTTrigSyncFromDB::setES().

00150                                {
00151   return dataVersion;
00152 }


Member Data Documentation

std::vector< std::pair<DTT0Id,DTT0Data> > DTT0::dataList [private]

Definition at line 164 of file DTT0.h.

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

std::string DTT0::dataVersion [private]

Definition at line 161 of file DTT0.h.

Referenced by mapName(), and version().

float DTT0::nsPerCount [private]

Definition at line 162 of file DTT0.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:07 2009 for CMSSW by  doxygen 1.5.4