CMS 3D CMS Logo

Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends

SiStripConfigDb Class Reference

An interface class to the DeviceFactory. More...

#include <SiStripConfigDb.h>

List of all members.

Classes

class  DeviceAddress
class  Run

Public Member Functions

 SiStripConfigDb (const edm::ParameterSet &, const edm::ActivityRegistry &)
 ~SiStripConfigDb ()

Protected Types

typedef
CommissioningAnalysisDescription 
AnalysisDescription
typedef edm::MapOfVectors
< std::string,
AnalysisDescription * > 
AnalysisDescriptions
typedef AnalysisDescriptions::range AnalysisDescriptionsRange
typedef std::vector
< AnalysisDescription * > 
AnalysisDescriptionsV
typedef
CommissioningAnalysisDescription::commissioningType 
AnalysisType
typedef std::pair< uint32_t,
TkDcuInfo * > 
DcuDetId
typedef Sgi::hash_map
< unsigned long, TkDcuInfo * > 
DcuDetIdMap
typedef edm::MapOfVectors
< std::string, DcuDetId
DcuDetIds
typedef DcuDetIds::range DcuDetIdsRange
typedef std::vector< DcuDetIdDcuDetIdsV
typedef deviceDescription DeviceDescription
typedef edm::MapOfVectors
< std::string,
DeviceDescription * > 
DeviceDescriptions
typedef DeviceDescriptions::range DeviceDescriptionsRange
typedef std::vector
< DeviceDescription * > 
DeviceDescriptionsV
typedef enumDeviceType DeviceType
typedef ConnectionDescription FedConnection
typedef edm::MapOfVectors
< std::string, FedConnection * > 
FedConnections
typedef FedConnections::range FedConnectionsRange
typedef std::vector
< FedConnection * > 
FedConnectionsV
typedef Fed9U::Fed9UDescription FedDescription
typedef edm::MapOfVectors
< std::string, FedDescription * > 
FedDescriptions
typedef FedDescriptions::range FedDescriptionsRange
typedef std::vector
< FedDescription * > 
FedDescriptionsV
typedef std::vector< uint16_t > FedIds
typedef boost::iterator_range
< FedIds::const_iterator > 
FedIdsRange
typedef std::vector< RunRuns
typedef std::map< std::string,
Runs
RunsByPartition
typedef std::map
< sistrip::RunType, Runs
RunsByType

Protected Member Functions

void addAnalysisDescriptions (std::string partition, AnalysisDescriptionsV &)
void addDcuDetIds (std::string partition, DcuDetIdsV &)
void addDeviceDescriptions (std::string partition, DeviceDescriptionsV &)
void addFedConnections (std::string partition, FedConnectionsV &)
void addFedDescriptions (std::string partition, FedDescriptionsV &)
std::string analysisType (AnalysisType) const
void clearAnalysisDescriptions (std::string partition="")
void clearDcuDetIds (std::string partition="")
void clearDeviceDescriptions (std::string partition="")
void clearFedConnections (std::string partition="")
void clearFedDescriptions (std::string partition="")
void closeDbConnection ()
DbClient *const databaseCache (std::string method_name="") const
const SiStripDbParamsdbParams () const
DeviceAddress deviceAddress (const AnalysisDescription &)
DeviceAddress deviceAddress (const deviceDescription &)
DeviceFactory *const deviceFactory (std::string method_name="") const
AnalysisDescriptionsRange getAnalysisDescriptions (AnalysisType, std::string partition="")
DcuDetIdsRange getDcuDetIds (std::string partition="")
DeviceDescriptionsRange getDeviceDescriptions (DeviceType, std::string partition="")
DeviceDescriptionsRange getDeviceDescriptions (std::string partition="")
FedConnectionsRange getFedConnections (std::string partition="")
FedDescriptionsRange getFedDescriptions (std::string partition="")
FedIdsRange getFedIds (std::string partition="")
void openDbConnection ()
void partitions (std::list< std::string > &) const
void printAnalysisDescriptions (std::string partition="")
void printDcuDetIds (std::string partition="")
void printDeviceDescriptions (std::string partition="")
void printFedConnections (std::string partition="")
void printFedDescriptions (std::string partition="")
void runs (const Runs &in, RunsByPartition &out, sistrip::RunType optional_type=sistrip::UNDEFINED_RUN_TYPE) const
void runs (const Runs &in, RunsByType &out, std::string optional_partition="") const
void runs (Runs &) const
void uploadAnalysisDescriptions (bool calibration_for_physics=false, std::string partition="")
void uploadDcuDetIds (std::string partition="")
void uploadDeviceDescriptions (std::string partition="")
void uploadFedConnections (std::string partition="")
void uploadFedDescriptions (std::string partition="")
bool usingDb () const
bool usingStrips () const
void usingStrips (bool)

Static Protected Member Functions

static DcuDetIdsV::const_iterator findDcuDetId (DcuDetIdsV::const_iterator begin, DcuDetIdsV::const_iterator end, uint32_t dcu_id)
static DcuDetIdsV::iterator findDcuDetId (DcuDetIdsV::iterator begin, DcuDetIdsV::iterator end, uint32_t dcu_id)

Private Member Functions

bool checkFileExists (const std::string &path)
void clearLocalCache ()
void clone (const DcuDetIdMap &in, DcuDetIdsV &out) const
void clone (const DcuDetIdsV &in, DcuDetIdMap &out) const
void clone (const DcuDetIdsV &in, DcuDetIdsV &out) const
std::string deviceType (const enumDeviceType &device_type) const
void handleException (const std::string &method_name, const std::string &extra_info="") const
void usingDatabase ()
void usingDatabaseCache ()
void usingXmlFiles ()

Private Attributes

AnalysisDescriptions analyses_
DeviceDescriptionsV apvDevices_
FedConnections connections_
DbClient * dbCache_
SiStripDbParams dbParams_
DcuDetIds dcuDetIds_
DeviceDescriptionsV dcuDevices_
DeviceDescriptions devices_
DeviceDescriptionsV dohDevices_
DeviceFactory * factory_
FedIds fedIds_
FedDescriptions feds_
DeviceDescriptionsV lldDevices_
DeviceDescriptionsV muxDevices_
bool openConnection_
DeviceDescriptionsV pllDevices_
DeviceDescriptionsV typedDevices_
bool usingStrips_

Static Private Attributes

static bool allowCalibUpload_ = false
static uint32_t cntr_ = 0

Friends

class ApvTimingHistosUsingDb
class CalibrationHistosUsingDb
class CommissioningHistosUsingDb
class FastFedCablingHistosUsingDb
class FedCablingHistosUsingDb
class FineDelayHistosUsingDb
class LatencyHistosUsingDb
class NoiseHistosUsingDb
class OptoScanHistosUsingDb
class PedestalsHistosUsingDb
class PedsFullNoiseHistosUsingDb
class PedsOnlyHistosUsingDb
class SiStripCommissioningDbClient
class SiStripCommissioningOfflineDbClient
class SiStripCondObjBuilderFromDb
class SiStripFedCablingBuilderFromDb
class SiStripNoiseBuilderFromDb
class SiStripPartition
class SiStripPedestalsBuilderFromDb
class SiStripPsuDetIdMap
class testSiStripConfigDb
class VpspScanHistosUsingDb

Detailed Description

An interface class to the DeviceFactory.

Author:
R.Bainbridge

Definition at line 45 of file SiStripConfigDb.h.


Member Typedef Documentation

typedef CommissioningAnalysisDescription SiStripConfigDb::AnalysisDescription [protected]

Definition at line 142 of file SiStripConfigDb.h.

Definition at line 143 of file SiStripConfigDb.h.

Definition at line 144 of file SiStripConfigDb.h.

Definition at line 145 of file SiStripConfigDb.h.

typedef CommissioningAnalysisDescription::commissioningType SiStripConfigDb::AnalysisType [protected]

Definition at line 141 of file SiStripConfigDb.h.

typedef std::pair<uint32_t,TkDcuInfo*> SiStripConfigDb::DcuDetId [protected]

Definition at line 134 of file SiStripConfigDb.h.

typedef Sgi::hash_map<unsigned long,TkDcuInfo*> SiStripConfigDb::DcuDetIdMap [protected]

Definition at line 133 of file SiStripConfigDb.h.

typedef edm::MapOfVectors<std::string,DcuDetId> SiStripConfigDb::DcuDetIds [protected]

Definition at line 135 of file SiStripConfigDb.h.

Definition at line 136 of file SiStripConfigDb.h.

typedef std::vector<DcuDetId> SiStripConfigDb::DcuDetIdsV [protected]

Definition at line 137 of file SiStripConfigDb.h.

typedef deviceDescription SiStripConfigDb::DeviceDescription [protected]

Definition at line 117 of file SiStripConfigDb.h.

Definition at line 118 of file SiStripConfigDb.h.

Definition at line 119 of file SiStripConfigDb.h.

typedef std::vector<DeviceDescription*> SiStripConfigDb::DeviceDescriptionsV [protected]

Definition at line 120 of file SiStripConfigDb.h.

typedef enumDeviceType SiStripConfigDb::DeviceType [protected]

Definition at line 116 of file SiStripConfigDb.h.

typedef ConnectionDescription SiStripConfigDb::FedConnection [protected]

Definition at line 110 of file SiStripConfigDb.h.

Definition at line 111 of file SiStripConfigDb.h.

Definition at line 112 of file SiStripConfigDb.h.

typedef std::vector<FedConnection*> SiStripConfigDb::FedConnectionsV [protected]

Definition at line 113 of file SiStripConfigDb.h.

typedef Fed9U::Fed9UDescription SiStripConfigDb::FedDescription [protected]

Definition at line 123 of file SiStripConfigDb.h.

Definition at line 124 of file SiStripConfigDb.h.

Definition at line 125 of file SiStripConfigDb.h.

typedef std::vector<FedDescription*> SiStripConfigDb::FedDescriptionsV [protected]

Definition at line 126 of file SiStripConfigDb.h.

typedef std::vector<uint16_t> SiStripConfigDb::FedIds [protected]

Definition at line 129 of file SiStripConfigDb.h.

typedef boost::iterator_range<FedIds::const_iterator> SiStripConfigDb::FedIdsRange [protected]

Definition at line 130 of file SiStripConfigDb.h.

typedef std::vector<Run> SiStripConfigDb::Runs [protected]

Definition at line 203 of file SiStripConfigDb.h.

typedef std::map<std::string,Runs> SiStripConfigDb::RunsByPartition [protected]

Definition at line 207 of file SiStripConfigDb.h.

typedef std::map<sistrip::RunType,Runs> SiStripConfigDb::RunsByType [protected]

Definition at line 205 of file SiStripConfigDb.h.


Constructor & Destructor Documentation

SiStripConfigDb::SiStripConfigDb ( const edm::ParameterSet pset,
const edm::ActivityRegistry activity 
)

Constructor when using the "service" mode, which takes as an argument a ParameterSet (containing the database connection parameters).

Definition at line 22 of file SiStripConfigDb.cc.

References cntr_, dbParams_, sistrip::mlConfigDb_, openDbConnection(), SiStripDbParams::pset(), and SiStripDbParams::reset().

                                                                        :
  factory_(0), 
  dbCache_(0), 
  dbParams_(),
  // Local cache
  connections_(), 
  devices_(), 
  feds_(), 
  dcuDetIds_(), 
  analyses_(),
  apvDevices_(),
  muxDevices_(),
  dcuDevices_(),
  lldDevices_(),
  pllDevices_(),
  dohDevices_(),
  typedDevices_(), 
  fedIds_(),
  // Misc
  usingStrips_(true),
  openConnection_(false)
{
  cntr_++;
  edm::LogVerbatim(mlConfigDb_)
    << "[SiStripConfigDb::" << __func__ << "]"
    << " Constructing database service..."
    << " (Class instance: " << cntr_ << ")";
  
  // Set DB connection parameters
  dbParams_.reset();
  dbParams_.pset( pset );
  //edm::LogVerbatim(mlConfigDb_) << dbParams_; 

  // Open connection
  openDbConnection();
  
}
SiStripConfigDb::~SiStripConfigDb ( )

Default destructor.

Definition at line 63 of file SiStripConfigDb.cc.

References closeDbConnection(), cntr_, LogTrace, and sistrip::mlConfigDb_.

                                  {
  closeDbConnection(); 
  LogTrace(mlConfigDb_)
    << "[SiStripConfigDb::" << __func__ << "]"
    << " Destructing object...";
  if ( cntr_ ) { cntr_--; }
}

Member Function Documentation

void SiStripConfigDb::addAnalysisDescriptions ( std::string  partition,
AnalysisDescriptionsV anals 
) [protected]

Adds to local cache (just for given partition if specified).

