CMS 3D CMS Logo

Public Member Functions | Private Member Functions

SiStripLatencyGenerator Class Reference

#include <SiStripLatencyGenerator.h>

Inheritance diagram for SiStripLatencyGenerator:
SiStripCondObjBuilderBase< SiStripLatency >

List of all members.

Public Member Functions

void getObj (SiStripLatency *&obj)
 SiStripLatencyGenerator (const edm::ParameterSet &, const edm::ActivityRegistry &)
 ~SiStripLatencyGenerator ()

Private Member Functions

void createObject ()

Detailed Description

Fake generator for latency and mode values stored in the SiStripLatency object.

Definition at line 14 of file SiStripLatencyGenerator.h.


Constructor & Destructor Documentation

SiStripLatencyGenerator::SiStripLatencyGenerator ( const edm::ParameterSet iConfig,
const edm::ActivityRegistry aReg 
) [explicit]

Definition at line 10 of file SiStripLatencyGenerator.cc.

                                                                                                              :
  SiStripCondObjBuilderBase<SiStripLatency>::SiStripCondObjBuilderBase(iConfig)
{
  edm::LogInfo("SiStripLatencyGenerator") << "[SiStripLatencyGenerator::SiStripLatencyGenerator]";
}
SiStripLatencyGenerator::~SiStripLatencyGenerator ( )

Definition at line 16 of file SiStripLatencyGenerator.cc.

{
  edm::LogInfo("SiStripLatencyGenerator") << "[SiStripLatencyGenerator::~SiStripLatencyGenerator]";
}

Member Function Documentation

void SiStripLatencyGenerator::createObject ( ) [private]

Definition at line 21 of file SiStripLatencyGenerator.cc.

References SiStripCondObjBuilderBase< SiStripLatency >::_pset, SiStripLatency::compress(), edm::FileInPath::fullPath(), SiStripDetInfoFileReader::getAllData(), edm::ParameterSet::getParameter(), SiStripCondObjBuilderBase< SiStripLatency >::obj_, and SiStripLatency::put().

Referenced by getObj().

{
  obj_ = new SiStripLatency();

  // Read the full list of detIds
  edm::FileInPath fp_ = _pset.getParameter<edm::FileInPath>("file");
  SiStripDetInfoFileReader reader(fp_.fullPath());
  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > detInfos = reader.getAllData();
  // Take the last detId. Since the map is sorted it will be the biggest value
  if( !detInfos.empty() ) {
    // Set the apv number as 6, the highest possible
    edm::LogInfo("SiStripLatencyGenerator") << "detId = " << detInfos.rbegin()->first << " apv = " << 6
                                            << " latency = " << _pset.getParameter<uint32_t>("latency")
                                            << " mode = " << _pset.getParameter<uint32_t>("mode") << std::endl;
    obj_->put(detInfos.rbegin()->first, 6, _pset.getParameter<uint32_t>("latency"), _pset.getParameter<uint32_t>("mode") );

    // Call this method to collapse all consecutive detIdAndApvs with the same latency and mode to a single entry
    obj_->compress();
  }
  else {
    edm::LogError("SiStripLatencyGenerator") << "Error: detInfo map is empty. Cannot get the last detId." << std::endl;
  }
}
void SiStripLatencyGenerator::getObj ( SiStripLatency *&  obj) [inline, virtual]

Returns the CondObj

Reimplemented from SiStripCondObjBuilderBase< SiStripLatency >.

Definition at line 20 of file SiStripLatencyGenerator.h.

References createObject(), and SiStripCondObjBuilderBase< SiStripLatency >::obj_.

{createObject(); obj=obj_;}