CMS 3D CMS Logo

OptoScanHistosUsingDb Class Reference

#include <DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h>

Inheritance diagram for OptoScanHistosUsingDb:

CommissioningHistosUsingDb OptoScanHistograms CommissioningHistograms CommissioningHistograms

List of all members.

Public Member Functions

 OptoScanHistosUsingDb (DQMStore *, SiStripConfigDb *const )
 OptoScanHistosUsingDb (DQMOldReceiver *, SiStripConfigDb *const )
virtual void uploadConfigurations ()
virtual ~OptoScanHistosUsingDb ()

Private Member Functions

void create (SiStripConfigDb::AnalysisDescriptionsV &, Analysis)
void update (SiStripConfigDb::DeviceDescriptionsRange)


Detailed Description

Definition at line 9 of file OptoScanHistosUsingDb.h.


Constructor & Destructor Documentation

OptoScanHistosUsingDb::OptoScanHistosUsingDb ( DQMOldReceiver mui,
SiStripConfigDb * const  db 
)

Definition at line 14 of file OptoScanHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

00016   : CommissioningHistograms( mui, sistrip::OPTO_SCAN ),
00017     CommissioningHistosUsingDb( db, mui, sistrip::OPTO_SCAN ),
00018     OptoScanHistograms( mui )
00019 {
00020   LogTrace(mlDqmClient_) 
00021     << "[OptoScanHistosUsingDb::" << __func__ << "]"
00022     << " Constructing object...";
00023 }

OptoScanHistosUsingDb::OptoScanHistosUsingDb ( DQMStore bei,
SiStripConfigDb * const  db 
)

Definition at line 27 of file OptoScanHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

00029   : CommissioningHistosUsingDb( db, sistrip::OPTO_SCAN ),
00030     OptoScanHistograms( bei )
00031 {
00032   LogTrace(mlDqmClient_) 
00033     << "[OptoScanHistosUsingDb::" << __func__ << "]"
00034     << " Constructing object...";
00035 }

OptoScanHistosUsingDb::~OptoScanHistosUsingDb (  )  [virtual]

Definition at line 39 of file OptoScanHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

00039                                               {
00040   LogTrace(mlDqmClient_) 
00041     << "[OptoScanHistosUsingDb::" << __func__ << "]"
00042     << " Destructing object...";
00043 }


Member Function Documentation

void OptoScanHistosUsingDb::create ( SiStripConfigDb::AnalysisDescriptionsV desc,
Analysis  analysis 
) [private, virtual]

Reimplemented from CommissioningHistosUsingDb.

Definition at line 171 of file OptoScanHistosUsingDb.cc.

References OptoScanAnalysis::baseSlope(), OptoScanAnalysis::bias(), CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), HLT_VtxMuL3::errors, CommissioningAnalysis::fecKey(), CommissioningAnalysis::fedKey(), OptoScanAnalysis::gain(), CommissioningAnalysis::getErrorCodes(), SiStripFecKey::i2cAddr(), OptoScanAnalysis::isValid(), OptoScanAnalysis::liftOff(), OptoScanAnalysis::linkNoise(), OptoScanAnalysis::measGain(), SiStripDbParams::partitions(), OptoScanAnalysis::threshold(), OptoScanAnalysis::tickHeight(), tmp, and OptoScanAnalysis::zeroLight().