Definition at line 163 of file AnalysisDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, and tmp.

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

                                                                                                 {

  if ( !deviceFactory(__func__) ) { return; }

  if ( partition.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition string is empty,"
       << " therefore cannot add analysis descriptions to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  if ( anals.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Vector of analysis descriptions is empty,"
       << " therefore cannot add analysis descriptions to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }

  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
  if ( iter == dbParams_.partitions().end() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" not found in partition list, "
       << " therefore cannot add analysis descriptions!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  AnalysisDescriptionsRange range = analyses_.find( partition );
  if ( range == analyses_.emptyRange() ) {
    
    // Make local copy 
    AnalysisDescriptionsV tmp;
    CommissioningAnalysisFactory::vectorCopy( anals, tmp );
    
    // Add to local cache
    analyses_.loadNext( partition, tmp );

    // Some debug
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Added " << anals.size() 
       << " analysis descriptions to local cache for partition \""
       << partition << "\"."
       << " (Cache holds analysis descriptions for " 
       << analyses_.size() << " partitions.)";
    LogTrace(mlConfigDb_) << ss.str();
    
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" already found in local cache, "
       << " therefore cannot add analysis descriptions!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
}
void SiStripConfigDb::addDcuDetIds ( std::string  partition,
DcuDetIdsV dcus 
) [protected]

Adds to local cache (just for given partition if specified).

Definition at line 109 of file DcuDetIds.cc.

References sistrip::mlConfigDb_.

                                                                          {

  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]" 
     << " Cannot add to local cache! This functionality not allowed!";
  edm::LogWarning(mlConfigDb_) << ss.str(); 
  
  //   if ( !deviceFactory(__func__) ) { return; }
  
  //   if ( partition.empty() ) { 
  //     stringstream ss; 
  //     ss << "[SiStripConfigDb::" << __func__ << "]" 
  //        << " Partition string is empty,"
  //        << " therefore cannot add DCU-DetId map to local cache!"; 
  //     edm::LogWarning(mlConfigDb_) << ss.str(); 
  //     return; 
  //   }
  
  //   if ( dcus.empty() ) { 
  //     stringstream ss; 
  //     ss << "[SiStripConfigDb::" << __func__ << "]" 
  //        << " Vector of DCU-DetId map is empty,"
  //        << " therefore cannot add DCU-DetId map to local cache!"; 
  //     edm::LogWarning(mlConfigDb_) << ss.str(); 
  //     return; 
  //   }

  //   SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
  //   SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
  //   for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
  //   if ( iter == dbParams_.partitions().end() ) { 
  //     stringstream ss; 
  //     ss << "[SiStripConfigDb::" << __func__ << "]" 
  //        << " Partition \"" << partition
  //        << "\" not found in partition list, "
  //        << " therefore cannot add DCU-DetId map!";
  //     edm::LogWarning(mlConfigDb_) << ss.str(); 
  //     return; 
  //   }
  
  //   DcuDetIdsRange range = dcuDetIds_.find( partition );
  //   if ( range == dcuDetIds_.emptyRange() ) {
    
  //     // Make local copy 
  //     DcuDetIdsV dst;
  //     clone( dcus, dst );
    
  //     // Add to local cache
  //     dcuDetIds_.loadNext( partition, dst );
    
  //     // Some debug
  //     std::stringstream ss;
  //     ss << "[SiStripConfigDb::" << __func__ << "]"
  //        << " Added " << dst.size() 
  //        << " DCU-DetId map to local cache for partition \""
  //        << partition << "\"" << std::endl;
  //     ss << "[SiStripConfigDb::" << __func__ << "]"
  //        << " Cache holds DCU-DetId map for " 
  //        << dcuDetIds_.size() << " partitions.";
  //     LogTrace(mlConfigDb_) << ss.str();
    
  //   } else {
  //     stringstream ss; 
  //     ss << "[SiStripConfigDb::" << __func__ << "]" 
  //        << " Partition \"" << partition
  //        << "\" already found in local cache, "
  //        << " therefore cannot add new DCU-DetId map!";
  //     edm::LogWarning(mlConfigDb_) << ss.str(); 
  //     return; 
  //   }
  
}
void SiStripConfigDb::addDeviceDescriptions ( std::string  partition,
DeviceDescriptionsV devs 
) [protected]

Adds to local cache (just for given partition if specified).

Definition at line 200 of file DeviceDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, and tmp.

                                                                                            {

  if ( !deviceFactory(__func__) ) { return; }

  if ( partition.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition string is empty,"
       << " therefore cannot add device descriptions to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  if ( devs.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Vector of device descriptions is empty,"
       << " therefore cannot add device descriptions to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }

  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
  if ( iter == dbParams_.partitions().end() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" not found in partition list, "
       << " therefore cannot add device descriptions!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  DeviceDescriptionsRange range = devices_.find( partition );
  if ( range == devices_.emptyRange() ) {
    
    // Make local copy 
    DeviceDescriptionsV tmp;
    FecFactory::vectorCopyI( tmp, devs, true );
    
    // Add to local cache
    devices_.loadNext( partition, tmp );

    // Some debug
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Added " << devs.size() 
       << " device descriptions to local cache for partition \""
       << partition << "\"."
       << " (Cache holds device descriptions for " 
       << devices_.size() << " partitions.)";
    LogTrace(mlConfigDb_) << ss.str();
    
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" already found in local cache, "
       << " therefore cannot add device descriptions!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
}
void SiStripConfigDb::addFedConnections ( std::string  partition,
FedConnectionsV conns 
) [protected]

Add to local cache (just for given partition if specified).

Definition at line 128 of file FedConnections.cc.

References LogTrace, sistrip::mlConfigDb_, and tmp.

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

                                                                                     {

  if ( !deviceFactory(__func__) ) { return; }

  if ( partition.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition string is empty,"
       << " therefore cannot add FED connections to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  if ( conns.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Vector of FED connections is empty,"
       << " therefore cannot add FED connections to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }

  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
  if ( iter == dbParams_.partitions().end() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" not found in partition list, "
       << " therefore cannot add FED connections!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  FedConnectionsRange range = connections_.find( partition );
  if ( range == connections_.emptyRange() ) {
    
    // Make local copy 
    FedConnectionsV tmp;
    ConnectionFactory::vectorCopyI( tmp, conns, true );
    
    // Add to local cache
    connections_.loadNext( partition, tmp );

    // Some debug
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Added " << conns.size() 
       << " FED connections to local cache for partition \""
       << partition << "\"" << std::endl;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Cache holds FED connections for " 
       << connections_.size() << " partitions.";
    LogTrace(mlConfigDb_) << ss.str();
    
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" already found in local cache, "
       << " therefore cannot add new FED connections!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
}
void SiStripConfigDb::addFedDescriptions ( std::string  partition,
FedDescriptionsV feds 
) [protected]

Adds to local cache (just for given partition if specified).

Definition at line 132 of file FedDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, and tmp.

                                                                                      {

  if ( !deviceFactory(__func__) ) { return; }

  if ( partition.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition string is empty,"
       << " therefore cannot add FED descriptions to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  if ( feds.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Vector of FED descriptions is empty,"
       << " therefore cannot add FED descriptions to local cache!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }

  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
  if ( iter == dbParams_.partitions().end() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" not found in partition list, "
       << " therefore cannot add FED descriptions!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  FedDescriptionsRange range = feds_.find( partition );
  if ( range == feds_.emptyRange() ) {
    
    // Make local copy 
    FedDescriptionsV tmp;
    Fed9U::Fed9UDeviceFactory::vectorCopy( tmp, feds );

    // Add to local cache
    feds_.loadNext( partition, tmp );
    
    // Some debug
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Added " << feds.size() 
       << " FED descriptions to local cache for partition \""
       << iter->second.partitionName() << "\"" << std::endl;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Cache holds FED descriptions for " 
       << feds_.size() << " partitions.";
    LogTrace(mlConfigDb_) << ss.str();
    
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Partition \"" << partition
       << "\" already found in local cache, "
       << " therefore cannot add new FED descriptions!";
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
}
std::string SiStripConfigDb::analysisType ( AnalysisType  analysis_type) const [protected]

Returns string for given analysis type.

Definition at line 515 of file AnalysisDescriptions.cc.

                                                                          {
  if      ( analysis_type == AnalysisDescription::T_ANALYSIS_FASTFEDCABLING ) { return "FAST_CABLING"; }
  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_TIMING )         { return "APV_TIMING"; }
  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_OPTOSCAN )       { return "OPTO_SCAN"; }
  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDESTALS )      { return "PEDESTALS"; }
  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY )     { return "APV_LATENCY"; }
  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_FINEDELAY )      { return "FINE_DELAY"; }
  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_CALIBRATION )    { return "CALIBRATION"; }
  else if ( analysis_type == AnalysisDescription::T_UNKNOWN )                 { return "UNKNOWN ANALYSIS TYPE"; }
  else { return "UNDEFINED ANALYSIS TYPE"; }
}
bool SiStripConfigDb::checkFileExists ( const std::string &  path) [private]

Checks whether file at "path" exists or not.

Definition at line 810 of file SiStripConfigDb.cc.

References recoMuon::in.

Referenced by usingXmlFiles().

                                                             {
  fstream fs; 
  fs.open( path.c_str(), ios::in );
  if( !fs.is_open() ) { return false; }
  fs.close();
  return true;
}
void SiStripConfigDb::clearAnalysisDescriptions ( std::string  partition = "") [protected]

Clears local cache (just for given partition if specified).

Definition at line 329 of file AnalysisDescriptions.cc.

References begin, end, edm::MapOfVectors< K, T >::loadNext(), LogTrace, and sistrip::mlConfigDb_.

Referenced by clearLocalCache(), and CommissioningHistosUsingDb::uploadAnalyses().

                                                                     {
  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
  
  if ( analyses_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached analysis descriptions!"; 
    //edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
  AnalysisDescriptions temporary_cache;
  if ( partition == ""  ) { temporary_cache = AnalysisDescriptions(); }
  else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      if ( partition != iter->second.partitionName() ) {
        AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() );
        if ( range != analyses_.emptyRange() ) {
          temporary_cache.loadNext( partition, AnalysisDescriptionsV( range.begin(), range.end() ) );
        } else {
          //      stringstream ss; 
          //      ss << "[SiStripConfigDb::" << __func__ << "]" 
          //         << " Cannot find partition \"" << iter->second.partitionName()
          //         << "\" in local cache!";
          //      edm::LogWarning(mlConfigDb_) << ss.str(); 
        }
      }
    }
  }
  
  // Delete objects in local cache for specified partition (or all if not specified) 
  AnalysisDescriptionsRange anals = analyses_.emptyRange();
  if ( partition == "" ) { 
    if ( !analyses_.empty() ) {
      anals = AnalysisDescriptionsRange( analyses_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                         analyses_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { anals = analyses_.emptyRange(); }
  } else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
    anals = analyses_.find( iter->second.partitionName() );
  }
  
  if ( anals != analyses_.emptyRange() ) {
    AnalysisDescriptionsV::const_iterator ianal = anals.begin();
    AnalysisDescriptionsV::const_iterator janal = anals.end();
    for ( ; ianal != janal; ++ianal ) { if ( *ianal ) { delete *ianal; } }
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]";
    if ( partition == "" ) { ss << " Found no analysis descriptions in local cache!"; }
    else { ss << " Found no analysis descriptions in local cache for partition \"" << partition << "\"!"; }
    edm::LogWarning(mlConfigDb_) << ss.str(); 
  }
  
  // Overwrite local cache with temporary cache
  analyses_ = temporary_cache; 

}
void SiStripConfigDb::clearDcuDetIds ( std::string  partition = "") [protected]

Clears local cache (just for given partition if specified).

Definition at line 273 of file DcuDetIds.cc.

References begin, end, edm::MapOfVectors< K, T >::loadNext(), LogTrace, and sistrip::mlConfigDb_.

Referenced by clearLocalCache().

                                                          {
  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
  
  if ( dcuDetIds_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached DCU-DetId map!"; 
    //edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
  DcuDetIds temporary_cache;
  if ( partition == ""  ) { temporary_cache = DcuDetIds(); }
  else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      if ( partition != iter->second.partitionName() ) {
        DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
        if ( range != dcuDetIds_.emptyRange() ) {
          temporary_cache.loadNext( partition, DcuDetIdsV( range.begin(), range.end() ) );
        } else {
          //      stringstream ss; 
          //      ss << "[SiStripConfigDb::" << __func__ << "]" 
          //         << " Cannot find partition \"" << iter->second.partitionName()
          //         << "\" in local cache!";
          //      edm::LogWarning(mlConfigDb_) << ss.str(); 
        }
      }
    }
  }
  
  // Delete objects in local cache for specified partition (or all if not specified) 
  DcuDetIdsRange dcus;
  if ( partition == "" ) { 
    if ( !dcuDetIds_.empty() ) {
      dcus = DcuDetIdsRange( dcuDetIds_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                             dcuDetIds_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { dcus = dcuDetIds_.emptyRange(); }
  } else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
    dcus = dcuDetIds_.find( iter->second.partitionName() );
  }
  
  if ( dcus != dcuDetIds_.emptyRange() ) {
    DcuDetIdsV::const_iterator ifed = dcus.begin();
    DcuDetIdsV::const_iterator jfed = dcus.end();
    for ( ; ifed != jfed; ++ifed ) { if ( ifed->second ) { delete ifed->second; } }
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]";
    if ( partition == "" ) { ss << " Found no DCU-DetId map in local cache!"; }
    else { ss << " Found no DCU-DetId map in local cache for partition \"" << partition << "\"!"; }
    edm::LogWarning(mlConfigDb_) << ss.str(); 
  }
  
  // Overwrite local cache with temporary cache
  dcuDetIds_ = temporary_cache; 

}
void SiStripConfigDb::clearDeviceDescriptions ( std::string  partition = "") [protected]

Clears local cache (just for given partition if specified).

Definition at line 345 of file DeviceDescriptions.cc.

References begin, end, edm::MapOfVectors< K, T >::loadNext(), LogTrace, and sistrip::mlConfigDb_.

Referenced by clearLocalCache(), and FineDelayHistosUsingDb::uploadConfigurations().

                                                                   {
  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
  
  if ( devices_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached device descriptions!"; 
    //edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
  DeviceDescriptions temporary_cache;
  if ( partition == ""  ) { temporary_cache = DeviceDescriptions(); }
  else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      if ( partition != iter->second.partitionName() ) {
        DeviceDescriptionsRange range = devices_.find( iter->second.partitionName() );
        if ( range != devices_.emptyRange() ) {
          temporary_cache.loadNext( partition, DeviceDescriptionsV( range.begin(), range.end() ) );
        } else {
          //      stringstream ss; 
          //      ss << "[SiStripConfigDb::" << __func__ << "]" 
          //         << " Cannot find partition \"" << iter->second.partitionName()
          //         << "\" in local cache!";
          //      edm::LogWarning(mlConfigDb_) << ss.str(); 
        }
      }
    }
  }

  // Delete objects in local cache for specified partition (or all if not specified) 
  DeviceDescriptionsRange devs;
  if ( partition == "" ) { 
    if ( !devices_.empty() ) {
      devs = DeviceDescriptionsRange( devices_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                      devices_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { devs = devices_.emptyRange(); }
  } else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
    devs = devices_.find( iter->second.partitionName() );
  }
  
  if ( devs != devices_.emptyRange() ) {
    DeviceDescriptionsV::const_iterator ifed = devs.begin();
    DeviceDescriptionsV::const_iterator jfed = devs.end();
    for ( ; ifed != jfed; ++ifed ) { if ( *ifed ) { delete *ifed; } }
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]";
    if ( partition == "" ) { ss << " Found no device descriptions in local cache!"; }
    else { ss << " Found no device descriptions in local cache for partition \"" << partition << "\"!"; }
    edm::LogWarning(mlConfigDb_) << ss.str(); 
  }
  
  // Overwrite local cache with temporary cache
  devices_ = temporary_cache; 

}
void SiStripConfigDb::clearFedConnections ( std::string  partition = "") [protected]

Clears local cache (just for given partition if specified).

Definition at line 278 of file FedConnections.cc.

References begin, end, edm::MapOfVectors< K, T >::loadNext(), LogTrace, and sistrip::mlConfigDb_.

Referenced by clearLocalCache(), and FastFedCablingHistosUsingDb::uploadConfigurations().

                                                               {
  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
  
  if ( connections_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached FED connections!"; 
    //edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
  FedConnections temporary_cache;
  if ( partition == ""  ) { temporary_cache = FedConnections(); }
  else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      if ( partition != iter->second.partitionName() ) {
        FedConnectionsRange range = connections_.find( iter->second.partitionName() );
        if ( range != connections_.emptyRange() ) {
          temporary_cache.loadNext( partition, FedConnectionsV( range.begin(), range.end() ) );
        } else {
          //      stringstream ss; 
          //      ss << "[SiStripConfigDb::" << __func__ << "]" 
          //         << " Cannot find partition \"" << iter->second.partitionName()
          //         << "\" in local cache!";
          //      edm::LogWarning(mlConfigDb_) << ss.str(); 
        }
      }
    }
  }

  // Delete objects in local cache for specified partition (or all if not specified) 
  FedConnectionsRange conns;
  if ( partition == "" ) { 
    if ( !connections_.empty() ) {
      conns = FedConnectionsRange( connections_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                   connections_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { conns = connections_.emptyRange(); }
  } else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
    conns = connections_.find( iter->second.partitionName() );
  }
  
  if ( conns != connections_.emptyRange() ) {
    FedConnectionsV::const_iterator ifed = conns.begin();
    FedConnectionsV::const_iterator jfed = conns.end();
    for ( ; ifed != jfed; ++ifed ) { if ( *ifed ) { delete *ifed; } }
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]";
    if ( partition == "" ) { ss << " Found no FED connections in local cache!"; }
    else { ss << " Found no FED connections in local cache for partition \"" << partition << "\"!"; }
    edm::LogWarning(mlConfigDb_) << ss.str(); 
  }
  
  // Overwrite local cache with temporary cache
  connections_ = temporary_cache; 

}
void SiStripConfigDb::clearFedDescriptions ( std::string  partition = "") [protected]

Clears local cache (just for given partition if specified).

Definition at line 278 of file FedDescriptions.cc.

References begin, end, edm::MapOfVectors< K, T >::loadNext(), LogTrace, and sistrip::mlConfigDb_.

Referenced by clearLocalCache(), and FineDelayHistosUsingDb::uploadConfigurations().

                                                                {
  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
  
  if ( feds_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached FED descriptions!"; 
    //edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
  FedDescriptions temporary_cache;
  if ( partition == ""  ) { temporary_cache = FedDescriptions(); }
  else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      if ( partition != iter->second.partitionName() ) {
        FedDescriptionsRange range = feds_.find( iter->second.partitionName() );
        if ( range != feds_.emptyRange() ) {
          temporary_cache.loadNext( partition, FedDescriptionsV( range.begin(), range.end() ) );
        }
      } else {
        FedDescriptionsRange range = feds_.find( iter->second.partitionName() );
        if ( range != feds_.emptyRange() ) {
          LogTrace(mlConfigDb_) 
            << "[SiStripConfigDb::" << __func__ << "]"
            << " Deleting FED descriptions for partition \""
            << iter->second.partitionName()
            << "\" from local cache...";
        }
      }
    }
  }
  
  // Delete objects in local cache for specified partition (or all if not specified) 
  FedDescriptionsRange feds;
  if ( partition == "" ) { 
    if ( !feds_.empty() ) {
      feds = FedDescriptionsRange( feds_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                   feds_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { feds = feds_.emptyRange(); }
  } else {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
    feds = feds_.find( iter->second.partitionName() );
  }
  
  if ( feds != feds_.emptyRange() ) {
    FedDescriptionsV::const_iterator ifed = feds.begin();
    FedDescriptionsV::const_iterator jfed = feds.end();
    for ( ; ifed != jfed; ++ifed ) { if ( *ifed ) { delete *ifed; } }
  } else {
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]";
    if ( partition == "" ) { ss << " Found no FED descriptions in local cache!"; }
    else { ss << " Found no FED descriptions in local cache for partition \"" << partition << "\"!"; }
    edm::LogWarning(mlConfigDb_) << ss.str(); 
  }
  
  // Overwrite local cache with temporary cache
  feds_ = temporary_cache; 

}
void SiStripConfigDb::clearLocalCache ( ) [private]
void SiStripConfigDb::clone ( const DcuDetIdsV in,
DcuDetIdMap out 
) const [private]

Definition at line 378 of file DcuDetIds.cc.

                                                                                {
  output.clear();
  DcuDetIdsV::const_iterator ii = input.begin();
  DcuDetIdsV::const_iterator jj = input.end();
  for ( ; ii != jj; ++ii ) { if ( ii->second ) { output[ii->first] = new TkDcuInfo( *(ii->second) ); } }
}
void SiStripConfigDb::clone ( const DcuDetIdMap in,
DcuDetIdsV out 
) const [private]

Definition at line 369 of file DcuDetIds.cc.

                                                                                {
  output.clear();
  DcuDetIdMap::const_iterator ii = input.begin();
  DcuDetIdMap::const_iterator jj = input.end();
  for ( ; ii != jj; ++ii ) { if ( ii->second ) { output.push_back( std::make_pair( ii->first, new TkDcuInfo( *(ii->second) ) ) ); } }
}
void SiStripConfigDb::clone ( const DcuDetIdsV in,
DcuDetIdsV out 
) const [private]

Definition at line 387 of file DcuDetIds.cc.

                                                                               {
  output.clear();
  DcuDetIdsV::const_iterator ii = input.begin();
  DcuDetIdsV::const_iterator jj = input.end();
  for ( ; ii != jj; ++ii ) { if ( ii->second ) { output.push_back( std::make_pair( ii->first, new TkDcuInfo( *(ii->second) ) ) ); } }
}
void SiStripConfigDb::closeDbConnection ( ) [protected]

Closes connection to DeviceFactory API.

Definition at line 141 of file SiStripConfigDb.cc.

References clearLocalCache(), dbCache_, factory_, handleException(), LogTrace, sistrip::mlConfigDb_, and openConnection_.

