CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

DTTtrig Class Reference

#include <DTTtrig.h>

List of all members.

Public Types

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

Public Member Functions

const_iterator begin () const
void clear ()
 reset content
 DTTtrig (const std::string &version)
 DTTtrig ()
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
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 (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 DetId &id, float &tTrig, 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 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 DetId &id, 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 (int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
void setUnit (float unit)
float unit () const
std::string & version ()
const std::string & version () const
 access version
 ~DTTtrig ()

Private Member Functions

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

                :
  dataVersion( " " ),
  nsPerCount( 25.0 / 32.0 ) {
  dataList.reserve( 1000 );
  dBuf = 0;
}
DTTtrig::DTTtrig ( const std::string &  version)

Definition at line 42 of file DTTtrig.cc.

References dataList, and dBuf.

                                          :
  dataVersion( version ),
  nsPerCount( 25.0 / 32.0 ) {
  dataList.reserve( 1000 );
  dBuf = 0;
}
DTTtrig::~DTTtrig ( )

Destructor

Definition at line 70 of file DTTtrig.cc.

References dBuf.

                  {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
}

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

                                           {
  return dataList.begin();
}
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().

                             {

//  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(6);
  while ( entryNum < entryMax ) {

    const DTTtrigId& chan = dataList[entryNum].first;

    chanKey.clear();
    chanKey.push_back( chan.  wheelId );
    chanKey.push_back( chan.stationId );
    chanKey.push_back( chan. sectorId );
    chanKey.push_back( chan.     slId );
    chanKey.push_back( chan.  layerId );
    chanKey.push_back( chan.   cellId );
    dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );

  }

  return;

}
void DTTtrig::clear ( void  )

reset content

Definition at line 253 of file DTTtrig.cc.

References dataList, and dBuf.

                    {
//  DTDataBuffer<int,int>::dropBuffer( mapName() );
  delete dBuf;
  dBuf = 0;
  dataList.clear();
  return;
}
DTTtrig::const_iterator DTTtrig::end ( void  ) const

Definition at line 382 of file DTTtrig.cc.

References dataList.

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

                                         {
  return dataList.end();
}
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().

                                               {
  DTWireId wireId( id.rawId() );
  return get( wireId.wheel(),
              wireId.station(),
              wireId.sector(),
              wireId.superLayer(),
              wireId.layer(),
              wireId.wire(),
              tTrig, tTrms, kFact, unit );
}
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().

                                               {
  DTWireId wireId( id.rawId() );
  return get( wireId.wheel(),
              wireId.station(),
              wireId.sector(),
              wireId.superLayer(),
              wireId.layer(),
              wireId.wire(),
              tTrig, unit );
}
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.

                                               {

  tTrig =
  tTrms =
  kFact = 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(6);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  chanKey.push_back(   layerId );
  chanKey.push_back(    cellId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
  if ( !searchStatus ) {
    const DTTtrigData& data( dataList[ientry].second );
    tTrig = data.tTrig;
    tTrms = data.tTrms;
    kFact = data.kFact;
    if ( unit == DTTimeUnits::ns ) {
      tTrig *= nsPerCount;
      tTrms *= nsPerCount;
    }
  }

  return searchStatus;

}
int DTTtrig::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  tTrig,
DTTimeUnits::type  unit 
) const

Definition at line 182 of file DTTtrig.cc.

References unit().

                                               {
  return get( wheelId, stationId, sectorId, 
                 slId,         0,        0, tTrig, unit );
}
int DTTtrig::get ( int  wheelId,
int  stationId,
int  sectorId,
int  slId,
float &  tTrig,
float &  tTrms,
float &  kFact,
DTTimeUnits::type  unit 
) const

get content

Operations

Definition at line 87 of file DTTtrig.cc.

References unit().

Referenced by DTtTrigDBValidation::beginRun(), DTTTrigFillWithAverage::correction(), DTTTrigCorrection::endJob(), DTTTrigOffsetCalibration::endJob(), and DTTTrigFillWithAverage::getAverage().

                                               {
  return get( wheelId, stationId, sectorId,
                 slId,         0,        0,
                tTrig, tTrms, kFact, unit );

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

                                               {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(), 0, 0,
              tTrig, tTrms, kFact, unit );
}
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().

                                               {
  float tMean;
  float tTrms;
  float kFact;
  int status = get( wheelId, stationId, sectorId,
                       slId,   layerId,   cellId, 
                      tMean,     tTrms,    kFact, unit );
  tTrig = tMean + ( kFact * tTrms );
  return status;
}
int DTTtrig::get ( const DTSuperLayerId id,
float &  tTrig,
DTTimeUnits::type  unit 
) const

Definition at line 212 of file DTTtrig.cc.

References unit().

                                               {
  return get( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(), 0, 0,
              tTrig, unit );
}
std::string DTTtrig::mapName ( ) const [private]

Definition at line 387 of file DTTtrig.cc.

References dataVersion, and mergeVDriftHistosByStation::name.

                                 {
  std::stringstream name;
  name << dataVersion << "_map_Ttrig" << this;
  return name.str();
}
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(), DTChamberId::station(), DTSuperLayerId::superLayer(), unit(), DTChamberId::wheel(), and DTWireId::wire().

                                         {
  DTWireId wireId( id.rawId() );
  return set( wireId.wheel(),
              wireId.station(),
              wireId.sector(),
              wireId.superLayer(),
              wireId.layer(),
              wireId.wire(),
              tTrig, tTrms, kFact, unit );
}
int DTTtrig::set ( const DTSuperLayerId id,
float  tTrig,
float  tTrms,
float  kFact,
DTTimeUnits::type  unit 
)

Definition at line 343 of file DTTtrig.cc.

References unit().

                                         {
  return set( id.wheel(),
              id.station(),
              id.sector(),
              id.superLayer(), 0, 0,
              tTrig, tTrms, kFact, unit );
}
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.

                                         {

  if ( unit == DTTimeUnits::ns ) {
    tTrig /= nsPerCount;
    tTrms /= 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(6);
  chanKey.push_back(   wheelId );
  chanKey.push_back( stationId );
  chanKey.push_back(  sectorId );
  chanKey.push_back(      slId );
  chanKey.push_back(   layerId );
  chanKey.push_back(    cellId );
  int ientry;
  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );

  if ( !searchStatus ) {
    DTTtrigData& data( dataList[ientry].second );
    data.tTrig = tTrig;
    data.tTrms = tTrms;
    data.kFact = kFact;
    return -1;
  }
  else {
    DTTtrigId key;
    key.  wheelId =   wheelId;
    key.stationId = stationId;
    key. sectorId =  sectorId;
    key.     slId =      slId;
    key.  layerId =   layerId;
    key.   cellId =    cellId;
    DTTtrigData data;
    data.tTrig = tTrig;
    data.tTrms = tTrms;
    data.kFact = kFact;
    ientry = dataList.size();
    dataList.push_back( std::pair<DTTtrigId,DTTtrigData>( key, data ) );
    dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
    return 0;
  }

  return 99;

}
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.

References unit().

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

                                         {
  return set( wheelId, stationId, sectorId,
                 slId,         0,        0,
                tTrig, tTrms, kFact, unit );

}
void DTTtrig::setUnit ( float  unit)

Definition at line 372 of file DTTtrig.cc.

References nsPerCount, and unit().

                                  {
  nsPerCount = unit;
}
float DTTtrig::unit ( ) const

Definition at line 237 of file DTTtrig.cc.

References nsPerCount.

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

                          {
  return nsPerCount;
}
std::string & DTTtrig::version ( )

Definition at line 248 of file DTTtrig.cc.

References dataVersion.

                            {
  return dataVersion;
}
const std::string & DTTtrig::version ( ) const

access version

Definition at line 243 of file DTTtrig.cc.

References dataVersion.

                                  {
  return dataVersion;
}

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