00172                                                         {
00173   
00174 #ifdef USING_NEW_DATABASE_MODEL
00175 
00176   OptoScanAnalysis* anal = dynamic_cast<OptoScanAnalysis*>( analysis->second );
00177   if ( !anal ) { return; }
00178   
00179   SiStripFecKey fec_key( anal->fecKey() ); 
00180   SiStripFedKey fed_key( anal->fedKey() );
00181 
00182   for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
00183 
00184     // Create description
00185     OptoScanAnalysisDescription* tmp;
00186     tmp = new OptoScanAnalysisDescription( anal->baseSlope()[0],
00187                                            anal->baseSlope()[1],
00188                                            anal->baseSlope()[2],
00189                                            anal->baseSlope()[3],
00190                                            anal->gain(),
00191                                            anal->bias()[0],
00192                                            anal->bias()[1],
00193                                            anal->bias()[2],
00194                                            anal->bias()[3],
00195                                            anal->measGain()[0],
00196                                            anal->measGain()[1],
00197                                            anal->measGain()[2],
00198                                            anal->measGain()[3],
00199                                            anal->zeroLight()[0],
00200                                            anal->zeroLight()[1],
00201                                            anal->zeroLight()[2],
00202                                            anal->zeroLight()[3],
00203                                            anal->linkNoise()[0],
00204                                            anal->linkNoise()[1],
00205                                            anal->linkNoise()[2],
00206                                            anal->linkNoise()[3],
00207                                            anal->liftOff()[0],
00208                                            anal->liftOff()[1],
00209                                            anal->liftOff()[2],
00210                                            anal->liftOff()[3],
00211                                            anal->threshold()[0],
00212                                            anal->threshold()[1],
00213                                            anal->threshold()[2],
00214                                            anal->threshold()[3],
00215                                            anal->tickHeight()[0],
00216                                            anal->tickHeight()[1],
00217                                            anal->tickHeight()[2],
00218                                            anal->tickHeight()[3],
00219                                            fec_key.fecCrate(),
00220                                            fec_key.fecSlot(),
00221                                            fec_key.fecRing(),
00222                                            fec_key.ccuAddr(),
00223                                            fec_key.ccuChan(),
00224                                            SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ), 
00225                                            db()->dbParams().partitions().begin()->second.partitionName(),
00226                                            db()->dbParams().partitions().begin()->second.runNumber(),
00227                                            anal->isValid(),
00228                                            "",
00229                                            fed_key.fedId(),
00230                                            fed_key.feUnit(),
00231                                            fed_key.feChan(),
00232                                            fed_key.fedApv() );
00233     
00234     // Add comments
00235     typedef std::vector<std::string> Strings;
00236     Strings errors = anal->getErrorCodes();
00237     Strings::const_iterator istr = errors.begin();
00238     Strings::const_iterator jstr = errors.end();
00239     for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
00240     
00241     // Store description
00242     desc.push_back( tmp );
00243     
00244   }
00245 
00246 #endif
00247 
00248 }

void OptoScanHistosUsingDb::update ( SiStripConfigDb::DeviceDescriptionsRange  devices  )  [private]

Definition at line 80 of file OptoScanHistosUsingDb.cc.