Referenced by ~SiStripConfigDb().

                                        {

  LogTrace(mlConfigDb_) 
    << "[SiStripConfigDb::" << __func__ << "]"
    << " Closing connection to database...";

  // Check if connection exists
  if ( !openConnection_ ) {
    edm::LogWarning(mlConfigDb_) 
      << "[SiStripConfigDb::" << __func__ << "]"
      << " No connection open!";
    return;
  }
  openConnection_ = false;
  
  // Clear local caches
  clearLocalCache();
  
  try { 
    if ( factory_ ) { delete factory_; }
  } catch (...) { handleException( __func__, "Attempting to delete DeviceFactory object..." ); }
  factory_ = 0; 

  try { 
    if ( dbCache_ ) { delete dbCache_; }
  } catch (...) { handleException( __func__, "Attempting to delete DbClient object..." ); }
  dbCache_ = 0; 
  
  LogTrace(mlConfigDb_) 
    << "[SiStripConfigDb::" << __func__ << "]"
    << " Closed connection to database...";
  
}
DbClient *const SiStripConfigDb::databaseCache ( std::string  method_name = "") const [protected]

Returns pointer to DeviceFactory API, with check if NULL.

Definition at line 212 of file SiStripConfigDb.cc.

References dbCache_, and sistrip::mlConfigDb_.

Referenced by SiStripFedCablingBuilderFromDb::make(), and usingDatabaseCache().

                                                                            { 
  if ( dbCache_ ) { return dbCache_; }
  else { 
    if ( method_name != "" ) { 
      stringstream ss;
      ss << "[SiStripConfigDb::" << __func__ << "]"
         << " NULL pointer to DbClient requested by" 
         << " method SiStripConfigDb::" << method_name << "()!";
      edm::LogWarning(mlConfigDb_) << ss.str();
    }
    return 0;
  }
}
const SiStripDbParams & SiStripConfigDb::dbParams ( ) const [inline, protected]
SiStripConfigDb::DeviceAddress SiStripConfigDb::deviceAddress ( const AnalysisDescription desc) [protected]

Extracts unique hardware address of device from description.

Definition at line 494 of file AnalysisDescriptions.cc.

References SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, sistrip::FEC_CRATE_OFFSET, sistrip::FEC_RING_OFFSET, SiStripConfigDb::DeviceAddress::fecCrate_, SiStripConfigDb::DeviceAddress::feChan_, SiStripConfigDb::DeviceAddress::fecRing_, SiStripConfigDb::DeviceAddress::fecSlot_, SiStripConfigDb::DeviceAddress::fedId_, SiStripConfigDb::DeviceAddress::feUnit_, SiStripConfigDb::DeviceAddress::i2cAddr_, SiStripFecKey::lldChan(), and SiStripConfigDb::DeviceAddress::lldChan_.

                                                                                             {
  
  DeviceAddress addr;
  try {
    addr.fecCrate_ = static_cast<uint16_t>( desc.getCrate() + sistrip::FEC_CRATE_OFFSET );
    addr.fecSlot_  = static_cast<uint16_t>( desc.getSlot() );
    addr.fecRing_  = static_cast<uint16_t>( desc.getRing() + sistrip::FEC_RING_OFFSET );
    addr.ccuAddr_  = static_cast<uint16_t>( desc.getCcuAdr() );
    addr.ccuChan_  = static_cast<uint16_t>( desc.getCcuChan() );
    addr.lldChan_  = static_cast<uint16_t>( SiStripFecKey::lldChan( desc.getI2cAddr() ) );
    addr.i2cAddr_  = static_cast<uint16_t>( desc.getI2cAddr() );
    addr.fedId_    = static_cast<uint16_t>( desc.getFedId() ); //@@ offset required? crate/slot needed?
    addr.feUnit_   = static_cast<uint16_t>( desc.getFeUnit() );
    addr.feChan_   = static_cast<uint16_t>( desc.getFeChan() );
  } catch (...) { handleException( __func__ ); }
  
  return addr;
}
SiStripConfigDb::DeviceAddress SiStripConfigDb::deviceAddress ( const deviceDescription &  description) [protected]

Extracts unique hardware address of device from description.

Definition at line 513 of file DeviceDescriptions.cc.

References SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, idDealer::description, sistrip::FEC_CRATE_OFFSET, sistrip::FEC_RING_OFFSET, SiStripConfigDb::DeviceAddress::fecCrate_, SiStripConfigDb::DeviceAddress::fecRing_, SiStripConfigDb::DeviceAddress::fecSlot_, SiStripConfigDb::DeviceAddress::i2cAddr_, SiStripFecKey::lldChan(), and SiStripConfigDb::DeviceAddress::lldChan_.

Referenced by FastFedCablingHistosUsingDb::addDcuDetIds(), CommissioningHistosUsingDb::buildDetInfo(), SiStripFedCablingBuilderFromDb::buildFecCablingFromDevices(), CalibrationHistosUsingDb::CalibrationHistosUsingDb(), FastFedCablingHistosUsingDb::connections(), OptoScanHistosUsingDb::update(), LatencyHistosUsingDb::update(), CalibrationHistosUsingDb::update(), ApvTimingHistosUsingDb::update(), VpspScanHistosUsingDb::update(), and FineDelayHistosUsingDb::update().

                                                                                                  {
  
  deviceDescription& desc = const_cast<deviceDescription&>(description); 
  
  DeviceAddress addr;
  try {
    addr.fecCrate_ = static_cast<uint16_t>( desc.getCrateId() + sistrip::FEC_CRATE_OFFSET ); //@@ temporary offset?
    addr.fecSlot_  = static_cast<uint16_t>( desc.getFecSlot() );
    addr.fecRing_  = static_cast<uint16_t>( desc.getRingSlot() + sistrip::FEC_RING_OFFSET ); //@@ temporary offset?
    addr.ccuAddr_  = static_cast<uint16_t>( desc.getCcuAddress() );
    addr.ccuChan_  = static_cast<uint16_t>( desc.getChannel() );
    addr.lldChan_  = static_cast<uint16_t>( SiStripFecKey::lldChan( desc.getAddress() ) );
    addr.i2cAddr_  = static_cast<uint16_t>( desc.getAddress() );
  } catch (...) { handleException( __func__ ); }
  
  return addr;
}
DeviceFactory *const SiStripConfigDb::deviceFactory ( std::string  method_name = "") const [protected]

Returns pointer to DeviceFactory API, with check if NULL.

Definition at line 196 of file SiStripConfigDb.cc.

References factory_, and sistrip::mlConfigDb_.

Referenced by SiStripFedCablingBuilderFromDb::make(), partitions(), runs(), SiStripPartition::update(), CommissioningHistosUsingDb::uploadAnalyses(), usingDatabase(), and usingXmlFiles().

                                                                                 { 
  if ( factory_ ) { return factory_; }
  else { 
    if ( method_name != "" ) { 
      stringstream ss;
      ss << "[SiStripConfigDb::" << __func__ << "]"
         << " NULL pointer to DeviceFactory requested by" 
         << " method SiStripConfigDb::" << method_name << "()!";
      edm::LogWarning(mlConfigDb_) << ss.str();
    }
    return 0;
  }
}
string SiStripConfigDb::deviceType ( const enumDeviceType &  device_type) const [private]

Returns device identifier based on device type.

Definition at line 533 of file DeviceDescriptions.cc.

                                                                            {
  if      ( device_type == PLL )         { return "PLL"; }
  else if ( device_type == LASERDRIVER ) { return "LLD"; }
  else if ( device_type == DOH )         { return "DOH"; }
  else if ( device_type == APVMUX )      { return "MUX"; }
  else if ( device_type == APV25 )       { return "APV"; }
  else if ( device_type == DCU )         { return "DCU"; }
  else if ( device_type == GOH )         { return "GOH"; }
  else { return "UNKNOWN DEVICE!"; }
}
SiStripConfigDb::DcuDetIdsV::iterator SiStripConfigDb::findDcuDetId ( DcuDetIdsV::iterator  begin,
DcuDetIdsV::iterator  end,
uint32_t  dcu_id 
) [static, protected]

Utility method.

Definition at line 409 of file DcuDetIds.cc.

References begin, and end.

                                                                                        {
  DcuDetIdsV::iterator iter = begin;
  DcuDetIdsV::iterator jter = end;
  for ( ; iter != jter; ++iter  ) {
    if ( iter->second && iter->second->getDcuHardId() == dcu_id ) { return iter; }
  }
  return end;
}
SiStripConfigDb::DcuDetIdsV::const_iterator SiStripConfigDb::findDcuDetId ( DcuDetIdsV::const_iterator  begin,
DcuDetIdsV::const_iterator  end,
uint32_t  dcu_id 
) [static, protected]

Utility method.

Definition at line 396 of file DcuDetIds.cc.

References begin, and end.

Referenced by FastFedCablingHistosUsingDb::addDcuDetIds(), SiStripFedCablingBuilderFromDb::assignDcuAndDetIds(), CommissioningHistosUsingDb::buildDetInfo(), SiStripPsuDetIdMap::BuildMap(), and FastFedCablingHistosUsingDb::connections().

                                                                                              {
  DcuDetIdsV::const_iterator iter = begin;
  DcuDetIdsV::const_iterator jter = end;
  for ( ; iter != jter; ++iter  ) {
    if ( iter->second && iter->second->getDcuHardId() == dcu_id ) { return iter; }
  }
  return end;
}
SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescriptions ( AnalysisType  analysis_type,
std::string  partition = "" 
) [protected]

Returns local cache (just for given partition if specified).

T_UNKNOWN, T_ANALYSIS_FASTFEDCABLING, T_ANALYSIS_TIMING, T_ANALYSIS_OPTOSCAN, T_ANALYSIS_VPSPSCAN, T_ANALYSIS_PEDESTAL, T_ANALYSIS_APVLATENCY, T_ANALYSIS_FINEDELAY, T_ANALYSIS_CALIBRATION.

Definition at line 23 of file AnalysisDescriptions.cc.

References begin, SiStripPartition::defaultPartitionName_, end, LogTrace, sistrip::mlConfigDb_, and runTheMatrix::np.