References CommissioningHistosUsingDb::addProblemDevice(), addr, OptoScanAnalysis::bias(), SiStripFecKey::ccuAddr(), SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripFecKey::ccuChan(), SiStripConfigDb::DeviceAddress::ccuChan_, SiStripKey::channel(), sistrip::CHANS_PER_LLD, CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), SiStripConfigDb::deviceAddress(), CommissioningHistosUsingDb::deviceIsPresent(), SiStripFecKey::fecCrate(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripFecKey::fecRing(), SiStripConfigDb::DeviceAddress::fecRing_, SiStripFecKey::fecSlot(), SiStripConfigDb::DeviceAddress::fecSlot_, OptoScanAnalysis::gain(), iter, SiStripKey::key(), LogTrace, sistrip::mlDqmClient_, and ss.

Referenced by uploadConfigurations().

00080                                                                                    {
00081   
00082   // Iterate through devices and update device descriptions
00083   uint16_t updated = 0;
00084   SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
00085   for ( idevice = devices.begin(); idevice != devices.end(); idevice++ ) {
00086     
00087     if ( (*idevice)->getDeviceType() != LASERDRIVER ) { continue; }
00088 
00089     // Cast to retrieve appropriate description object
00090     laserdriverDescription* desc = dynamic_cast<laserdriverDescription*>( *idevice );
00091     if ( !desc ) { continue; }
00092     
00093     // Retrieve device addresses from device description
00094     const SiStripConfigDb::DeviceAddress& addr = db()->deviceAddress(*desc);
00095     
00096     // Iterate through LLD channels
00097     for ( uint16_t ichan = 0; ichan < sistrip::CHANS_PER_LLD; ichan++ ) {
00098       
00099       // Construct key from device description
00100       SiStripFecKey fec_key( addr.fecCrate_, 
00101                              addr.fecSlot_, 
00102                              addr.fecRing_, 
00103                              addr.ccuAddr_, 
00104                              addr.ccuChan_,
00105                              ichan+1 );
00106       
00107       // Iterate through all channels and extract LLD settings 
00108       Analyses::const_iterator iter = data().find( fec_key.key() );
00109       if ( iter != data().end() ) {
00110 
00111         if ( !iter->second->isValid() ) { 
00112           addProblemDevice( fec_key ); //@@ Remove problem device
00113           continue; 
00114         }
00115 
00116         OptoScanAnalysis* anal = dynamic_cast<OptoScanAnalysis*>( iter->second );
00117         if ( !anal ) { 
00118           edm::LogError(mlDqmClient_)
00119             << "[OptoScanHistosUsingDb::" << __func__ << "]"
00120             << " NULL pointer to analysis object!";     
00121           continue; 
00122         }
00123         
00124         uint16_t gain = anal->gain();
00125         std::stringstream ss;
00126         ss << "[OptoScanHistosUsingDb::" << __func__ << "]"
00127            << " Updating LLD gain/bias settings for crate/crate/FEC/ring/CCU/module/LLD "
00128            << fec_key.fecCrate() << "/"
00129            << fec_key.fecSlot() << "/"
00130            << fec_key.fecRing() << "/"
00131            << fec_key.ccuAddr() << "/"
00132            << fec_key.ccuChan() << "/"
00133            << fec_key.channel() 
00134            << " from "
00135            << static_cast<uint16_t>( desc->getGain(ichan) ) << "/" 
00136            << static_cast<uint16_t>( desc->getBias(ichan) );
00137         desc->setGain( ichan, gain );
00138         desc->setBias( ichan, anal->bias()[gain] );
00139         updated++;
00140         ss << " to "
00141            << static_cast<uint16_t>(desc->getGain(ichan)) << "/" 
00142            << static_cast<uint16_t>(desc->getBias(ichan));
00143         LogTrace(mlDqmClient_) << ss.str();
00144         
00145       } else {
00146         if ( deviceIsPresent(fec_key) ) { 
00147           edm::LogWarning(mlDqmClient_) 
00148             << "[OptoScanHistosUsingDb::" << __func__ << "]"
00149             << " Unable to find FEC key with params crate/FEC/ring/CCU/module/LLD " 
00150             << fec_key.fecCrate() << "/"
00151             << fec_key.fecSlot() << "/"
00152             << fec_key.fecRing() << "/"
00153             << fec_key.ccuAddr() << "/"
00154             << fec_key.ccuChan() << "/"
00155             << fec_key.channel();
00156         }
00157       }
00158     }
00159   }
00160 
00161   edm::LogVerbatim(mlDqmClient_) 
00162     << "[OptoScanHistosUsingDb::" << __func__ << "]"
00163     << " Updated LLD bias/gain settings for " 
00164     << updated << " modules";
00165   
00166 
00167 }

void OptoScanHistosUsingDb::uploadConfigurations (  )  [virtual]

Reimplemented from CommissioningHistosUsingDb.

Definition at line 47 of file OptoScanHistosUsingDb.cc.

References CommissioningHistosUsingDb::db(), CommissioningHistosUsingDb::doUploadConf(), SiStripConfigDb::getDeviceDescriptions(), LogTrace, sistrip::mlDqmClient_, update(), and SiStripConfigDb::uploadDeviceDescriptions().

00047                                                  {
00048   LogTrace(mlDqmClient_) 
00049     << "[OptoScanHistosUsingDb::" << __func__ << "]";
00050 
00051   if ( !db() ) {
00052     edm::LogError(mlDqmClient_) 
00053       << "[OptoScanHistosUsingDb::" << __func__ << "]"
00054       << " NULL pointer to SiStripConfigDb interface!"
00055       << " Aborting upload...";
00056     return;
00057   }
00058   
00059   // Update LLD descriptions with new bias/gain settings
00060   SiStripConfigDb::DeviceDescriptionsRange devices = db()->getDeviceDescriptions( LASERDRIVER ); 
00061   update( devices );
00062   if ( doUploadConf() ) { 
00063     edm::LogVerbatim(mlDqmClient_) 
00064       << "[OptoScanHistosUsingDb::" << __func__ << "]"
00065       << " Uploading LLD settings to DB...";
00066     db()->uploadDeviceDescriptions(); 
00067     edm::LogVerbatim(mlDqmClient_) 
00068       << "[OptoScanHistosUsingDb::" << __func__ << "]"
00069       << " Upload of LLD settings to DB finished!";
00070   } else {
00071     edm::LogWarning(mlDqmClient_) 
00072       << "[OptoScanHistosUsingDb::" << __func__ << "]"
00073       << " TEST only! No LLD settings will be uploaded to DB...";
00074   }
00075   
00076 }


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