Referenced by SiStripCondObjBuilderFromDb::retrieveTimingAnalysisDescriptions(), and SiStripCondObjBuilderFromDb::setValuesApvTiming().

                                                                                                           {
  
  // Check
  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
       (  dbParams_.usingDbCache() && !databaseCache(__func__) ) ) { 
    return analyses_.emptyRange();
  }
  
  try { 

    if ( !dbParams_.usingDbCache() ) { 
      
      SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
      SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
      for ( ; iter != jter; ++iter ) {
        
        if ( partition == "" || partition == iter->second.partitionName() ) {
          
          if ( iter->second.partitionName() == SiStripPartition::defaultPartitionName_ ) { continue; }

          AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() );
          if ( range == analyses_.emptyRange() ) {
    
            AnalysisDescriptionsV tmp1;
            if ( analysis_type == AnalysisDescription::T_ANALYSIS_FASTFEDCABLING ) {
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.fastCablingVersion().first,
                                                                  iter->second.fastCablingVersion().second,
                                                                  analysis_type );
            } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_TIMING ) {
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.apvTimingVersion().first,
                                                                  iter->second.apvTimingVersion().second,
                                                                  analysis_type );
            } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_OPTOSCAN ) {
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.optoScanVersion().first,
                                                                  iter->second.optoScanVersion().second,
                                                                  analysis_type );
            } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_VPSPSCAN ) {
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.vpspScanVersion().first,
                                                                  iter->second.vpspScanVersion().second,
                                                                  analysis_type );
            } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_CALIBRATION ) {
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.apvCalibVersion().first,
                                                                  iter->second.apvCalibVersion().second,
                                                                  analysis_type );
            } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDESTALS ) { 
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.pedestalsVersion().first,
                                                                  iter->second.pedestalsVersion().second,
                                                                  analysis_type );
            } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY ) {
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.apvLatencyVersion().first,
                                                                  iter->second.apvLatencyVersion().second,
                                                                  analysis_type );
            } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_FINEDELAY ) {
              tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), 
                                                                  iter->second.fineDelayVersion().first,
                                                                  iter->second.fineDelayVersion().second,
                                                                  analysis_type );
            } else {
              std::stringstream ss;
              ss << "[SiStripConfigDb::" << __func__ << "]"
                 << " Unexpected analysis type \"" 
                 << analysisType( analysis_type ) 
                 << "\"! Aborting download...";
              edm::LogWarning(mlConfigDb_) << ss.str();
              return analyses_.emptyRange();
            }
            
            // Make local copy 
            AnalysisDescriptionsV tmp2;
            CommissioningAnalysisFactory::vectorCopy( tmp1, tmp2 );
            
            // Add to cache
            analyses_.loadNext( iter->second.partitionName(), tmp2 );
            
            // Some debug
            AnalysisDescriptionsRange anals = analyses_.find( iter->second.partitionName() );
            std::stringstream ss;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Downloaded " << anals.size() 
               << " analysis descriptions of type \""
               << analysisType( analysis_type )
               << "\" to local cache for partition \""
               << iter->second.partitionName() << "\"" << std::endl;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Cache holds analysis descriptions for " 
               << analyses_.size() << " partitions.";
            LogTrace(mlConfigDb_) << ss.str();

          }
        }
      }

    } else { // Use database cache
      std::stringstream ss;
      ss << "[SiStripConfigDb::" << __func__ << "]"
         << " No database cache for analysis objects!";
      edm::LogWarning(mlConfigDb_) << ss.str();
    }
    
  } catch (...) { handleException( __func__ ); }
  
  // Create range object
  uint16_t np = 0;
  uint16_t nc = 0;
  AnalysisDescriptionsRange anals = analyses_.emptyRange();
  if ( partition != "" ) { 
    anals = analyses_.find( partition );
    np = 1;
    nc = anals.size();
  } else { 
    if ( !analyses_.empty() ) {
      anals = AnalysisDescriptionsRange( analyses_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                         analyses_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { anals = analyses_.emptyRange(); }
    np = analyses_.size();
    nc = anals.size();
  }
  
  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Found " << nc << " analysis descriptions";
  if ( !dbParams_.usingDbCache() )  { ss << " in " << np << " database partition(s)"; } 
  else { ss << " from shared memory name '" << dbParams_.sharedMemory() << "'"; } 
  if ( analyses_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
  else { LogTrace(mlConfigDb_) << ss.str(); }
  
  return anals;
  
}
SiStripConfigDb::DcuDetIdsRange SiStripConfigDb::getDcuDetIds ( std::string  partition = "") [protected]

Returns local cache (just for given partition if specified).

Definition at line 11 of file DcuDetIds.cc.

References begin, clone(), SiStripPartition::defaultPartitionName_, end, LogTrace, sistrip::mlConfigDb_, runTheMatrix::np, and align_tpl::src.

Referenced by FastFedCablingHistosUsingDb::addDcuDetIds(), CommissioningHistosUsingDb::buildDetInfo(), SiStripFedCablingBuilderFromDb::buildFecCabling(), SiStripFedCablingBuilderFromDb::buildFecCablingFromDetIds(), SiStripFedCablingBuilderFromDb::buildFecCablingFromDevices(), SiStripFedCablingBuilderFromDb::buildFecCablingFromFedConnections(), and FastFedCablingHistosUsingDb::uploadConfigurations().

                                                                                 {

  // Check
  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
       (  dbParams_.usingDbCache() && !databaseCache(__func__) ) ) { 
    return dcuDetIds_.emptyRange(); 
  }
  
  try {

    if ( !dbParams_.usingDbCache() ) { 

      SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
      SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
      for ( ; iter != jter; ++iter ) {
        
        if ( partition == "" || partition == iter->second.partitionName() ) {
          
          if ( iter->second.partitionName() == SiStripPartition::defaultPartitionName_ ) { continue; }

          DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
          if ( range == dcuDetIds_.emptyRange() ) {
            
            deviceFactory(__func__)->addDetIdPartition( iter->second.partitionName(),
                                                        iter->second.dcuVersion().first, 
                                                        iter->second.dcuVersion().second );
            
            // Retrieve DCU-DetId map
            DcuDetIdMap src = deviceFactory(__func__)->getInfos(); 
            
            // Make local copy 
            DcuDetIdsV dst;
            clone( src, dst );
            
            // Add to cache
            dcuDetIds_.loadNext( iter->second.partitionName(), dst );
            
          }

        }

      }
      
    } else { // Using database cache
      
      // Retrieve DCU-DetId map
      DcuDetIdMap* src = databaseCache(__func__)->getInfos(); 

      if ( src ) { 
        
        // Make local copy 
        DcuDetIdsV dst;
        clone( *src, dst ); 
        
        // Add to cache
        dcuDetIds_.loadNext( SiStripPartition::defaultPartitionName_, dst );
        
      } else {
        edm::LogWarning(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " NULL pointer to Dcu-DetId map!";
      }
      
    }
    
  } catch (... ) { handleException( __func__ ); }

  // Create range object
  uint16_t np = 0;
  uint16_t nc = 0;
  DcuDetIdsRange range;
  if ( partition != "" ) { 
    range = dcuDetIds_.find( partition );
    np = 1;
    nc = range.size();
  } else { 
    if ( !dcuDetIds_.empty() ) {
      range = DcuDetIdsRange( dcuDetIds_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                              dcuDetIds_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { range = dcuDetIds_.emptyRange(); }
    np = dcuDetIds_.size();
    nc = range.size();
  }
  
  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Found " << nc << " entries in DCU-DetId map";
  if ( !dbParams_.usingDb() ) { ss << " in " << dbParams_.inputDcuInfoXmlFiles().size() << " 'module.xml' file(s)"; }
  else { if ( !dbParams_.usingDbCache() )  { ss << " in " << np << " database partition(s)"; } 
  else { ss << " from shared memory name '" << dbParams_.sharedMemory() << "'"; } }
  if ( dcuDetIds_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
  else { LogTrace(mlConfigDb_) << ss.str(); }

  return range;
}
SiStripConfigDb::DeviceDescriptionsRange SiStripConfigDb::getDeviceDescriptions ( DeviceType  device_type,
std::string  partition = "" 
) [protected]

Returns (pair of iterators to) descriptions of given type. (APV25, APVMUX, DCU, LASERDRIVER, PLL, DOH).

Definition at line 127 of file DeviceDescriptions.cc.

References getDeviceDescriptions(), LogTrace, sistrip::mlConfigDb_, and tmp.

                                                                                                       {
  
  typedDevices_.clear();
  apvDevices_.clear();
  muxDevices_.clear();
  dcuDevices_.clear();
  lldDevices_.clear();
  pllDevices_.clear();
  dohDevices_.clear();
  
  DeviceDescriptionsRange tmp( typedDevices_.end(), typedDevices_.end() );
  
  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
       (  dbParams_.usingDbCache() && !databaseCache(__func__) ) ) { 
    return tmp;
  }
  
  try { 
    DeviceDescriptionsRange devs = SiStripConfigDb::getDeviceDescriptions( partition );
    if ( !devs.empty() ) {
      DeviceDescriptionsV tmp( devs.begin(), devs.end() );
      typedDevices_ = FecFactory::getDeviceFromDeviceVector( tmp, device_type );
    }
  } catch (...) { handleException( __func__ ); }
  
  if ( device_type == APV25 ) { 
    apvDevices_.swap( typedDevices_ ); 
    tmp = DeviceDescriptionsRange( apvDevices_.begin(), apvDevices_.end() );
  } else if ( device_type == APVMUX ) { 
    muxDevices_.swap( typedDevices_ );  
    tmp = DeviceDescriptionsRange( muxDevices_.begin(), muxDevices_.end() );
  } else if ( device_type == DCU ) { 
    dcuDevices_.swap( typedDevices_ ); 
    tmp = DeviceDescriptionsRange( dcuDevices_.begin(), dcuDevices_.end() );
  } else if ( device_type == LASERDRIVER ) { 
    lldDevices_.swap( typedDevices_ ); 
    tmp = DeviceDescriptionsRange( lldDevices_.begin(), lldDevices_.end() );
  } else if ( device_type == PLL ) { 
    pllDevices_.swap( typedDevices_ ); 
    tmp = DeviceDescriptionsRange( pllDevices_.begin(), pllDevices_.end() );
  } else if ( device_type == DOH ) { 
    dohDevices_.swap( typedDevices_ ); 
    tmp = DeviceDescriptionsRange( dohDevices_.begin(), dohDevices_.end() );
  } else {
    tmp = DeviceDescriptionsRange( typedDevices_.begin(), typedDevices_.end() );
  }

//   stringstream sss; 
//   sss << " Number of devices:" 
//       << " TYP: " << typedDevices_.size()
//       << " APV: " << apvDevices_.size()
//       << " MUX: " << muxDevices_.size()
//       << " DCU: " << dcuDevices_.size()
//       << " LLD: " << lldDevices_.size()
//       << " PLL: " << pllDevices_.size()
//       << " DOH: " << dohDevices_.size()
//       << " tmp: " << tmp.size();
//   LogTrace(mlConfigDb_) << sss.str();

  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Extracted " << tmp.size() 
     << " device descriptions (for devices of type " 
     << deviceType( device_type ) << ")";
  LogTrace(mlConfigDb_) << ss.str();
  
  return tmp;
  
}
SiStripConfigDb::DeviceDescriptionsRange SiStripConfigDb::getDeviceDescriptions ( std::string  partition = "") [protected]

Returns local cache (just for given partition if specified).

Definition at line 12 of file DeviceDescriptions.cc.

References begin, SiStripPartition::defaultPartitionName_, end, funct::false, LogTrace, sistrip::mlConfigDb_, and runTheMatrix::np.

Referenced by FastFedCablingHistosUsingDb::addDcuDetIds(), CommissioningHistosUsingDb::buildDetInfo(), SiStripFedCablingBuilderFromDb::buildFecCabling(), SiStripFedCablingBuilderFromDb::buildFecCablingFromDevices(), CalibrationHistosUsingDb::CalibrationHistosUsingDb(), FastFedCablingHistosUsingDb::connections(), getDeviceDescriptions(), SiStripCondObjBuilderFromDb::setValuesApvLatency(), ApvTimingHistosUsingDb::uploadConfigurations(), LatencyHistosUsingDb::uploadConfigurations(), CalibrationHistosUsingDb::uploadConfigurations(), OptoScanHistosUsingDb::uploadConfigurations(), FineDelayHistosUsingDb::uploadConfigurations(), FastFedCablingHistosUsingDb::uploadConfigurations(), and VpspScanHistosUsingDb::uploadConfigurations().

                                                                                                   {

  // Check
  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
       (  dbParams_.usingDbCache() && !databaseCache(__func__) ) ) { 
    return devices_.emptyRange(); 
  }
  
  try { 

    if ( !dbParams_.usingDbCache() ) { 

      SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
      SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
      for ( ; iter != jter; ++iter ) {
        
        if ( partition == "" || partition == iter->second.partitionName() ) {
          
          if ( iter->second.partitionName() == SiStripPartition::defaultPartitionName_ ) { continue; }

          DeviceDescriptionsRange range = devices_.find( iter->second.partitionName() );
          if ( range == devices_.emptyRange() ) {
            
            // Retrieve conections
            DeviceDescriptionsV tmp1;
            deviceFactory(__func__)->getFecDeviceDescriptions( iter->second.partitionName(), 
                                                               tmp1,
                                                               iter->second.fecVersion().first,
                                                               iter->second.fecVersion().second,
#ifdef USING_DATABASE_MASKING
                                                               iter->second.maskVersion().first,
                                                               iter->second.maskVersion().second,
#endif
                                                               false ); //@@ do not get DISABLED devices
            
            // Make local copy 
            DeviceDescriptionsV tmp2;
            FecFactory::vectorCopyI( tmp2, tmp1, true );

            // Add to cache
            devices_.loadNext( iter->second.partitionName(), tmp2 );

            // Some debug
            DeviceDescriptionsRange range = devices_.find( iter->second.partitionName() );
            std::stringstream ss;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Downloaded " << range.size() 
               << " device descriptions to local cache for partition \""
               << iter->second.partitionName() << "\"" << std::endl;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Cache holds device descriptions for " 
               << devices_.size() << " partitions.";
            LogTrace(mlConfigDb_) << ss.str();

          }
          
        }
        
      }
      
    } else { // Using database cache

      DeviceDescriptionsV* tmp1 = databaseCache(__func__)->getDevices();

      if ( tmp1 ) { 
        
        // Make local copy 
        DeviceDescriptionsV tmp2;
        FecFactory::vectorCopyI( tmp2, *tmp1, true );
        
        // Add to cache
        devices_.loadNext( SiStripPartition::defaultPartitionName_, tmp2 );

      } else {
        edm::LogWarning(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " NULL pointer to DeviceDescriptions vector!";
      }
      
    }
    
  } catch (...) { handleException( __func__ ); }
  
  // Create range object
  uint16_t np = 0;
  uint16_t nc = 0;
  DeviceDescriptionsRange devs;
  if ( partition != "" ) { 
    devs = devices_.find( partition );
    np = 1;
    nc = devs.size();
  } else { 
    if ( !devices_.empty() ) {
      devs = DeviceDescriptionsRange( devices_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                      devices_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { devs = devices_.emptyRange(); }
    np = devices_.size();
    nc = devs.size();
  }
  
  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Found " << nc << " device descriptions";
  if ( !dbParams_.usingDb() ) { ss << " in " << dbParams_.inputFecXmlFiles().size() << " 'fec.xml' file(s)"; }
  else { if ( !dbParams_.usingDbCache() )  { ss << " in " << np << " database partition(s)"; } 
  else { ss << " from shared memory name '" << dbParams_.sharedMemory() << "'"; } }
  if ( devices_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
  else { LogTrace(mlConfigDb_) << ss.str(); }
  
  return devs;

}
SiStripConfigDb::FedConnectionsRange SiStripConfigDb::getFedConnections ( std::string  partition = "") [protected]

Returns local cache (just for given partition if specified).

Definition at line 12 of file FedConnections.cc.

References begin, SiStripPartition::defaultPartitionName_, end, funct::false, LogTrace, sistrip::mlConfigDb_, and runTheMatrix::np.

Referenced by SiStripFedCablingBuilderFromDb::buildFecCabling(), and SiStripFedCablingBuilderFromDb::buildFecCablingFromFedConnections().

                                                                                           {

  // Check
  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
       (  dbParams_.usingDbCache() && !databaseCache(__func__) ) ) { 
    return connections_.emptyRange();
  }
  
  try {
    
    if ( !dbParams_.usingDbCache() ) { 
      
      SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
      SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
      for ( ; iter != jter; ++iter ) {
        
        if ( partition == "" || partition == iter->second.partitionName() ) {

          if ( iter->second.partitionName() == SiStripPartition::defaultPartitionName_ ) { continue; }
          
          FedConnectionsRange range = connections_.find( iter->second.partitionName() );
          if ( range == connections_.emptyRange() ) {

            FedConnectionsV tmp2;
            
            // Retrieve connections
            FedConnectionsV tmp1;
            deviceFactory(__func__)->getConnectionDescriptions( iter->second.partitionName(), 
                                                                tmp1,
                                                                iter->second.cabVersion().first,
                                                                iter->second.cabVersion().second,
#ifdef USING_DATABASE_MASKING
                                                                iter->second.maskVersion().first,
                                                                iter->second.maskVersion().second,
#endif
                                                                false ); //@@ do not get DISABLED connections
            
            // Make local copy 
            ConnectionFactory::vectorCopyI( tmp2, tmp1, true );
            
            // Add to cache
            connections_.loadNext( iter->second.partitionName(), tmp2 );
            
            // Some debug
            FedConnectionsRange conns = connections_.find( iter->second.partitionName() );
            std::stringstream ss;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Downloaded " << conns.size() 
               << " FED connections to local cache for partition \""
               << iter->second.partitionName() << "\"" << std::endl;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Cache holds FED connections for " 
               << connections_.size() << " partitions.";
            LogTrace(mlConfigDb_) << ss.str();
            
          }
          
        }

      }

    } else { // Use database cache
        
      FedConnectionsV* tmp1 = databaseCache(__func__)->getConnections();
      
      if ( tmp1 ) { 
        
        // Make local copy 
        FedConnectionsV tmp2;
        ConnectionFactory::vectorCopyI( tmp2, *tmp1, true );
        
        // Add to cache
        connections_.loadNext( SiStripPartition::defaultPartitionName_, tmp2 );
        
      } else {
        edm::LogWarning(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " NULL pointer to FedConnections vector!";
      }
      
    }
    
  } catch (...) { handleException( __func__ ); }
  
  // Create range object
  uint16_t np = 0;
  uint16_t nc = 0;
  FedConnectionsRange conns;
  if ( partition != "" ) { 
    conns = connections_.find( partition );
    np = 1;
    nc = conns.size();
  } else { 
    if ( !connections_.empty() ) {
      conns = FedConnectionsRange( connections_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                   connections_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { conns = connections_.emptyRange(); }
    np = connections_.size();
    nc = conns.size();
  }
  
  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Found " << nc << " FED connections";
  if ( !dbParams_.usingDb() ) { ss << " in " << dbParams_.inputModuleXmlFiles().size() << " 'module.xml' file(s)"; }
  else { if ( !dbParams_.usingDbCache() )  { ss << " in " << np << " database partition(s)"; } 
  else { ss << " from shared memory name '" << dbParams_.sharedMemory() << "'"; } }
  if ( connections_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
  else { LogTrace(mlConfigDb_) << ss.str(); }

  return conns;
  
}
SiStripConfigDb::FedDescriptionsRange SiStripConfigDb::getFedDescriptions ( std::string  partition = "") [protected]

Returns local cache (just for given partition if specified).

Definition at line 13 of file FedDescriptions.cc.

References begin, SiStripPartition::defaultPartitionName_, end, LogTrace, sistrip::mlConfigDb_, and runTheMatrix::np.

Referenced by SiStripCondObjBuilderFromDb::retrieveFedDescriptions(), SiStripCondObjBuilderFromDb::setValuesCabling(), ApvTimingHistosUsingDb::uploadConfigurations(), LatencyHistosUsingDb::uploadConfigurations(), FineDelayHistosUsingDb::uploadConfigurations(), PedestalsHistosUsingDb::uploadConfigurations(), PedsFullNoiseHistosUsingDb::uploadConfigurations(), PedsOnlyHistosUsingDb::uploadConfigurations(), FastFedCablingHistosUsingDb::uploadConfigurations(), and NoiseHistosUsingDb::uploadConfigurations().

                                                                                             {

  // Check
  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
       (  dbParams_.usingDbCache() && !databaseCache(__func__) ) ) { 
    return feds_.emptyRange(); 
  }

  try {

    if ( !dbParams_.usingDbCache() ) { 

      SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
      SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
      for ( ; iter != jter; ++iter ) {
        
        if ( partition == "" || partition == iter->second.partitionName() ) {

          if ( iter->second.partitionName() == SiStripPartition::defaultPartitionName_ ) { continue; }

          FedDescriptionsRange range = feds_.find( iter->second.partitionName() );
          if ( range == feds_.emptyRange() ) {

            // Extract versions
            deviceFactory(__func__)->setUsingStrips( usingStrips_ );
            int16_t major = iter->second.fedVersion().first; 
            int16_t minor = iter->second.fedVersion().second; 
            if ( iter->second.fedVersion().first == 0 && 
                 iter->second.fedVersion().second == 0 ) {
              major = -1; //@@ "current state" for fed factory!
              minor = -1; //@@ "current state" for fed factory!
            }

            // Retrive FED descriptions
            FedDescriptionsV tmp1;
            tmp1 = *( deviceFactory(__func__)->getFed9UDescriptions( iter->second.partitionName(), 
                                                                     major, 
                                                                     minor ) );
            
            // Make local copy 
            FedDescriptionsV tmp2;
            Fed9U::Fed9UDeviceFactory::vectorCopy( tmp2, tmp1 );
            
            // Add to cache
            feds_.loadNext( iter->second.partitionName(), tmp2 );

            // Some debug
            FedDescriptionsRange feds = feds_.find( iter->second.partitionName() );
            std::stringstream ss;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Downloaded " << feds.size() 
               << " FED descriptions to local cache for partition \""
               << iter->second.partitionName() << "\"" << std::endl;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Cache holds FED descriptions for " 
               << feds_.size() << " partitions.";
            LogTrace(mlConfigDb_) << ss.str();
            
          }

        }

      }
            
    } else { // Using database cache

      FedDescriptionsV* tmp1 = databaseCache(__func__)->getFed9UDescriptions();
      
      if ( tmp1 ) { 
        
        // Make local copy 
        FedDescriptionsV tmp2;
        Fed9U::Fed9UDeviceFactory::vectorCopy( tmp2, *tmp1 );
        
        // Add to cache
        feds_.loadNext( SiStripPartition::defaultPartitionName_, tmp2 );
        
      } else {
        edm::LogWarning(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " NULL pointer to FED descriptions vector!";
      }

    }

  } catch (... ) { handleException( __func__ ); }
  
  // Create range object
  uint16_t np = 0;
  uint16_t nc = 0;
  FedDescriptionsRange feds;
  if ( partition != "" ) { 
    feds = feds_.find( partition );
    np = 1;
    nc = feds.size();
  } else {  
    if ( !feds_.empty() ) {
      feds = FedDescriptionsRange( feds_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
                                   feds_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
    } else { feds = feds_.emptyRange(); }
    np = feds_.size();
    nc = feds.size();
  }
  
  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Found " << nc << " FED descriptions";
  if ( !dbParams_.usingDb() ) { ss << " in " << dbParams_.inputFedXmlFiles().size() << " 'fed.xml' file(s)"; }
  else { if ( !dbParams_.usingDbCache() )  { ss << " in " << np << " database partition(s)"; } 
  else { ss << " from shared memory name '" << dbParams_.sharedMemory() << "'"; } }
  if ( feds_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
  else { LogTrace(mlConfigDb_) << ss.str(); }
  
  return feds;
  
}
SiStripConfigDb::FedIdsRange SiStripConfigDb::getFedIds ( std::string  partition = "") [protected]

Extracts FED ids from FED descriptions.

Definition at line 430 of file FedDescriptions.cc.

References sistrip::mlCabling_, and sistrip::mlConfigDb_.

Referenced by SiStripFedCablingBuilderFromDb::buildFecCablingFromDevices().

                                                                           {
  
  fedIds_.clear();
  
  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
       (  dbParams_.usingDbCache() && !databaseCache(__func__) ) ) { 
    return FedIdsRange( fedIds_.end(), fedIds_.end() );
  }
  
  try { 

    // Inhibit download of strip info
    bool using_strips = usingStrips_;
    if ( factory_ ) { factory_->setUsingStrips( false ); }
    FedDescriptionsRange feds = getFedDescriptions( partition );
    if ( factory_ ) { factory_->setUsingStrips( using_strips ); }
    
    if ( !feds.empty() ) {
      FedDescriptionsV::const_iterator ifed = feds.begin();
      FedDescriptionsV::const_iterator jfed = feds.end();
      for ( ; ifed != jfed; ++ifed ) { 
        if ( *ifed ) { fedIds_.push_back( (*ifed)->getFedId() ); }
        else {
          edm::LogError(mlCabling_)
            << "[SiStripConfigDb::" << __func__ << "]"
            << " NULL pointer to FedDescription!";
          continue;
        }
      }
    }
    
  } catch (...) { handleException( __func__ ); }
  
  if ( fedIds_.empty() ) {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " No FED ids found!"; 
  }
  
  return FedIdsRange( fedIds_.begin(), fedIds_.end() );

}
void SiStripConfigDb::handleException ( const std::string &  method_name,
const std::string &  extra_info = "" 
) const [private]

Handles exceptions thrown by software.

Definition at line 740 of file SiStripConfigDb.cc.

References exception, sistrip::mlConfigDb_, and cms::Exception::what().

Referenced by closeDbConnection(), SiStripPartition::update(), usingDatabase(), usingDatabaseCache(), and usingXmlFiles().

                                                                           { 

  std::stringstream ss;
  try {
    throw; // rethrow caught exception to be dealt with below
  } 

  catch ( const cms::Exception& e ) { 
    ss << " Caught cms::Exception in method "
       << method_name << " with message: " << std::endl 
       << e.what();
    if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
    //throw e; // rethrow cms::Exception
  }
  
  catch ( const oracle::occi::SQLException& e ) { 
    ss << " Caught oracle::occi::SQLException in method "
       << method_name << " with message: " << std::endl 
       << e.getMessage();
    if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
    //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
  }

  catch ( const FecExceptionHandler& e ) {
    ss << " Caught FecExceptionHandler exception in method "
       << method_name << " with message: " << std::endl 
       << const_cast<FecExceptionHandler&>(e).what();
    if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
    //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
  }

//   catch ( const Fed9UDeviceFactoryException& e ) {
//     ss << " Caught Fed9UDeviceFactoryException exception in method "
//        << method_name << " with message: " << std::endl 
//        << e.what();
//     if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
//     //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
//   }

  catch ( const ICUtils::ICException& e ) {
    ss << " Caught ICUtils::ICException in method "
       << method_name << " with message: " << std::endl 
       << e.what();
    if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
    //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
  }

  catch ( const exception& e ) {
    ss << " Caught std::exception in method "
       << method_name << " with message: " << std::endl 
       << e.what();
    if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
    //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
  }

  catch (...) {
    ss << " Caught unknown exception in method "
       << method_name << " (No message) " << std::endl;
    if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
    //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
  }
  
  // Message
  edm::LogError(mlConfigDb_) << ss.str();
  
}
void SiStripConfigDb::openDbConnection ( ) [protected]

Establishes connection to DeviceFactory API.

Definition at line 103 of file SiStripConfigDb.cc.

References clearLocalCache(), dbParams_, LogTrace, sistrip::mlConfigDb_, openConnection_, usingDatabase(), usingDatabaseCache(), SiStripDbParams::usingDb(), SiStripDbParams::usingDbCache(), and usingXmlFiles().

Referenced by SiStripConfigDb().

                                       {

  LogTrace(mlConfigDb_) 
    << "[SiStripConfigDb::" << __func__ << "]"
    << " Opening connection to database...";
  
  // Check if connection already exists
  if ( openConnection_ ) {
    edm::LogWarning(mlConfigDb_) 
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Connection already open!";
    return;
  }
  openConnection_ = true;

  // Establish database connection
  if ( dbParams_.usingDb() ) { 
    if ( dbParams_.usingDbCache() ) { usingDatabaseCache(); }
    else { usingDatabase(); }
  } else { usingXmlFiles(); }

  std::stringstream ss;
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Database connection parameters: "
     << std::endl << dbParams_;
  edm::LogVerbatim(mlConfigDb_) << ss.str();

  // Clear local caches
  clearLocalCache();

  LogTrace(mlConfigDb_) 
    << "[SiStripConfigDb::" << __func__ << "]"
    << " Opened connection to database!";
  
}
void SiStripConfigDb::partitions ( std::list< std::string > &  partitions) const [protected]

Retrieves all partitions names from database.

Definition at line 1012 of file SiStripConfigDb.cc.

References deviceFactory(), and sistrip::mlConfigDb_.

Referenced by usingDatabase().

                                                                       {

  partitions.clear();

  // Check DF pointer
  DeviceFactory* const df = deviceFactory(__func__);
  if ( !df ) {
    edm::LogError(mlConfigDb_)
      << "[SiStripPartition::" << __func__ << "]"
      << " NULL pointer to DeviceFactory object!";
    return;
  }

  partitions = df->getAllPartitionNames();
  
}
void SiStripConfigDb::printAnalysisDescriptions ( std::string  partition = "") [protected]

Prints local cache (just for given partition if specified).

Definition at line 395 of file AnalysisDescriptions.cc.

References begin, SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, runTheMatrix::data, end, SiStripFecKey::fecCrate(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripFecKey::fecRing(), SiStripConfigDb::DeviceAddress::fecRing_, SiStripFecKey::fecSlot(), SiStripConfigDb::DeviceAddress::fecSlot_, spr::find(), SiStripConfigDb::DeviceAddress::i2cAddr_, combine::key, SiStripKey::key(), SiStripConfigDb::DeviceAddress::lldChan_, LogTrace, sistrip::mlConfigDb_, python::multivaluedict::sort(), cond::rpcobtemp::temp, and tmp.

                                                                     {
  
  std::stringstream ss;
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Contents of AnalysisDescriptions container:" << std::endl;
  ss << " Number of partitions: " << analyses_.size() << std::endl;
  
  // Loop through partitions
  uint16_t cntr = 0;
  AnalysisDescriptions::const_iterator ianal = analyses_.begin();
  AnalysisDescriptions::const_iterator janal = analyses_.end();
  for ( ; ianal != janal; ++ianal ) {

    cntr++;
    if ( partition == "" || partition == ianal->first ) {
      
      ss << "  Partition number : " << cntr << " (out of " << analyses_.size() << ")" << std::endl;
      ss << "  Partition name   : \"" << ianal->first << "\"" << std::endl;
      ss << "  Num of analyses  : " << ianal->second.size() << std::endl;
      
      // Extract FEC crate, slot, etc
      std::map< uint32_t, vector<uint32_t> > analyses;
      AnalysisDescriptionsV::const_iterator iter = ianal->second.begin();
      AnalysisDescriptionsV::const_iterator jter = ianal->second.end();
      for ( ; iter != jter; ++iter ) { 
        if ( *iter ) { 
          DeviceAddress addr = deviceAddress( **iter );
          uint32_t key  = SiStripFecKey( addr.fecCrate_, 
                                         addr.fecSlot_, 
                                         addr.fecRing_, 
                                         0, 
                                         0, 
                                         0, 
                                         0 ).key();
          uint32_t data = SiStripFecKey( addr.fecCrate_, 
                                         addr.fecSlot_, 
                                         addr.fecRing_, 
                                         addr.ccuAddr_, 
                                         addr.ccuChan_, 
                                         addr.lldChan_, 
                                         addr.i2cAddr_ ).key();
          if ( find( analyses[key].begin(), analyses[key].end(), data ) == analyses[key].end() ) { 
            analyses[key].push_back( data );
          }
        }
      }
      
      // Sort contents
      std::map< uint32_t, std::vector<uint32_t> > tmp;
      std::map< uint32_t, std::vector<uint32_t> >::const_iterator ii = analyses.begin();
      std::map< uint32_t, std::vector<uint32_t> >::const_iterator jj = analyses.end();
      for ( ; ii != jj; ++ii ) {
        std::vector<uint32_t> temp = ii->second;
        std::sort( temp.begin(), temp.end() );
        std::vector<uint32_t>::const_iterator iii = temp.begin();
        std::vector<uint32_t>::const_iterator jjj = temp.end();
        for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
      }
      analyses.clear();
      analyses = tmp;
      
      // Print FEC crate, slot, etc...
      std::map< uint32_t, std::vector<uint32_t> >::const_iterator ianal = analyses.begin();
      std::map< uint32_t, std::vector<uint32_t> >::const_iterator janal = analyses.end();
      for ( ; ianal != janal; ++ianal ) {
        SiStripFecKey key(ianal->first);
        ss << "  Found " << std::setw(3) << ianal->second.size()
           << " analyses for FEC crate/slot/ring " 
           << key.fecCrate() << "/"
           << key.fecSlot() << "/"
           << key.fecRing();
        //<< " (ccu/module/lld/i2c): ";
        //      if ( !ianal->second.empty() ) { 
        //        uint16_t first = ianal->second.front();
        //        uint16_t last = ianal->second.front();
        //        std::vector<uint32_t>::const_iterator chan = ianal->second.begin();
        //        for ( ; chan != ianal->second.end(); chan++ ) { 
        //          if ( chan != ianal->second.begin() ) {
        //            if ( *chan != last+1 ) { 
        //              ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
        //              if ( chan != ianal->second.end() ) { first = *(chan+1); }
        //            } 
        //          }
        //          last = *chan;
        //        }
        //        if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
        ss << std::endl;
      }

    }
    
  }
  
  LogTrace(mlConfigDb_) << ss.str();

}
void SiStripConfigDb::printDcuDetIds ( std::string  partition = "") [protected]

Prints local cache (just for given partition if specified).

Definition at line 339 of file DcuDetIds.cc.

References LogTrace, and sistrip::mlConfigDb_.

                                                          {

  std::stringstream ss;
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Contents of DcuDetIds container:" << std::endl;
  ss << " Number of partitions: " << dcuDetIds_.size() << std::endl;

  // Loop through partitions
  uint16_t cntr = 0;
  DcuDetIds::const_iterator idcu = dcuDetIds_.begin();
  DcuDetIds::const_iterator jdcu = dcuDetIds_.end();
  for ( ; idcu != jdcu; ++idcu ) {

    cntr++;
    if ( partition == "" || partition == idcu->first ) {
      
      ss << "  Partition number      : " << cntr << " (out of " << dcuDetIds_.size() << ")" << std::endl;
      ss << "  Partition name        : \"" << idcu->first << "\"" << std::endl;
      ss << "  Size of DCU-DetId map : " << idcu->second.size() << std::endl;
      
    }
    
  }
  
  LogTrace(mlConfigDb_) << ss.str();
  
}
void SiStripConfigDb::printDeviceDescriptions ( std::string  partition = "") [protected]

Prints local cache (just for given partition if specified).

Definition at line 411 of file DeviceDescriptions.cc.

References begin, SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, runTheMatrix::data, end, SiStripFecKey::fecCrate(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripFecKey::fecRing(), SiStripConfigDb::DeviceAddress::fecRing_, SiStripFecKey::fecSlot(), SiStripConfigDb::DeviceAddress::fecSlot_, spr::find(), SiStripConfigDb::DeviceAddress::i2cAddr_, combine::key, SiStripKey::key(), SiStripConfigDb::DeviceAddress::lldChan_, LogTrace, sistrip::mlConfigDb_, python::multivaluedict::sort(), cond::rpcobtemp::temp, and tmp.

                                                                   {

  std::stringstream ss;
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Contents of DeviceDescriptions container:" << std::endl;
  ss << " Number of partitions: " << devices_.size() << std::endl;

  // Loop through partitions
  uint16_t cntr = 0;
  DeviceDescriptions::const_iterator idev = devices_.begin();
  DeviceDescriptions::const_iterator jdev = devices_.end();
  for ( ; idev != jdev; ++idev ) {

    cntr++;
    if ( partition == "" || partition == idev->first ) {
      
      ss << "  Partition number : " << cntr << " (out of " << devices_.size() << ")" << std::endl;
      ss << "  Partition name   : \"" << idev->first << "\"" << std::endl;
      ss << "  Num of devices   : " << idev->second.size() << std::endl;
      
      // Extract FEC crate, slot, etc
      std::map< uint32_t, vector<std::string> > devices;
      DeviceDescriptionsV::const_iterator iter = idev->second.begin();
      DeviceDescriptionsV::const_iterator jter = idev->second.end();
      for ( ; iter != jter; ++iter ) { 
        if ( *iter ) { 
          DeviceAddress addr = deviceAddress( **iter );
          uint32_t key  = SiStripFecKey( addr.fecCrate_, 
                                         addr.fecSlot_, 
                                         addr.fecRing_, 
                                         0, 
                                         0, 
                                         0, 
                                         0 ).key();
          std::stringstream data;
          data << (*iter)->getDeviceType() 
               << "_"
               << SiStripFecKey( addr.fecCrate_, 
                                 addr.fecSlot_, 
                                 addr.fecRing_, 
                                 addr.ccuAddr_, 
                                 addr.ccuChan_, 
                                 addr.lldChan_, 
                                 addr.i2cAddr_ ).key();
          if ( find( devices[key].begin(), devices[key].end(), data.str() ) == devices[key].end() ) { 
            devices[key].push_back( data.str() );
          }
        }
      }
      
      // Sort contents
      std::map< uint32_t, std::vector<std::string> > tmp;
      std::map< uint32_t, std::vector<std::string> >::const_iterator ii = devices.begin();
      std::map< uint32_t, std::vector<std::string> >::const_iterator jj = devices.end();
      for ( ; ii != jj; ++ii ) {
        std::vector<std::string> temp = ii->second;
        std::sort( temp.begin(), temp.end() );
        std::vector<std::string>::const_iterator iii = temp.begin();
        std::vector<std::string>::const_iterator jjj = temp.end();
        for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
      }
      devices.clear();
      devices = tmp;
      
      // Print FEC crate, slot, etc...
      std::map< uint32_t, std::vector<std::string> >::const_iterator idev = devices.begin();
      std::map< uint32_t, std::vector<std::string> >::const_iterator jdev = devices.end();
      for ( ; idev != jdev; ++idev ) {
        SiStripFecKey key(idev->first);
        ss << "  Found " << std::setw(3) << idev->second.size()
           << " devices for FEC crate/slot/ring " 
           << key.fecCrate() << "/"
           << key.fecSlot() << "/"
           << key.fecRing();
        //<< " (ccu/module/lld/i2c): ";
        //      if ( !idev->second.empty() ) { 
        //        uint16_t first = idev->second.front();
        //        uint16_t last = idev->second.front();
        //        std::vector<std::string>::const_iterator chan = idev->second.begin();
        //        for ( ; chan != idev->second.end(); chan++ ) { 
        //          if ( chan != idev->second.begin() ) {
        //            if ( *chan != last+1 ) { 
        //              ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
        //              if ( chan != idev->second.end() ) { first = *(chan+1); }
        //            } 
        //          }
        //          last = *chan;
        //        }
        //        if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
        ss << std::endl;
      }

    }
    
  }
  
  LogTrace(mlConfigDb_) << ss.str();

}
void SiStripConfigDb::printFedConnections ( std::string  partition = "") [protected]

Prints local cache (just for given partition if specified).

Definition at line 344 of file FedConnections.cc.

References begin, end, spr::find(), first, prof2calltree::last, LogTrace, sistrip::mlConfigDb_, python::multivaluedict::sort(), cond::rpcobtemp::temp, and tmp.

                                                               {

  std::stringstream ss;
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Contents of FedConnections container:" << std::endl;
  ss << " Number of partitions: " << connections_.size() << std::endl;
  
  // Loop through partitions
  uint16_t cntr = 0;
  FedConnections::const_iterator iconn = connections_.begin();
  FedConnections::const_iterator jconn = connections_.end();
  for ( ; iconn != jconn; ++iconn ) {

    cntr++;
    if ( partition == "" || partition == iconn->first ) {
      
      ss << "  Partition number   : " << cntr << " (out of " << connections_.size() << ")" << std::endl;
      ss << "  Partition name     : \"" << iconn->first << "\"" << std::endl;
      ss << "  Num of connections : " << iconn->second.size() << std::endl;

      // Extract FED ids and channels
      std::map< uint16_t, vector<uint16_t> > feds;
      FedConnectionsV::const_iterator iter = iconn->second.begin();
      FedConnectionsV::const_iterator jter = iconn->second.end();
      for ( ; iter != jter; ++iter ) { 
        if ( *iter ) { 
          uint16_t fed_id = (*iter)->getFedId();
          uint16_t fed_ch = (*iter)->getFedChannel();
          if ( find( feds[fed_id].begin(), feds[fed_id].end(), fed_ch ) == feds[fed_id].end() ) { 
            feds[fed_id].push_back( fed_ch ); 
          }
        }
      }
      
      // Sort contents
      std::map< uint16_t, std::vector<uint16_t> > tmp;
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator ii = feds.begin();
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator jj = feds.end();
      for ( ; ii != jj; ++ii ) {
        std::vector<uint16_t> temp = ii->second;
        std::sort( temp.begin(), temp.end() );
        std::vector<uint16_t>::const_iterator iii = temp.begin();
        std::vector<uint16_t>::const_iterator jjj = temp.end();
        for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
      }
      feds.clear();
      feds = tmp;
      
      // Print FED ids and channels
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator ifed = feds.begin();
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator jfed = feds.end();
      for ( ; ifed != jfed; ++ifed ) {
        ss << "  Found " << std::setw(2) << ifed->second.size()
           << " channels for FED id " << std::setw(3) << ifed->first << " : ";
        if ( !ifed->second.empty() ) { 
          uint16_t first = ifed->second.front();
          uint16_t last = ifed->second.front();
          std::vector<uint16_t>::const_iterator ichan = ifed->second.begin();
          std::vector<uint16_t>::const_iterator jchan = ifed->second.end();
          for ( ; ichan != jchan; ++ichan ) { 
            if ( ichan != ifed->second.begin() ) {
              if ( *ichan != last+1 ) { 
                ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
                if ( ichan != ifed->second.end() ) { first = *(ichan+1); }
              } 
            }
            last = *ichan;
          }
          if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
          ss << std::endl;
        }
      }
      
    }
    
  }
  
  LogTrace(mlConfigDb_) << ss.str();

}
void SiStripConfigDb::printFedDescriptions ( std::string  partition = "") [protected]

Prints local cache (just for given partition if specified).

Definition at line 347 of file FedDescriptions.cc.

References begin, runTheMatrix::data, end, spr::find(), first, combine::key, prof2calltree::last, LogTrace, sistrip::mlConfigDb_, python::multivaluedict::sort(), cond::rpcobtemp::temp, and tmp.

                                                                {

  std::stringstream ss;
  ss << "[SiStripConfigDb::" << __func__ << "]"
     << " Contents of FedDescriptions container:" << std::endl;
  ss << " Number of partitions: " << feds_.size() << std::endl;

  // Loop through partitions
  uint16_t cntr = 0;
  FedDescriptions::const_iterator iconn = feds_.begin();
  FedDescriptions::const_iterator jconn = feds_.end();
  for ( ; iconn != jconn; ++iconn ) {

    cntr++;
    if ( partition == "" || partition == iconn->first ) {
      
      ss << "  Partition number : " << cntr << " (out of " << feds_.size() << ")" << std::endl;
      ss << "  Partition name   : \"" << iconn->first << "\"" << std::endl;
      ss << "  Num of FED ids   : " << iconn->second.size() << std::endl;

      // Extract FED crates and ids
      std::map< uint16_t, vector<uint16_t> > feds;
      FedDescriptionsV::const_iterator iter = iconn->second.begin();
      FedDescriptionsV::const_iterator jter = iconn->second.end();
      for ( ; iter != jter; ++iter ) { 
        if ( *iter ) { 
          uint16_t key = (*iter)->getCrateNumber();
          uint16_t data = (*iter)->getFedId();
          if ( find( feds[key].begin(), feds[key].end(), data ) == feds[key].end() ) { 
            feds[key].push_back( data ); 
          }
        }
      }
      
      // Sort contents
      std::map< uint16_t, std::vector<uint16_t> > tmp;
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator ii = feds.begin();
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator jj = feds.end();
      for ( ; ii != jj; ++ii ) {
        std::vector<uint16_t> temp = ii->second;
        std::sort( temp.begin(), temp.end() );
        std::vector<uint16_t>::const_iterator iii = temp.begin();
        std::vector<uint16_t>::const_iterator jjj = temp.end();
        for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
      }
      feds.clear();
      feds = tmp;
      
      // Print FED crates and ids
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator ifed = feds.begin();
      std::map< uint16_t, std::vector<uint16_t> >::const_iterator jfed = feds.end();
      for ( ; ifed != jfed; ++ifed ) {
        ss << "  Found " << std::setw(2) << ifed->second.size()
           << " FED ids for crate number " << std::setw(2) << ifed->first << " : ";
        if ( !ifed->second.empty() ) { 
          uint16_t first = ifed->second.front();
          uint16_t last = ifed->second.front();
          std::vector<uint16_t>::const_iterator icrate = ifed->second.begin();
          std::vector<uint16_t>::const_iterator jcrate = ifed->second.end();
          for ( ; icrate != jcrate; ++icrate ) { 
            if ( icrate != ifed->second.begin() ) {
              if ( *icrate != last+1 ) { 
                ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
                if ( icrate != ifed->second.end() ) { first = *(icrate+1); }
              } 
            }
            last = *icrate;
          }
          if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
          ss << std::endl;
        }
      }
      
    }
    
  }
  
  LogTrace(mlConfigDb_) << ss.str();

}
void SiStripConfigDb::runs ( const Runs in,
SiStripConfigDb::RunsByType out,
std::string  optional_partition = "" 
) const [protected]

Runs organsed by type, optionally for given partition.

Definition at line 890 of file SiStripConfigDb.cc.

References dbParams_, newFWLiteAna::found, sistrip::mlConfigDb_, SiStripDbParams::partition(), SiStripDbParams::partitions(), sistrip::UNDEFINED_RUN_TYPE, and sistrip::UNKNOWN_RUN_TYPE.

                                                                 {
  
  out.clear();
  
  // Check partition name (if not empty string)
  if ( !optional_partition.empty() ) {
    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partition( optional_partition );
    if ( iter == dbParams_.partitions().end() ) { 
      edm::LogWarning(mlConfigDb_)
        << "[SiStripPartition::" << __func__ << "]"
        << " Partition name not found!";
      return; 
    }
  }

  // Iterate through runs
  Runs::const_iterator ii = in.begin();
  Runs::const_iterator jj = in.end();
  for ( ; ii != jj; ++ii ) {
    // Check partition name
    if ( ii->partition_ == optional_partition || optional_partition == "" ) { 
      // Check run type
      if ( ii->type_ != sistrip::UNKNOWN_RUN_TYPE &&
           ii->type_ != sistrip::UNDEFINED_RUN_TYPE ) { 
        // Check run number
        if ( ii->number_ ) { 
          bool found = false;
          if ( out.find( ii->type_ ) != out.end() ) {
            Runs::const_iterator irun = out[ ii->type_ ].begin();
            Runs::const_iterator jrun = out[ ii->type_ ].end();
            while ( !found && irun != jrun ) {
              if ( irun->number_ == ii->number_ ) { found = true; }
              ++irun;
            }
          }
          // Check if run number already found
          if ( !found ) { 
            out[ ii->type_ ].push_back( *ii ); 
          } else {
            //        edm::LogWarning(mlConfigDb_)
            //          << "[SiStripPartition::" << __func__ << "]"
            //          << " Run number already found!";
          }
        } else {
          //        edm::LogWarning(mlConfigDb_)
          //          << "[SiStripPartition::" << __func__ << "]"
          //          << " NULL run number!";
        }
      } else {
        //        edm::LogWarning(mlConfigDb_)
        //          << "[SiStripPartition::" << __func__ << "]"
        //          << " Unexpected run type!";
      }
    } else {
      //        edm::LogWarning(mlConfigDb_)
      //          << "[SiStripPartition::" << __func__ << "]"
      //          << " Partition name does not match!";
    }

  }

}
void SiStripConfigDb::runs ( const Runs in,
SiStripConfigDb::RunsByPartition out,
sistrip::RunType  optional_type = sistrip::UNDEFINED_RUN_TYPE 
) const [protected]

Runs organsed by partition, optionally for given type.

Definition at line 957 of file SiStripConfigDb.cc.

References newFWLiteAna::found, and sistrip::UNDEFINED_RUN_TYPE.

                                                                 {
  
  out.clear();

  // Iterate through runs
  Runs::const_iterator ii = in.begin();
  Runs::const_iterator jj = in.end();
  for ( ; ii != jj; ++ii ) {
    // Check partition name
    if ( ii->partition_ != "" ) {
      // Check run type
      if ( ii->type_ == optional_type || optional_type == sistrip::UNDEFINED_RUN_TYPE ) { 
        // Check run number
        if ( ii->number_ ) { 
          bool found = false;
          if ( out.find( ii->partition_ ) != out.end() ) {
            Runs::const_iterator irun = out[ ii->partition_ ].begin();
            Runs::const_iterator jrun = out[ ii->partition_ ].end();
            while ( !found && irun != jrun ) {
              if ( irun->number_ == ii->number_ ) { found = true; }
              ++irun;
            }
          }
          // Check if run number already found
          if ( !found ) { 
            out[ ii->partition_ ].push_back( *ii ); 
          } else {
            //        edm::LogWarning(mlConfigDb_)
            //          << "[SiStripPartition::" << __func__ << "]"
            //          << " Run number already found!";
          }
        } else {
          //        edm::LogWarning(mlConfigDb_)
          //          << "[SiStripPartition::" << __func__ << "]"
          //          << " NULL run number!";
        }
      } else {
        //        edm::LogWarning(mlConfigDb_)
        //          << "[SiStripPartition::" << __func__ << "]"
        //          << " Run type does not match!";
      }
    } else {
      //        edm::LogWarning(mlConfigDb_)
      //          << "[SiStripPartition::" << __func__ << "]"
      //          << " NULL value for partition!";
    }

  }

}
void SiStripConfigDb::runs ( SiStripConfigDb::Runs runs) const [protected]

Retrieves all runs from database.

Definition at line 820 of file SiStripConfigDb.cc.

References cond::ecalcond::all, sistrip::APV_LATENCY, sistrip::APV_TIMING, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, sistrip::DAQ_SCOPE_MODE, deviceFactory(), sistrip::FAST_CABLING, sistrip::FED_CABLING, sistrip::FED_TIMING, sistrip::FINE_DELAY, sistrip::FINE_DELAY_PLL, sistrip::FINE_DELAY_TTC, sistrip::mlConfigDb_, sistrip::MULTI_MODE, SiStripConfigDb::Run::number_, sistrip::OPTO_SCAN, SiStripConfigDb::Run::partition_, sistrip::PEDESTALS, sistrip::PHYSICS, sistrip::PHYSICS_ZS, sistrip::QUITE_FAST_CABLING, csvReporter::r, cond::rpcobtemp::temp, SiStripConfigDb::Run::type_, sistrip::UNDEFINED_RUN_TYPE, sistrip::UNKNOWN_RUN_TYPE, and sistrip::VPSP_SCAN.

                                                            {
  
  runs.clear();
  
  // Check DF pointer
  DeviceFactory* const df = deviceFactory(__func__);
  if ( !df ) {
    edm::LogError(mlConfigDb_)
      << "[SiStripPartition::" << __func__ << "]"
      << " NULL pointer to DeviceFactory object!";
    return;
  }
  
  // Retrieve runs
  tkRunVector all;
  all = df->getAllRuns();

  // Iterate through tkRunVector
  tkRunVector::const_iterator ii = all.begin();
  tkRunVector::const_iterator jj = all.end();
  for ( ; ii != jj; ++ii ) {

    // Check TkRun pointer
    if ( *ii ) {

      // Retrieve run type
      uint16_t type = (*ii)->getModeId( (*ii)->getMode() );
      sistrip::RunType temp = sistrip::UNKNOWN_RUN_TYPE;
      if      ( type ==  1 ) { temp = sistrip::PHYSICS; }
      else if ( type ==  2 ) { temp = sistrip::PEDESTALS; }
      else if ( type ==  3 ) { temp = sistrip::CALIBRATION; }
      else if ( type == 33 ) { temp = sistrip::CALIBRATION_DECO; }
      else if ( type ==  4 ) { temp = sistrip::OPTO_SCAN; }
      else if ( type ==  5 ) { temp = sistrip::APV_TIMING; }
      else if ( type ==  6 ) { temp = sistrip::APV_LATENCY; }
      else if ( type ==  7 ) { temp = sistrip::FINE_DELAY_PLL; }
      else if ( type == 10 ) { temp = sistrip::MULTI_MODE; }
      else if ( type ==  8 ) { temp = sistrip::FINE_DELAY_TTC; }
      else if ( type == 12 ) { temp = sistrip::FED_TIMING; }
      else if ( type == 13 ) { temp = sistrip::FED_CABLING; }
      else if ( type == 14 ) { temp = sistrip::VPSP_SCAN; }
      else if ( type == 15 ) { temp = sistrip::DAQ_SCOPE_MODE; }
      else if ( type == 16 ) { temp = sistrip::QUITE_FAST_CABLING; }
      else if ( type == 17 ) { temp = sistrip::FINE_DELAY; }
      else if ( type == 18 ) { temp = sistrip::PHYSICS_ZS; }
      else if ( type == 19 ) { temp = sistrip::CALIBRATION_SCAN; }
      else if ( type == 20 ) { temp = sistrip::CALIBRATION_SCAN_DECO; }
      else if ( type == 21 ) { temp = sistrip::FAST_CABLING; }
      else if ( type ==  0 ) { temp = sistrip::UNDEFINED_RUN_TYPE; }
      else                   { temp = sistrip::UNKNOWN_RUN_TYPE; }
      
      // Store run details
      Run r;
      r.type_      = temp;
      r.partition_ = (*ii)->getPartitionName();
      r.number_    = (*ii)->getRunNumber();
      runs.push_back(r);

    } else {
      edm::LogWarning(mlConfigDb_)
        << "[SiStripPartition::" << __func__ << "]"
        << " NULL pointer to TkRun object!";
    }

  }

}
void SiStripConfigDb::uploadAnalysisDescriptions ( bool  calibration_for_physics = false,
std::string  partition = "" 
) [protected]

Uploads to database (just for given partition if specified).

Definition at line 232 of file AnalysisDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, and BeamSplash_cfg::version.

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

                                                                        {

  if ( dbParams_.usingDbCache() ) {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]" 
      << " Using database cache! No uploads allowed!"; 
    return;
  }
  
  if ( !deviceFactory(__func__) ) { return; }

  if ( analyses_.empty() ) { 
    edm::LogWarning(mlConfigDb_) 
      << "[SiStripConfigDb::" << __func__ << "]" 
      << " Found no cached analysis descriptions, therefore no upload!"; 
    return; 
  }
  
  if ( calibration_for_physics && !allowCalibUpload_ ) {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Attempting to upload calibration constants"
      << " without uploading any hardware descriptions!"
      << " Aborting upload...";
    return;
  } else { allowCalibUpload_ = false; }
  
  try { 

    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      
      if ( partition == "" || partition == iter->second.partitionName() ) {
        
        AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() );
        if ( range != analyses_.emptyRange() ) {
          
          AnalysisDescriptionsV anals( range.begin(), range.end() );
          
          AnalysisType analysis_type = AnalysisDescription::T_UNKNOWN;
          if ( anals.front() ) { analysis_type = anals.front()->getType(); }
          if ( analysis_type == AnalysisDescription::T_UNKNOWN ) {
            edm::LogWarning(mlConfigDb_)
              << "[SiStripConfigDb::" << __func__ << "]"
              << " Analysis type is UNKNOWN. Aborting upload!";
            return;
          }
          
          uint32_t version = deviceFactory(__func__)->uploadAnalysis( iter->second.runNumber(), 
                                                                      iter->second.partitionName(), 
                                                                      analysis_type,
                                                                      anals,
                                                                      calibration_for_physics );

          // Update current state with analysis descriptions
          if ( calibration_for_physics ) { deviceFactory(__func__)->uploadAnalysisState( version ); }
          
          // Some debug
          std::stringstream ss;
          ss << "[SiStripConfigDb::" << __func__ << "]"
             << " Uploaded " << anals.size() 
             << " device descriptions to database for partition \""
             << iter->second.partitionName() << "\".";
          LogTrace(mlConfigDb_) << ss.str();
          
        } else {
          stringstream ss; 
          ss << "[SiStripConfigDb::" << __func__ << "]" 
             << " Vector of device descriptions is empty for partition \"" 
             << iter->second.partitionName()
             << "\", therefore aborting upload for this partition!";
          edm::LogWarning(mlConfigDb_) << ss.str(); 
          continue; 
        }
        
      } else {
        //        stringstream ss; 
        //        ss << "[SiStripConfigDb::" << __func__ << "]" 
        //           << " Cannot find partition \"" << partition
        //           << "\" in cached partitions list: \""
        //           << dbParams_.partitionNames( dbParams_.partitionNames() ) 
        //           << "\", therefore aborting upload for this partition!";
        //        edm::LogWarning(mlConfigDb_) << ss.str(); 
      }
      
    }
    
  } catch (...) { handleException( __func__ ); }
  
  allowCalibUpload_ = true;
  
}
void SiStripConfigDb::uploadDcuDetIds ( std::string  partition = "") [protected]

Uploads to database (just for given partition if specified).

Definition at line 184 of file DcuDetIds.cc.

References sistrip::mlConfigDb_.

                                                           {

  stringstream ss; 
  ss << "[SiStripConfigDb::" << __func__ << "]" 
     << " Cannot upload to database! This functionality not allowed!";
  edm::LogWarning(mlConfigDb_) << ss.str(); 
  
  /*
    addAllDetId => all detids
    addAllDetId => to download (up to you)
    change in the detids
    setTkDcuInfo
    getCurrentStates
    setCurrentState
    addDetIpartiton
    AddAllDetId
  */
  
  //   if ( dbParams_.usingDbCache() ) {
  //     edm::LogWarning(mlConfigDb_)
  //       << "[SiStripConfigDb::" << __func__ << "]" 
  //       << " Using database cache! No uploads allowed!"; 
  //     return;
  //   }

  //   if ( !deviceFactory(__func__) ) { return; }
  
  //   if ( dcuDetIds_.empty() ) { 
  //     stringstream ss; 
  //     ss << "[SiStripConfigDb::" << __func__ << "]" 
  //        << " Found no cached DCU-DetId map, therefore no upload!"; 
  //     edm::LogWarning(mlConfigDb_) << ss.str(); 
  //     return; 
  //   }

  //   try {
    
  //     SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
  //     SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
  //     for ( ; iter != jter; ++iter ) {
      
  //       if ( partition == "" || partition == iter->second.partitionName() ) {
        
  //    DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
  //    if ( range != dcuDetIds_.emptyRange() ) {
          
  //      // Extract 
  //      DcuDetIdMap dst;
  //      clone( DcuDetIdsV( range.begin(), range.end() ), dst );
  //      deviceFactory(__func__)->setTkDcuInfo( dst );
  //      getcurrentstate
  //      deviceFactory(__func__)->addAllDetId();
          
  //      // Some debug
  //      std::stringstream ss;
  //      ss << "[SiStripConfigDb::" << __func__ << "]"
  //         << " Uploaded " << dst.size() 
  //         << " DCU-DetId map to DB/xml for partition \""
  //         << iter->second.partitionName() << "\".";
  //      LogTrace(mlConfigDb_) << ss.str();
          
  //    } else {
  //      stringstream ss; 
  //      ss << "[SiStripConfigDb::" << __func__ << "]" 
  //         << " Vector of DCU-DetId map is empty for partition \"" 
  //         << iter->second.partitionName()
  //         << "\", therefore aborting upload for this partition!";
  //      edm::LogWarning(mlConfigDb_) << ss.str(); 
  //      continue; 
  //    }
        
  //       } else {
  //    //        stringstream ss; 
  //    //        ss << "[SiStripConfigDb::" << __func__ << "]" 
  //    //           << " Cannot find partition \"" << partition
  //    //           << "\" in cached partitions list: \""
  //    //           << dbParams_.partitionNames( dbParams_.partitionNames() ) 
  //    //           << "\", therefore aborting upload for this partition!";
  //    //        edm::LogWarning(mlConfigDb_) << ss.str(); 
  //       }
      
  //     }
    
  //   } catch (... ) { handleException( __func__, "Problems updating objects in TkDcuInfoFactory!" ); }
  
}
void SiStripConfigDb::uploadDeviceDescriptions ( std::string  partition = "") [protected]

Uploads to database (just for given partition if specified).

Definition at line 269 of file DeviceDescriptions.cc.

References LogTrace, and sistrip::mlConfigDb_.

Referenced by ApvTimingHistosUsingDb::uploadConfigurations(), LatencyHistosUsingDb::uploadConfigurations(), CalibrationHistosUsingDb::uploadConfigurations(), OptoScanHistosUsingDb::uploadConfigurations(), FineDelayHistosUsingDb::uploadConfigurations(), and VpspScanHistosUsingDb::uploadConfigurations().

                                                                    {

  if ( dbParams_.usingDbCache() ) {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]" 
      << " Using database cache! No uploads allowed!"; 
    return;
  }
  
  if ( !deviceFactory(__func__) ) { return; }
  
  if ( devices_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached device descriptions, therefore no upload!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  try { 

    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      
      if ( partition == "" || partition == iter->second.partitionName() ) {
        
        DeviceDescriptionsRange range = devices_.find( iter->second.partitionName() );
        if ( range != devices_.emptyRange() ) {
          
          DeviceDescriptionsV devs( range.begin(), range.end() );
          
          deviceFactory(__func__)->setFecDeviceDescriptions( devs,
                                                             iter->second.partitionName(),
                                                             &(iter->second.fecVersion().first),
                                                             &(iter->second.fecVersion().second),
                                                             true ); // new major version

          // Some debug
          std::stringstream ss;
          ss << "[SiStripConfigDb::" << __func__ << "]"
             << " Uploaded " << devs.size() 
             << " device descriptions to database for partition \""
             << iter->second.partitionName() << "\".";
          LogTrace(mlConfigDb_) << ss.str();
          
        } else {
          stringstream ss; 
          ss << "[SiStripConfigDb::" << __func__ << "]" 
             << " Vector of device descriptions is empty for partition \"" 
             << iter->second.partitionName()
             << "\", therefore aborting upload for this partition!";
          edm::LogWarning(mlConfigDb_) << ss.str(); 
          continue; 
        }
        
      } else {
        //        stringstream ss; 
        //        ss << "[SiStripConfigDb::" << __func__ << "]" 
        //           << " Cannot find partition \"" << partition
        //           << "\" in cached partitions list: \""
        //           << dbParams_.partitionNames( dbParams_.partitionNames() ) 
        //           << "\", therefore aborting upload for this partition!";
        //        edm::LogWarning(mlConfigDb_) << ss.str(); 
      }
      
    }
    
  } catch (...) { handleException( __func__ ); }
  
  allowCalibUpload_ = true;
  
}
void SiStripConfigDb::uploadFedConnections ( std::string  partition = "") [protected]

Uploads to database (just for given partition if specified).

Definition at line 198 of file FedConnections.cc.

References LogTrace, and sistrip::mlConfigDb_.

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

                                                                {

  if ( dbParams_.usingDbCache() ) {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]" 
      << " Using database cache! No uploads allowed!"; 
    return;
  }

  if ( !deviceFactory(__func__) ) { return; }
  
  if ( connections_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached FED connections, therefore no upload!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }

  if ( dbParams_.usingDb() ) {
    
    try { 
      
      SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
      SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
      for ( ; iter != jter; ++iter ) {

        if ( partition == "" || partition == iter->second.partitionName() ) {

          FedConnectionsRange range = connections_.find( iter->second.partitionName() );
          if ( range != connections_.emptyRange() ) {

            FedConnectionsV conns( range.begin(), range.end() );
            
            deviceFactory(__func__)->setConnectionDescriptions( conns,
                                                                iter->second.partitionName(),
                                                                &(iter->second.cabVersion().first),
                                                                &(iter->second.cabVersion().second),
                                                                true ); // new major version

            // Some debug
            std::stringstream ss;
            ss << "[SiStripConfigDb::" << __func__ << "]"
               << " Uploaded " << conns.size() 
               << " FED connections to database for partition \""
               << iter->second.partitionName() << "\".";
            LogTrace(mlConfigDb_) << ss.str();

          } else {
            stringstream ss; 
            ss << "[SiStripConfigDb::" << __func__ << "]" 
               << " Vector of FED connections is empty for partition \"" 
               << iter->second.partitionName()
               << "\", therefore aborting upload for this partition!";
            edm::LogWarning(mlConfigDb_) << ss.str(); 
            continue; 
          }

        } else {
          //      stringstream ss; 
          //      ss << "[SiStripConfigDb::" << __func__ << "]" 
          //         << " Cannot find partition \"" << partition
          //         << "\" in cached partitions list: \""
          //         << dbParams_.partitionNames( dbParams_.partitionNames() ) 
          //         << "\", therefore aborting upload for this partition!";
          //      edm::LogWarning(mlConfigDb_) << ss.str(); 
        }

      }

    } catch (...) { handleException( __func__ ); }
    
  }

  allowCalibUpload_ = true;
  
}
void SiStripConfigDb::uploadFedDescriptions ( std::string  partition = "") [protected]

Uploads to database (just for given partition if specified).

Definition at line 202 of file FedDescriptions.cc.

References LogTrace, and sistrip::mlConfigDb_.

Referenced by ApvTimingHistosUsingDb::uploadConfigurations(), LatencyHistosUsingDb::uploadConfigurations(), PedestalsHistosUsingDb::uploadConfigurations(), FineDelayHistosUsingDb::uploadConfigurations(), PedsOnlyHistosUsingDb::uploadConfigurations(), PedsFullNoiseHistosUsingDb::uploadConfigurations(), FastFedCablingHistosUsingDb::uploadConfigurations(), and NoiseHistosUsingDb::uploadConfigurations().

                                                                 { 
  
  if ( dbParams_.usingDbCache() ) {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]" 
      << " Using database cache! No uploads allowed!"; 
    return;
  }
  
  if ( !deviceFactory(__func__) ) { return; }
  
  if ( feds_.empty() ) { 
    stringstream ss; 
    ss << "[SiStripConfigDb::" << __func__ << "]" 
       << " Found no cached FED descriptions, therefore no upload!"; 
    edm::LogWarning(mlConfigDb_) << ss.str(); 
    return; 
  }
  
  try { 

    SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
    SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
    for ( ; iter != jter; ++iter ) {
      
      if ( partition == "" || partition == iter->second.partitionName() ) {
        
        FedDescriptionsRange range = feds_.find( iter->second.partitionName() );
        if ( range != feds_.emptyRange() ) {
          
          FedDescriptionsV feds( range.begin(), range.end() );
          
          deviceFactory(__func__)->setFed9UDescriptions( feds,
                                                         iter->second.partitionName(),
                                                         (uint16_t*)(&iter->second.fedVersion().first), 
                                                         (uint16_t*)(&iter->second.fedVersion().second),
                                                         1 ); // new major version

          // Some debug
          std::stringstream ss;
          ss << "[SiStripConfigDb::" << __func__ << "]"
             << " Uploaded " << feds.size() 
             << " FED descriptions to database for partition \""
             << iter->second.partitionName() << "\"";
          LogTrace(mlConfigDb_) << ss.str();
          
        } else {
          stringstream ss; 
          ss << "[SiStripConfigDb::" << __func__ << "]" 
             << " Vector of FED descriptions is empty for partition \"" 
             << iter->second.partitionName()
             << "\", therefore aborting upload for this partition!";
          edm::LogWarning(mlConfigDb_) << ss.str(); 
          continue; 
        }
        
      } else {
        //        stringstream ss; 
        //        ss << "[SiStripConfigDb::" << __func__ << "]" 
        //           << " Cannot find partition \"" << partition
        //           << "\" in cached partitions list: \""
        //           << dbParams_.partitionNames( dbParams_.partitionNames() ) 
        //           << "\", therefore aborting upload for this partition!";
        //        edm::LogWarning(mlConfigDb_) << ss.str(); 
      }
      
    }
    
  } catch (...) { handleException( __func__ ); }
  
  allowCalibUpload_ = true;
  
}
void SiStripConfigDb::usingDatabase ( ) [private]

Definition at line 228 of file SiStripConfigDb.cc.

References SiStripDbParams::addPartition(), SiStripDbParams::clearPartitions(), SiStripDbParams::confdb(), dbParams_, deviceFactory(), sistrip::dir_, factory_, lut2db_cfg::filename, handleException(), geometryCSVtoXML::line, LogTrace, sistrip::mlConfigDb_, NULL, sistrip::null_, convertSQLiteXML::ok, SiStripDbParams::partitionNames(), partitions(), SiStripDbParams::partitions(), SiStripDbParams::passwd(), path(), SiStripDbParams::path(), listBenchmarks::pattern, cmsCodeRules::pickleFileParser::slash, SiStripDbParams::tnsAdmin(), hcal_dqm_sourceclient-file_cfg::user, SiStripDbParams::user(), and SiStripDbParams::usingDb().

Referenced by openDbConnection().

                                    {
  
  // Retrieve connection params from CONFDB env. var. and override .cfg values 
  std::string user = "";
  std::string passwd = "";
  std::string path = "";
  DbAccess::getDbConfiguration( user, passwd, path );
  if ( user != "" && passwd != "" && path != "" ) {

    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Setting \"user/passwd@path\" to \""
       << user << "/" << passwd << "@" << path
       << "\" using 'CONFDB' environmental variable";
    if ( dbParams_.user() != null_ || 
         dbParams_.passwd() != null_ || 
         dbParams_.path() != null_ ) { 
      ss << " (Overwriting existing value of \""
         << dbParams_.user() << "/" 
         << dbParams_.passwd() << "@" 
         << dbParams_.path() 
         << "\" read from .cfg file)";
    }
    edm::LogVerbatim(mlConfigDb_) << ss.str() << std::endl;
    dbParams_.confdb( user, passwd, path );

  } else if ( dbParams_.user() != null_ && 
              dbParams_.passwd() != null_ && 
              dbParams_.path() != null_ ) { 

    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Setting \"user/passwd@path\" to \""
       << dbParams_.user() << "/" 
       << dbParams_.passwd() << "@" 
       << dbParams_.path() 
       << "\" using 'ConfDb' configurable read from .cfg file";
    edm::LogVerbatim(mlConfigDb_) << ss.str();

  } else {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Unable to retrieve 'user/passwd@path' parameters"
      << " from 'CONFDB' environmental variable or .cfg file"
      << " (present value is \"" 
      << user << "/" 
      << passwd << "@" 
      << path 
      << "\"). Aborting connection to database...";
    return;
  }
  
  // Check TNS_ADMIN environmental variable
  std::string pattern = "TNS_ADMIN";
  std::string tns_admin = "/afs/cern.ch/project/oracle/admin";
  if ( getenv( pattern.c_str() ) != NULL ) { 
    tns_admin = getenv( pattern.c_str() ); 
    edm::LogVerbatim(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " TNS_ADMIN is set to: \"" 
      << tns_admin << "\"";
  } else {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " TNS_ADMIN is not set!"
      << " Trying to use /afs and setting to: \"" 
      << tns_admin << "\"";
  }

  // Retrieve TNS_ADMIN from .cfg file and override
  if ( !dbParams_.tnsAdmin().empty() ) {
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Overriding TNS_ADMIN value using cfg file!" << std::endl
       << "  Original value : \"" << tns_admin << "\"!" << std::endl
       << "  New value      : \"" << dbParams_.tnsAdmin() << "\"!";
    tns_admin = dbParams_.tnsAdmin();
    edm::LogVerbatim(mlConfigDb_) << ss.str();
  }
  
  // Remove trailing slash and set TNS_ADMIN
  if ( tns_admin.empty() ) { tns_admin = "."; }
  std::string slash = tns_admin.substr( tns_admin.size()-1, 1 ); 
  if ( slash == sistrip::dir_ ) { tns_admin = tns_admin.substr( 0, tns_admin.size()-1 ); }
  setenv( pattern.c_str(), tns_admin.c_str(), 1 ); 
  
  // Check if database is found in tnsnames.ora file
  std::string filename( tns_admin + "/tnsnames.ora" ); 
  std::ifstream tnsnames_ora( filename.c_str() );
  bool ok = false;
  if ( tnsnames_ora.is_open() ) {
    std::string line;
    while ( !tnsnames_ora.eof() ) {
      getline( tnsnames_ora, line );
      if ( !dbParams_.path().empty() && 
           line.find( dbParams_.path() ) != std::string::npos ) { ok = true; }
    }
  } else {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Cannot open file \""
      << filename << "\"";
  }

  if ( ok ) {
    LogTrace(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Found database account \"" 
      << dbParams_.path() << "\" in file \""
      << filename << "\"!";
  } else {
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Cannot find database account \"" 
      << dbParams_.path() << "\" in file \""
      << filename << "\""
      << " Aborting connection to database...";
    return; 
  }
  
  // Create device factory object
  try { 
    LogTrace(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Creating DeviceFactory object...";
    factory_ = new DeviceFactory( dbParams_.user(), 
                                  dbParams_.passwd(), 
                                  dbParams_.path() ); 
    LogTrace(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Created DeviceFactory object!";
  } catch (...) { 
    std::stringstream ss; 
    ss << "Failed to connect to database using parameters '" 
       << dbParams_.user() << "/" 
       << dbParams_.passwd() << "@" 
       << dbParams_.path() 
       << "' and partitions '" 
       << dbParams_.partitionNames( dbParams_.partitionNames() ) << "'";
    handleException( __func__, ss.str() );
    return;
  }
  
  // Check for valid pointer to DeviceFactory
  if ( deviceFactory(__func__) ) { 
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " DeviceFactory created at address 0x" 
       << std::hex << std::setw(8) << std::setfill('0') << factory_ << std::dec
       << ", using database account with parameters '" 
       << dbParams_.user() << "/" 
       << dbParams_.passwd() << "@" 
       << dbParams_.path();
    LogTrace(mlConfigDb_) << ss.str();
  } else {
    edm::LogError(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " NULL pointer to DeviceFactory!"
      << " Unable to connect to database using connection parameters '" 
      << dbParams_.user() << "/" 
      << dbParams_.passwd() << "@" 
      << dbParams_.path()
      << "' and partitions '" 
      << dbParams_.partitionNames( dbParams_.partitionNames() ) << "'";
    return; 
  }
  
  try { 
    deviceFactory(__func__)->setUsingDb( dbParams_.usingDb() ); 
  } catch (...) { 
    handleException( __func__, "Attempted to 'setUsingDb'" );
  }
  
  // Retrieve partition name from ENV_CMS_TK_PARTITION env. var. and override .cfg value
  std::string partition = "ENV_CMS_TK_PARTITION";
  if ( getenv(partition.c_str()) != NULL ) { 
    
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Setting \"partitions\" to \""
       << getenv( partition.c_str() )
       << "\" using 'ENV_CMS_TK_PARTITION' environmental variable";
    if ( !dbParams_.partitionNames().empty() ) {
      ss << " (Overwriting existing value of \""
         << dbParams_.partitionNames( dbParams_.partitionNames() )
         << "\" read from .cfg file)";
    }
    edm::LogVerbatim(mlConfigDb_) << ss.str() << std::endl;
    
    // Build partitions from env. var.
    std::vector<std::string> partitions = dbParams_.partitionNames( getenv( partition.c_str() ) );
    if ( !partitions.empty() ) {
      dbParams_.clearPartitions();
      std::vector<std::string>::iterator ii = partitions.begin();
      std::vector<std::string>::iterator jj = partitions.end();
      for ( ; ii != jj; ++ii ) {
        SiStripPartition partition( *ii );
        dbParams_.addPartition( partition );
      }
    }

  } else if ( !dbParams_.partitionNames().empty() ) {
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Setting \"partitions\" to \""
       << dbParams_.partitionNames( dbParams_.partitionNames() )
       << "\" using 'PartitionName' configurables read from .cfg file";
    edm::LogVerbatim(mlConfigDb_) << ss.str();
  } else { 
    edm::LogWarning(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Unable to retrieve 'partition' parameter"
      << " from 'CONFDB' environmental variable or .cfg file!"
      << " Aborting connection to database...";
    return;
  } 

  // Check if should use current state, run number or versions
  SiStripDbParams::SiStripPartitions::iterator ip = dbParams_.partitions().begin();
  SiStripDbParams::SiStripPartitions::iterator jp = dbParams_.partitions().end();
  for ( ; ip != jp; ++ip ) { ip->second.update( this ); }
  
}
void SiStripConfigDb::usingDatabaseCache ( ) [private]

Definition at line 454 of file SiStripConfigDb.cc.

References SiStripDbParams::addPartition(), databaseCache(), dbCache_, dbParams_, SiStripPartition::defaultPartitionName_, handleException(), LogTrace, sistrip::mlConfigDb_, SiStripDbParams::reset(), SiStripDbParams::sharedMemory(), SiStripPartition, cond::rpcobtemp::temp, SiStripDbParams::usingDb(), and SiStripDbParams::usingDbCache().

Referenced by openDbConnection().

                                         {
  
  // Reset all DbParams except for those concerning database cache
  SiStripDbParams temp;
  temp = dbParams_;
  dbParams_.reset();
  dbParams_.usingDb( temp.usingDb() );
  dbParams_.usingDbCache( temp.usingDbCache() );
  dbParams_.sharedMemory( temp.sharedMemory() );

  // Add default partition 
  dbParams_.addPartition( SiStripPartition( SiStripPartition::defaultPartitionName_ ) );
  
  // Check shared memory name from .cfg file
  if ( dbParams_.sharedMemory().empty() ) {
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " Empty string for shared memory name!" 
       << " Cannot accept shared memory!";
    edm::LogError(mlConfigDb_) << ss.str();
    return;
  }
  
  // Create database cache object
  try { 
    LogTrace(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Creating DbClient object...";
    dbCache_ = new DbClient( dbParams_.sharedMemory() );
    LogTrace(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " Created DbClient object...";
  } catch (...) { 
    std::stringstream ss; 
    ss << "Failed to connect to database cache using shared memory name: '" 
       << dbParams_.sharedMemory() << "'!";
    handleException( __func__, ss.str() );
    return;
  }
  
  // Check for valid pointer to DbClient object
  if ( databaseCache(__func__) ) { 
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " DbClient object created at address 0x" 
       << std::hex << std::setw(8) << std::setfill('0') << dbCache_ << std::dec
       << " using shared memory name '" 
       << dbParams_.sharedMemory() << "'"; 
    LogTrace(mlConfigDb_) << ss.str();
  } else {
    edm::LogError(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " NULL pointer to DbClient object!"
      << " Unable to connect to database cache using shared memory name '" 
      << dbParams_.sharedMemory() << "'"; 
    return; 
  }
  
  // Try retrieve descriptions from Database Client
  try { 
    databaseCache(__func__)->parse(); 
  } catch (...) { 
    handleException( __func__, "Attempted to called DbClient::parse() method" );
  }
  
}
bool SiStripConfigDb::usingDb ( ) const [inline, protected]

Returns whether using database or xml files.

Indicates whether DB (true) or XML files (false) are used.

Definition at line 471 of file SiStripConfigDb.h.

References dbParams_, and SiStripDbParams::usingDb().

{ return dbParams_.usingDb(); }
void SiStripConfigDb::usingStrips ( bool  using_strips) [inline, protected]

Enables/disables strip-level info within FED descriptions.

Switches on/off of upload/download for FED strip info.

Definition at line 477 of file SiStripConfigDb.h.

References usingStrips_.

{ usingStrips_ = using_strips; }
bool SiStripConfigDb::usingStrips ( ) const [inline, protected]

Strip-level info enabled/disabled within FED descriptions.

Indicates whether FED strip info is uploaded/downloaded.

Definition at line 474 of file SiStripConfigDb.h.

References usingStrips_.

{ return usingStrips_; }
void SiStripConfigDb::usingXmlFiles ( ) [private]

Definition at line 523 of file SiStripConfigDb.cc.

References checkFileExists(), dbParams_, deviceFactory(), factory_, handleException(), LogTrace, sistrip::mlConfigDb_, SiStripDbParams::outputDcuInfoXml(), SiStripDbParams::outputFecXml(), SiStripDbParams::outputFedXml(), SiStripDbParams::outputModuleXml(), SiStripDbParams::partitions(), and SiStripDbParams::usingDb().

Referenced by openDbConnection().

                                    {
  LogTrace(mlConfigDb_)
    << "[SiStripConfigDb::" << __func__ << "]"
    << " Using XML description files...";

  // Create device factory object
  try { 
    factory_ = new DeviceFactory(); 
  } catch (...) { 
    handleException( __func__, "Attempting to create DeviceFactory for use with xml files" );
  }
  
 // Check for valid pointer to DeviceFactory
  if ( deviceFactory(__func__) ) { 
    std::stringstream ss;
    ss << "[SiStripConfigDb::" << __func__ << "]"
       << " DeviceFactory created at address 0x" 
       << std::hex << std::setw(8) << std::setfill('0') << factory_ << std::dec
       << ", using XML description files";
    LogTrace(mlConfigDb_) << ss.str();
  } else {    
    edm::LogError(mlConfigDb_)
      << "[SiStripConfigDb::" << __func__ << "]"
      << " NULL pointer to DeviceFactory!"
      << " Unable to connect to database!";
    return; 
  }
  
  try { 
    deviceFactory(__func__)->setUsingDb( dbParams_.usingDb() );
  } catch (...) { 
    handleException( __func__, "Attempted to 'setUsingDb'" );
  }

  // Iterate through partitions
  SiStripDbParams::SiStripPartitions::const_iterator ip = dbParams_.partitions().begin();
  SiStripDbParams::SiStripPartitions::const_iterator jp = dbParams_.partitions().end();
  for ( ; ip != jp; ++ip ) {
    
    // Input module.xml file
    if ( ip->second.inputModuleXml() == "" ) {
      edm::LogWarning(mlConfigDb_)
        << "[SiStripConfigDb::" << __func__ << "]"
        << " NULL path to input 'module.xml' file!";
    } else {
      if ( checkFileExists( ip->second.inputModuleXml() ) ) { 
        try { 
          deviceFactory(__func__)->addConnectionFileName( ip->second.inputModuleXml() ); 
        } catch (...) { 
          handleException( __func__ ); 
        }
        LogTrace(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " Added input 'module.xml' file: " << ip->second.inputModuleXml();
      } else {
        edm::LogWarning(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " No 'module.xml' file found at " << ip->second.inputModuleXml();
        ip->second.inputModuleXml() = ""; 
      }
    }
  
    // Input dcuinfo.xml file
    if ( ip->second.inputDcuInfoXml() == "" ) {
      edm::LogWarning(mlConfigDb_)
        << "[SiStripConfigDb::" << __func__ << "]"
        << " NULL path to input 'dcuinfo.xml' file!";
    } else { 
      if ( checkFileExists( ip->second.inputDcuInfoXml() ) ) { 
        try { 
          deviceFactory(__func__)->addTkDcuInfoFileName( ip->second.inputDcuInfoXml() ); 
        } catch (...) { 
          handleException( __func__ ); 
        }
        LogTrace(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " Added 'dcuinfo.xml' file: " << ip->second.inputDcuInfoXml();
      } else {
        edm::LogWarning(mlConfigDb_)
          << "[SiStripConfigDb::" << __func__ << "]"
          << " No 'dcuinfo.xml' file found at " << ip->second.inputDcuInfoXml();
        ip->second.inputDcuInfoXml() = ""; 
      } 
    }

    // Input FEC xml files
    if ( ip->second.inputFecXml().empty() ) {
      edm::LogWarning(mlConfigDb_) 
        << "[SiStripConfigDb::" << __func__ << "]"
        << " NULL paths to input 'fec.xml' files!";
    } else {
      std::vector<std::string>::iterator iter = ip->second.inputFecXml().begin();
      for ( ; iter != ip->second.inputFecXml().end(); iter++ ) {
        if ( *iter == "" ) {
          edm::LogWarning(mlConfigDb_)
            << "[SiStripConfigDb::" << __func__ << "]"
            << " NULL path to input 'fec.xml' file!";
        } else {
          if ( checkFileExists( *iter ) ) { 
            try { 
              deviceFactory(__func__)->addFecFileName( *iter ); 
            } catch (...) { handleException( __func__ ); }
            LogTrace(mlConfigDb_) 
              << "[SiStripConfigDb::" << __func__ << "]"
              << " Added 'fec.xml' file: " << *iter;
          } else {
            edm::LogWarning(mlConfigDb_) 
              << "[SiStripConfigDb::" << __func__ << "]"
              << " No 'fec.xml' file found at " << *iter;
            *iter = ""; 
          } 
        }
      }
    }
    
    // Input FED xml files
    if ( ip->second.inputFedXml().empty() ) {
      edm::LogWarning(mlConfigDb_) 
        << "[SiStripConfigDb::" << __func__ << "]"
        << " NULL paths to input 'fed.xml' files!";
    } else {
      std::vector<std::string>::iterator iter = ip->second.inputFedXml().begin();
      for ( ; iter != ip->second.inputFedXml().end(); iter++ ) {
        if ( *iter == "" ) {
          edm::LogWarning(mlConfigDb_) 
            << "[SiStripConfigDb::" << __func__ << "]"
            << " NULL path to input 'fed.xml' file!";
        } else {
          if ( checkFileExists( *iter ) ) { 
            try { 
                deviceFactory(__func__)->addFedFileName( *iter ); 
            } catch (...) { 
              handleException( __func__ ); 
            }
            LogTrace(mlConfigDb_) 
              << "[SiStripConfigDb::" << __func__ << "]"
              << " Added 'fed.xml' file: " << *iter;
          } else {
            edm::LogWarning(mlConfigDb_) 
              << "[SiStripConfigDb::" << __func__ << "]"
              << " No 'fed.xml' file found at " << *iter;
            *iter = ""; 
          } 
        }
      }
    }

  }

  // Output module.xml file
  if ( dbParams_.outputModuleXml() == "" ) { 
    edm::LogWarning(mlConfigDb_) 
      << "[SiStripConfigDb::" << __func__ << "]"
      << " NULL path to output 'module.xml' file!"
      << " Setting to '/tmp/module.xml'...";
    dbParams_.outputModuleXml() = "/tmp/module.xml"; 
  } else {
    try { 
      ConnectionFactory* factory = deviceFactory(__func__);
      factory->setOutputFileName( dbParams_.outputModuleXml() ); 
    } catch (...) { 
      handleException( __func__, "Problems setting output 'module.xml' file!" ); 
    }
  }

  // Output dcuinfo.xml file
  if ( dbParams_.outputDcuInfoXml() == "" ) { 
    edm::LogWarning(mlConfigDb_) 
      << "[SiStripConfigDb::" << __func__ << "]"
      << " NULL path to output 'dcuinfo.xml' file!"
      << " Setting to '/tmp/dcuinfo.xml'...";
    dbParams_.outputModuleXml() = "/tmp/dcuinfo.xml"; 
  } else {
    try { 
      TkDcuInfoFactory* factory = deviceFactory(__func__);
      factory->setOutputFileName( dbParams_.outputDcuInfoXml() ); 
    } catch (...) { 
      handleException( __func__, "Problems setting output 'dcuinfo.xml' file!" ); 
    }
  }

  // Output fec.xml file
  if ( dbParams_.outputFecXml() == "" ) {
    edm::LogWarning(mlConfigDb_) 
      << "[SiStripConfigDb::" << __func__ << "]"
      << " NULL path to output 'fec.xml' file!"
      << " Setting to '/tmp/fec.xml'...";
    dbParams_.outputFecXml() = "/tmp/fec.xml";
  } else {
    try { 
      FecDeviceFactory* factory = deviceFactory(__func__);
      factory->setOutputFileName( dbParams_.outputFecXml() ); 
    } catch (...) { 
      handleException( __func__, "Problems setting output 'fec.xml' file!" ); 
    }
  }

  // Output fed.xml file
  if ( dbParams_.outputFedXml() == "" ) {
    edm::LogWarning(mlConfigDb_) 
      << "[SiStripConfigDb::" << __func__ << "]"
      << " NULL path to output 'fed.xml' file!"
      << " Setting to '/tmp/fed.xml'...";
    dbParams_.outputFedXml() = "/tmp/fed.xml";
  } else {
    try { 
      Fed9U::Fed9UDeviceFactory* factory = deviceFactory(__func__);
      factory->setOutputFileName( dbParams_.outputFedXml() ); 
    } catch (...) { 
      handleException( __func__, "Problems setting output 'fed.xml' file!" ); 
    }
  }

}

Friends And Related Function Documentation

friend class ApvTimingHistosUsingDb [friend]

Definition at line 89 of file SiStripConfigDb.h.

friend class CalibrationHistosUsingDb [friend]

Definition at line 98 of file SiStripConfigDb.h.

friend class CommissioningHistosUsingDb [friend]

Definition at line 86 of file SiStripConfigDb.h.

friend class FastFedCablingHistosUsingDb [friend]

Definition at line 87 of file SiStripConfigDb.h.

friend class FedCablingHistosUsingDb [friend]

Definition at line 88 of file SiStripConfigDb.h.

friend class FineDelayHistosUsingDb [friend]

Definition at line 97 of file SiStripConfigDb.h.

friend class LatencyHistosUsingDb [friend]

Definition at line 96 of file SiStripConfigDb.h.

friend class NoiseHistosUsingDb [friend]

Definition at line 94 of file SiStripConfigDb.h.

friend class OptoScanHistosUsingDb [friend]

Definition at line 90 of file SiStripConfigDb.h.

friend class PedestalsHistosUsingDb [friend]

Definition at line 91 of file SiStripConfigDb.h.

friend class PedsFullNoiseHistosUsingDb [friend]

Definition at line 92 of file SiStripConfigDb.h.

friend class PedsOnlyHistosUsingDb [friend]

Definition at line 93 of file SiStripConfigDb.h.

friend class SiStripCommissioningDbClient [friend]

Definition at line 84 of file SiStripConfigDb.h.

friend class SiStripCommissioningOfflineDbClient [friend]

Definition at line 85 of file SiStripConfigDb.h.

friend class SiStripCondObjBuilderFromDb [friend]

Definition at line 79 of file SiStripConfigDb.h.

friend class SiStripFedCablingBuilderFromDb [friend]

Definition at line 76 of file SiStripConfigDb.h.

friend class SiStripNoiseBuilderFromDb [friend]

Definition at line 78 of file SiStripConfigDb.h.

friend class SiStripPartition [friend]

Definition at line 101 of file SiStripConfigDb.h.

Referenced by usingDatabaseCache().

friend class SiStripPedestalsBuilderFromDb [friend]

Definition at line 77 of file SiStripConfigDb.h.

friend class SiStripPsuDetIdMap [friend]

Definition at line 80 of file SiStripConfigDb.h.

friend class testSiStripConfigDb [friend]

Definition at line 102 of file SiStripConfigDb.h.

friend class VpspScanHistosUsingDb [friend]

Definition at line 95 of file SiStripConfigDb.h.


Member Data Documentation

bool SiStripConfigDb::allowCalibUpload_ = false [static, private]

Definition at line 458 of file SiStripConfigDb.h.

Analysis descriptions for given commissioning run.

Definition at line 419 of file SiStripConfigDb.h.

Cache for devices of given type.

Definition at line 422 of file SiStripConfigDb.h.

uint32_t SiStripConfigDb::cntr_ = 0 [static, private]

Static counter of instances of this class.

Definition at line 456 of file SiStripConfigDb.h.

Referenced by SiStripConfigDb(), and ~SiStripConfigDb().

FED-FEC connection descriptions.

Definition at line 407 of file SiStripConfigDb.h.

DbClient* SiStripConfigDb::dbCache_ [private]

Pointer to the DbClient class.

Definition at line 397 of file SiStripConfigDb.h.

Referenced by closeDbConnection(), databaseCache(), and usingDatabaseCache().

Instance of struct that holds all DB connection parameters.

Definition at line 400 of file SiStripConfigDb.h.

Referenced by dbParams(), openDbConnection(), runs(), SiStripConfigDb(), usingDatabase(), usingDatabaseCache(), usingDb(), and usingXmlFiles().

DcuId-DetId map (map of TkDcuInfo objects).

Definition at line 416 of file SiStripConfigDb.h.

Cache for devices of given type.

Definition at line 428 of file SiStripConfigDb.h.

Device descriptions (including DCUs).

Definition at line 410 of file SiStripConfigDb.h.

Cache for devices of given type.

Definition at line 437 of file SiStripConfigDb.h.

DeviceFactory* SiStripConfigDb::factory_ [private]

Pointer to the DeviceFactory API.

Definition at line 394 of file SiStripConfigDb.h.

Referenced by closeDbConnection(), deviceFactory(), usingDatabase(), and usingXmlFiles().

FED ids.

Definition at line 443 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

Fed9U descriptions.

Definition at line 413 of file SiStripConfigDb.h.

Cache for devices of given type.

Definition at line 431 of file SiStripConfigDb.h.

Cache for devices of given type.

Definition at line 425 of file SiStripConfigDb.h.

Definition at line 453 of file SiStripConfigDb.h.

Referenced by closeDbConnection(), and openDbConnection().

Cache for devices of given type.

Definition at line 434 of file SiStripConfigDb.h.

Cache for devices of given type.

Definition at line 440 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

Switch to enable/disable transfer of strip information.

Definition at line 450 of file SiStripConfigDb.h.

Referenced by usingStrips().