CMS 3D CMS Logo

List of all members | 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>

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, DcuDetIdDcuDetIds
 
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, RunsRunsByPartition
 
typedef std::map< sistrip::RunType, RunsRunsByType
 

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 deviceDescription &)
 
DeviceAddress deviceAddress (const AnalysisDescription &)
 
DeviceFactory *const deviceFactory (std::string method_name="") const
 
AnalysisDescriptionsRange getAnalysisDescriptions (AnalysisType, std::string partition="")
 
DcuDetIdsRange getDcuDetIds (std::string partition="")
 
DeviceDescriptionsRange getDeviceDescriptions (std::string partition="")
 
DeviceDescriptionsRange getDeviceDescriptions (DeviceType, 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 (Runs &) const
 
void runs (const Runs &in, RunsByType &out, std::string optional_partition="") const
 
void runs (const Runs &in, RunsByPartition &out, sistrip::RunType optional_type=sistrip::UNDEFINED_RUN_TYPE) 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 std::atomic< bool > allowCalibUpload_ {false}
 
static std::atomic< uint32_t > cntr_ {0}
 

Friends

class ApvTimingHistosUsingDb
 
class CalibrationHistosUsingDb
 
class CommissioningHistosUsingDb
 
class DaqScopeModeHistosUsingDb
 
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 47 of file SiStripConfigDb.h.

Member Typedef Documentation

◆ AnalysisDescription

typedef CommissioningAnalysisDescription SiStripConfigDb::AnalysisDescription
protected

Definition at line 132 of file SiStripConfigDb.h.

◆ AnalysisDescriptions

Definition at line 133 of file SiStripConfigDb.h.

◆ AnalysisDescriptionsRange

Definition at line 134 of file SiStripConfigDb.h.

◆ AnalysisDescriptionsV

Definition at line 135 of file SiStripConfigDb.h.

◆ AnalysisType

typedef CommissioningAnalysisDescription::commissioningType SiStripConfigDb::AnalysisType
protected

Definition at line 131 of file SiStripConfigDb.h.

◆ DcuDetId

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

Definition at line 125 of file SiStripConfigDb.h.

◆ DcuDetIdMap

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

Definition at line 124 of file SiStripConfigDb.h.

◆ DcuDetIds

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

Definition at line 126 of file SiStripConfigDb.h.

◆ DcuDetIdsRange

Definition at line 127 of file SiStripConfigDb.h.

◆ DcuDetIdsV

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

Definition at line 128 of file SiStripConfigDb.h.

◆ DeviceDescription

typedef deviceDescription SiStripConfigDb::DeviceDescription
protected

Definition at line 108 of file SiStripConfigDb.h.

◆ DeviceDescriptions

Definition at line 109 of file SiStripConfigDb.h.

◆ DeviceDescriptionsRange

Definition at line 110 of file SiStripConfigDb.h.

◆ DeviceDescriptionsV

Definition at line 111 of file SiStripConfigDb.h.

◆ DeviceType

typedef enumDeviceType SiStripConfigDb::DeviceType
protected

Definition at line 107 of file SiStripConfigDb.h.

◆ FedConnection

typedef ConnectionDescription SiStripConfigDb::FedConnection
protected

Definition at line 101 of file SiStripConfigDb.h.

◆ FedConnections

Definition at line 102 of file SiStripConfigDb.h.

◆ FedConnectionsRange

Definition at line 103 of file SiStripConfigDb.h.

◆ FedConnectionsV

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

Definition at line 104 of file SiStripConfigDb.h.

◆ FedDescription

typedef Fed9U::Fed9UDescription SiStripConfigDb::FedDescription
protected

Definition at line 114 of file SiStripConfigDb.h.

◆ FedDescriptions

Definition at line 115 of file SiStripConfigDb.h.

◆ FedDescriptionsRange

Definition at line 116 of file SiStripConfigDb.h.

◆ FedDescriptionsV

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

Definition at line 117 of file SiStripConfigDb.h.

◆ FedIds

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

Definition at line 120 of file SiStripConfigDb.h.

◆ FedIdsRange

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

Definition at line 121 of file SiStripConfigDb.h.

◆ Runs

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

Definition at line 187 of file SiStripConfigDb.h.

◆ RunsByPartition

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

Definition at line 191 of file SiStripConfigDb.h.

◆ RunsByType

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

Definition at line 189 of file SiStripConfigDb.h.

Constructor & Destructor Documentation

◆ SiStripConfigDb()

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 21 of file SiStripConfigDb.cc.

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

22  : factory_(nullptr),
23  dbCache_(nullptr),
24  dbParams_(),
25  // Local cache
26  connections_(),
27  devices_(),
28  feds_(),
29  dcuDetIds_(),
30  analyses_(),
31  apvDevices_(),
32  muxDevices_(),
33  dcuDevices_(),
34  lldDevices_(),
35  pllDevices_(),
36  dohDevices_(),
37  typedDevices_(),
38  fedIds_(),
39  // Misc
40  usingStrips_(true),
41  openConnection_(false) {
42  auto count = ++cntr_;
43  edm::LogVerbatim(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
44  << " Constructing database service..."
45  << " (Class instance: " << count << ")";
46 
47  // Set DB connection parameters
48  dbParams_.reset();
50  //edm::LogVerbatim(mlConfigDb_) << dbParams_;
51 
52  // Open connection
54 }
Log< level::Info, true > LogVerbatim
DeviceDescriptionsV apvDevices_
DeviceDescriptionsV typedDevices_
DeviceDescriptionsV dohDevices_
DeviceFactory * factory_
DeviceDescriptionsV lldDevices_
AnalysisDescriptions analyses_
FedConnections connections_
DeviceDescriptionsV pllDevices_
static const char mlConfigDb_[]
DeviceDescriptionsV dcuDevices_
static std::atomic< uint32_t > cntr_
FedDescriptions feds_
DeviceDescriptionsV muxDevices_
DeviceDescriptions devices_
void pset(const edm::ParameterSet &)
SiStripDbParams dbParams_
DbClient * dbCache_
DcuDetIds dcuDetIds_

◆ ~SiStripConfigDb()

SiStripConfigDb::~SiStripConfigDb ( )

Default destructor.

Definition at line 58 of file SiStripConfigDb.cc.

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

58  {
60  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
61  << " Destructing object...";
62  --cntr_;
63 }
#define LogTrace(id)
static const char mlConfigDb_[]
static std::atomic< uint32_t > cntr_

Member Function Documentation

◆ addAnalysisDescriptions()

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

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

Definition at line 164 of file AnalysisDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, contentValuesCheck::ss, and createJobs::tmp.

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

164  {
165  if (!deviceFactory(__func__)) {
166  return;
167  }
168 
169  if (partition.empty()) {
170  stringstream ss;
171  ss << "[SiStripConfigDb::" << __func__ << "]"
172  << " Partition string is empty,"
173  << " therefore cannot add analysis descriptions to local cache!";
174  edm::LogWarning(mlConfigDb_) << ss.str();
175  return;
176  }
177 
178  if (anals.empty()) {
179  stringstream ss;
180  ss << "[SiStripConfigDb::" << __func__ << "]"
181  << " Vector of analysis descriptions is empty,"
182  << " therefore cannot add analysis descriptions to local cache!";
183  edm::LogWarning(mlConfigDb_) << ss.str();
184  return;
185  }
186 
187  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
188  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
189  for (; iter != jter; ++iter) {
190  if (partition == iter->second.partitionName()) {
191  break;
192  }
193  }
194  if (iter == dbParams_.partitions().end()) {
195  stringstream ss;
196  ss << "[SiStripConfigDb::" << __func__ << "]"
197  << " Partition \"" << partition << "\" not found in partition list, "
198  << " therefore cannot add analysis descriptions!";
199  edm::LogWarning(mlConfigDb_) << ss.str();
200  return;
201  }
202 
204  if (range == analyses_.emptyRange()) {
205  // Make local copy
207  CommissioningAnalysisFactory::vectorCopy(anals, tmp);
208 
209  // Add to local cache
211 
212  // Some debug
213  std::stringstream ss;
214  ss << "[SiStripConfigDb::" << __func__ << "]"
215  << " Added " << anals.size() << " analysis descriptions to local cache for partition \"" << partition << "\"."
216  << " (Cache holds analysis descriptions for " << analyses_.size() << " partitions.)";
217  LogTrace(mlConfigDb_) << ss.str();
218  } else {
219  stringstream ss;
220  ss << "[SiStripConfigDb::" << __func__ << "]"
221  << " Partition \"" << partition << "\" already found in local cache, "
222  << " therefore cannot add analysis descriptions!";
223  edm::LogWarning(mlConfigDb_) << ss.str();
224  return;
225  }
226 }
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
AnalysisDescriptions analyses_
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
AnalysisDescriptions::range AnalysisDescriptionsRange
size_type size() const
Definition: MapOfVectors.h:94
SiStripDbParams dbParams_
std::vector< AnalysisDescription * > AnalysisDescriptionsV
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ addDcuDetIds()

void SiStripConfigDb::addDcuDetIds ( std::string  partition,
DcuDetIdsV dcus 
)
protected

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

Definition at line 110 of file DcuDetIds.cc.

References sistrip::mlConfigDb_, and contentValuesCheck::ss.

110  {
111  stringstream ss;
112  ss << "[SiStripConfigDb::" << __func__ << "]"
113  << " Cannot add to local cache! This functionality not allowed!";
114  edm::LogWarning(mlConfigDb_) << ss.str();
115 
116  // if ( !deviceFactory(__func__) ) { return; }
117 
118  // if ( partition.empty() ) {
119  // stringstream ss;
120  // ss << "[SiStripConfigDb::" << __func__ << "]"
121  // << " Partition string is empty,"
122  // << " therefore cannot add DCU-DetId map to local cache!";
123  // edm::LogWarning(mlConfigDb_) << ss.str();
124  // return;
125  // }
126 
127  // if ( dcus.empty() ) {
128  // stringstream ss;
129  // ss << "[SiStripConfigDb::" << __func__ << "]"
130  // << " Vector of DCU-DetId map is empty,"
131  // << " therefore cannot add DCU-DetId map to local cache!";
132  // edm::LogWarning(mlConfigDb_) << ss.str();
133  // return;
134  // }
135 
136  // SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
137  // SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
138  // for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
139  // if ( iter == dbParams_.partitions().end() ) {
140  // stringstream ss;
141  // ss << "[SiStripConfigDb::" << __func__ << "]"
142  // << " Partition \"" << partition
143  // << "\" not found in partition list, "
144  // << " therefore cannot add DCU-DetId map!";
145  // edm::LogWarning(mlConfigDb_) << ss.str();
146  // return;
147  // }
148 
149  // DcuDetIdsRange range = dcuDetIds_.find( partition );
150  // if ( range == dcuDetIds_.emptyRange() ) {
151 
152  // // Make local copy
153  // DcuDetIdsV dst;
154  // clone( dcus, dst );
155 
156  // // Add to local cache
157  // dcuDetIds_.loadNext( partition, dst );
158 
159  // // Some debug
160  // std::stringstream ss;
161  // ss << "[SiStripConfigDb::" << __func__ << "]"
162  // << " Added " << dst.size()
163  // << " DCU-DetId map to local cache for partition \""
164  // << partition << "\"" << std::endl;
165  // ss << "[SiStripConfigDb::" << __func__ << "]"
166  // << " Cache holds DCU-DetId map for "
167  // << dcuDetIds_.size() << " partitions.";
168  // LogTrace(mlConfigDb_) << ss.str();
169 
170  // } else {
171  // stringstream ss;
172  // ss << "[SiStripConfigDb::" << __func__ << "]"
173  // << " Partition \"" << partition
174  // << "\" already found in local cache, "
175  // << " therefore cannot add new DCU-DetId map!";
176  // edm::LogWarning(mlConfigDb_) << ss.str();
177  // return;
178  // }
179 }
static const char mlConfigDb_[]
Log< level::Warning, false > LogWarning

◆ addDeviceDescriptions()

void SiStripConfigDb::addDeviceDescriptions ( std::string  partition,
DeviceDescriptionsV devs 
)
protected

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

Definition at line 197 of file DeviceDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, contentValuesCheck::ss, and createJobs::tmp.

197  {
198  if (!deviceFactory(__func__)) {
199  return;
200  }
201 
202  if (partition.empty()) {
203  stringstream ss;
204  ss << "[SiStripConfigDb::" << __func__ << "]"
205  << " Partition string is empty,"
206  << " therefore cannot add device descriptions to local cache!";
207  edm::LogWarning(mlConfigDb_) << ss.str();
208  return;
209  }
210 
211  if (devs.empty()) {
212  stringstream ss;
213  ss << "[SiStripConfigDb::" << __func__ << "]"
214  << " Vector of device descriptions is empty,"
215  << " therefore cannot add device descriptions to local cache!";
216  edm::LogWarning(mlConfigDb_) << ss.str();
217  return;
218  }
219 
220  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
221  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
222  for (; iter != jter; ++iter) {
223  if (partition == iter->second.partitionName()) {
224  break;
225  }
226  }
227  if (iter == dbParams_.partitions().end()) {
228  stringstream ss;
229  ss << "[SiStripConfigDb::" << __func__ << "]"
230  << " Partition \"" << partition << "\" not found in partition list, "
231  << " therefore cannot add device descriptions!";
232  edm::LogWarning(mlConfigDb_) << ss.str();
233  return;
234  }
235 
237  if (range == devices_.emptyRange()) {
238  // Make local copy
240  FecFactory::vectorCopyI(tmp, devs, true);
241 
242  // Add to local cache
244 
245  // Some debug
246  std::stringstream ss;
247  ss << "[SiStripConfigDb::" << __func__ << "]"
248  << " Added " << devs.size() << " device descriptions to local cache for partition \"" << partition << "\"."
249  << " (Cache holds device descriptions for " << devices_.size() << " partitions.)";
250  LogTrace(mlConfigDb_) << ss.str();
251 
252  } else {
253  stringstream ss;
254  ss << "[SiStripConfigDb::" << __func__ << "]"
255  << " Partition \"" << partition << "\" already found in local cache, "
256  << " therefore cannot add device descriptions!";
257  edm::LogWarning(mlConfigDb_) << ss.str();
258  return;
259  }
260 }
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
DeviceDescriptions::range DeviceDescriptionsRange
size_type size() const
Definition: MapOfVectors.h:94
DeviceDescriptions devices_
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
std::vector< DeviceDescription * > DeviceDescriptionsV
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ addFedConnections()

void SiStripConfigDb::addFedConnections ( std::string  partition,
FedConnectionsV conns 
)
protected

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

Definition at line 127 of file FedConnections.cc.

References LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, contentValuesCheck::ss, and createJobs::tmp.

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

127  {
128  if (!deviceFactory(__func__)) {
129  return;
130  }
131 
132  if (partition.empty()) {
133  stringstream ss;
134  ss << "[SiStripConfigDb::" << __func__ << "]"
135  << " Partition string is empty,"
136  << " therefore cannot add FED connections to local cache!";
137  edm::LogWarning(mlConfigDb_) << ss.str();
138  return;
139  }
140 
141  if (conns.empty()) {
142  stringstream ss;
143  ss << "[SiStripConfigDb::" << __func__ << "]"
144  << " Vector of FED connections is empty,"
145  << " therefore cannot add FED connections to local cache!";
146  edm::LogWarning(mlConfigDb_) << ss.str();
147  return;
148  }
149 
150  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
151  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
152  for (; iter != jter; ++iter) {
153  if (partition == iter->second.partitionName()) {
154  break;
155  }
156  }
157  if (iter == dbParams_.partitions().end()) {
158  stringstream ss;
159  ss << "[SiStripConfigDb::" << __func__ << "]"
160  << " Partition \"" << partition << "\" not found in partition list, "
161  << " therefore cannot add FED connections!";
162  edm::LogWarning(mlConfigDb_) << ss.str();
163  return;
164  }
165 
167  if (range == connections_.emptyRange()) {
168  // Make local copy
170  ConnectionFactory::vectorCopyI(tmp, conns, true);
171 
172  // Add to local cache
174 
175  // Some debug
176  std::stringstream ss;
177  ss << "[SiStripConfigDb::" << __func__ << "]"
178  << " Added " << conns.size() << " FED connections to local cache for partition \"" << partition << "\""
179  << std::endl;
180  ss << "[SiStripConfigDb::" << __func__ << "]"
181  << " Cache holds FED connections for " << connections_.size() << " partitions.";
182  LogTrace(mlConfigDb_) << ss.str();
183 
184  } else {
185  stringstream ss;
186  ss << "[SiStripConfigDb::" << __func__ << "]"
187  << " Partition \"" << partition << "\" already found in local cache, "
188  << " therefore cannot add new FED connections!";
189  edm::LogWarning(mlConfigDb_) << ss.str();
190  return;
191  }
192 }
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
FedConnections connections_
#define LogTrace(id)
FedConnections::range FedConnectionsRange
static const char mlConfigDb_[]
size_type size() const
Definition: MapOfVectors.h:94
SiStripDbParams dbParams_
std::vector< FedConnection * > FedConnectionsV
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ addFedDescriptions()

void SiStripConfigDb::addFedDescriptions ( std::string  partition,
FedDescriptionsV feds 
)
protected

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

Definition at line 128 of file FedDescriptions.cc.

References l1tstage2emulator_dqm_sourceclient-live_cfg::feds, LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, contentValuesCheck::ss, and createJobs::tmp.

128  {
129  if (!deviceFactory(__func__)) {
130  return;
131  }
132 
133  if (partition.empty()) {
134  stringstream ss;
135  ss << "[SiStripConfigDb::" << __func__ << "]"
136  << " Partition string is empty,"
137  << " therefore cannot add FED descriptions to local cache!";
138  edm::LogWarning(mlConfigDb_) << ss.str();
139  return;
140  }
141 
142  if (feds.empty()) {
143  stringstream ss;
144  ss << "[SiStripConfigDb::" << __func__ << "]"
145  << " Vector of FED descriptions is empty,"
146  << " therefore cannot add FED descriptions to local cache!";
147  edm::LogWarning(mlConfigDb_) << ss.str();
148  return;
149  }
150 
151  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
152  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
153  for (; iter != jter; ++iter) {
154  if (partition == iter->second.partitionName()) {
155  break;
156  }
157  }
158  if (iter == dbParams_.partitions().end()) {
159  stringstream ss;
160  ss << "[SiStripConfigDb::" << __func__ << "]"
161  << " Partition \"" << partition << "\" not found in partition list, "
162  << " therefore cannot add FED descriptions!";
163  edm::LogWarning(mlConfigDb_) << ss.str();
164  return;
165  }
166 
168  if (range == feds_.emptyRange()) {
169  // Make local copy
171  Fed9U::Fed9UDeviceFactory::vectorCopy(tmp, feds);
172 
173  // Add to local cache
175 
176  // Some debug
177  std::stringstream ss;
178  ss << "[SiStripConfigDb::" << __func__ << "]"
179  << " Added " << feds.size() << " FED descriptions to local cache for partition \""
180  << iter->second.partitionName() << "\"" << std::endl;
181  ss << "[SiStripConfigDb::" << __func__ << "]"
182  << " Cache holds FED descriptions for " << feds_.size() << " partitions.";
183  LogTrace(mlConfigDb_) << ss.str();
184 
185  } else {
186  stringstream ss;
187  ss << "[SiStripConfigDb::" << __func__ << "]"
188  << " Partition \"" << partition << "\" already found in local cache, "
189  << " therefore cannot add new FED descriptions!";
190  edm::LogWarning(mlConfigDb_) << ss.str();
191  return;
192  }
193 }
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
FedDescriptions::range FedDescriptionsRange
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
FedDescriptions feds_
size_type size() const
Definition: MapOfVectors.h:94
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
std::vector< FedDescription * > FedDescriptionsV
tmp
align.sh
Definition: createJobs.py:716
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ analysisType()

std::string SiStripConfigDb::analysisType ( AnalysisType  analysis_type) const
protected

Returns string for given analysis type.

Definition at line 526 of file AnalysisDescriptions.cc.

526  {
527  if (analysis_type == AnalysisDescription::T_ANALYSIS_FASTFEDCABLING) {
528  return "FAST_CABLING";
529  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_TIMING) {
530  return "APV_TIMING";
531  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_OPTOSCAN) {
532  return "OPTO_SCAN";
533  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_PEDESTALS) {
534  return "PEDESTALS";
535  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_PEDSFULLNOISE) {
536  return "PEDSFULLNOISE";
537  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY) {
538  return "APV_LATENCY";
539  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_FINEDELAY) {
540  return "FINE_DELAY";
541  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_CALIBRATION) {
542  return "CALIBRATION";
543  } else if (analysis_type == AnalysisDescription::T_UNKNOWN) {
544  return "UNKNOWN ANALYSIS TYPE";
545  } else {
546  return "UNDEFINED ANALYSIS TYPE";
547  }
548 }

◆ checkFileExists()

bool SiStripConfigDb::checkFileExists ( const std::string &  path)
private

Checks whether file at "path" exists or not.

Definition at line 731 of file SiStripConfigDb.cc.

References compareTotals::fs, recoMuon::in, and castor_dqm_sourceclient_file_cfg::path.

Referenced by usingXmlFiles().

731  {
732  fstream fs;
733  fs.open(path.c_str(), ios::in);
734  if (!fs.is_open()) {
735  return false;
736  }
737  fs.close();
738  return true;
739 }

◆ clearAnalysisDescriptions()

void SiStripConfigDb::clearAnalysisDescriptions ( std::string  partition = "")
protected

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

Definition at line 337 of file AnalysisDescriptions.cc.

References edm::MapOfVectors< K, T >::loadNext(), LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

337  {
338  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
339 
340  if (analyses_.empty()) {
341  stringstream ss;
342  ss << "[SiStripConfigDb::" << __func__ << "]"
343  << " Found no cached analysis descriptions!";
344  //edm::LogWarning(mlConfigDb_) << ss.str();
345  return;
346  }
347 
348  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
349  AnalysisDescriptions temporary_cache;
350  if (partition.empty()) {
351  temporary_cache = AnalysisDescriptions();
352  } else {
353  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
354  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
355  for (; iter != jter; ++iter) {
356  if (partition != iter->second.partitionName()) {
357  AnalysisDescriptionsRange range = analyses_.find(iter->second.partitionName());
358  if (range != analyses_.emptyRange()) {
359  temporary_cache.loadNext(partition, AnalysisDescriptionsV(range.begin(), range.end()));
360  } else {
361  // stringstream ss;
362  // ss << "[SiStripConfigDb::" << __func__ << "]"
363  // << " Cannot find partition \"" << iter->second.partitionName()
364  // << "\" in local cache!";
365  // edm::LogWarning(mlConfigDb_) << ss.str();
366  }
367  }
368  }
369  }
370 
371  // Delete objects in local cache for specified partition (or all if not specified)
373  if (partition.empty()) {
374  if (!analyses_.empty()) {
375  anals =
376  AnalysisDescriptionsRange(analyses_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
377  analyses_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
378  } else {
379  anals = analyses_.emptyRange();
380  }
381  } else {
382  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
383  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
384  for (; iter != jter; ++iter) {
385  if (partition == iter->second.partitionName()) {
386  break;
387  }
388  }
389  anals = analyses_.find(iter->second.partitionName());
390  }
391 
392  if (anals != analyses_.emptyRange()) {
393  AnalysisDescriptionsV::const_iterator ianal = anals.begin();
394  AnalysisDescriptionsV::const_iterator janal = anals.end();
395  for (; ianal != janal; ++ianal) {
396  if (*ianal) {
397  delete *ianal;
398  }
399  }
400  } else {
401  stringstream ss;
402  ss << "[SiStripConfigDb::" << __func__ << "]";
403  if (partition.empty()) {
404  ss << " Found no analysis descriptions in local cache!";
405  } else {
406  ss << " Found no analysis descriptions in local cache for partition \"" << partition << "\"!";
407  }
408  edm::LogWarning(mlConfigDb_) << ss.str();
409  }
410 
411  // Overwrite local cache with temporary cache
412  analyses_ = temporary_cache;
413 }
range emptyRange() const
Definition: MapOfVectors.h:71
AnalysisDescriptions analyses_
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
edm::MapOfVectors< std::string, AnalysisDescription * > AnalysisDescriptions
bool empty() const
Definition: MapOfVectors.h:96
AnalysisDescriptions::range AnalysisDescriptionsRange
SiStripDbParams dbParams_
std::vector< AnalysisDescription * > AnalysisDescriptionsV
Log< level::Warning, false > LogWarning

◆ clearDcuDetIds()

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

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

Definition at line 270 of file DcuDetIds.cc.

References edm::MapOfVectors< K, T >::loadNext(), LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

Referenced by clearLocalCache().

270  {
271  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
272 
273  if (dcuDetIds_.empty()) {
274  stringstream ss;
275  ss << "[SiStripConfigDb::" << __func__ << "]"
276  << " Found no cached DCU-DetId map!";
277  //edm::LogWarning(mlConfigDb_) << ss.str();
278  return;
279  }
280 
281  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
282  DcuDetIds temporary_cache;
283  if (partition.empty()) {
284  temporary_cache = DcuDetIds();
285  } else {
286  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
287  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
288  for (; iter != jter; ++iter) {
289  if (partition != iter->second.partitionName()) {
290  DcuDetIdsRange range = dcuDetIds_.find(iter->second.partitionName());
291  if (range != dcuDetIds_.emptyRange()) {
292  temporary_cache.loadNext(partition, DcuDetIdsV(range.begin(), range.end()));
293  } else {
294  // stringstream ss;
295  // ss << "[SiStripConfigDb::" << __func__ << "]"
296  // << " Cannot find partition \"" << iter->second.partitionName()
297  // << "\" in local cache!";
298  // edm::LogWarning(mlConfigDb_) << ss.str();
299  }
300  }
301  }
302  }
303 
304  // Delete objects in local cache for specified partition (or all if not specified)
305  DcuDetIdsRange dcus;
306  if (partition.empty()) {
307  if (!dcuDetIds_.empty()) {
308  dcus = DcuDetIdsRange(dcuDetIds_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
309  dcuDetIds_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
310  } else {
311  dcus = dcuDetIds_.emptyRange();
312  }
313  } else {
314  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
315  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
316  for (; iter != jter; ++iter) {
317  if (partition == iter->second.partitionName()) {
318  break;
319  }
320  }
321  dcus = dcuDetIds_.find(iter->second.partitionName());
322  }
323 
324  if (dcus != dcuDetIds_.emptyRange()) {
325  DcuDetIdsV::const_iterator ifed = dcus.begin();
326  DcuDetIdsV::const_iterator jfed = dcus.end();
327  for (; ifed != jfed; ++ifed) {
328  if (ifed->second) {
329  delete ifed->second;
330  }
331  }
332  } else {
333  stringstream ss;
334  ss << "[SiStripConfigDb::" << __func__ << "]";
335  if (partition.empty()) {
336  ss << " Found no DCU-DetId map in local cache!";
337  } else {
338  ss << " Found no DCU-DetId map in local cache for partition \"" << partition << "\"!";
339  }
340  edm::LogWarning(mlConfigDb_) << ss.str();
341  }
342 
343  // Overwrite local cache with temporary cache
344  dcuDetIds_ = temporary_cache;
345 }
DcuDetIds::range DcuDetIdsRange
range emptyRange() const
Definition: MapOfVectors.h:71
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
edm::MapOfVectors< std::string, DcuDetId > DcuDetIds
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
std::vector< DcuDetId > DcuDetIdsV
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
DcuDetIds dcuDetIds_

◆ clearDeviceDescriptions()

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

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

Definition at line 335 of file DeviceDescriptions.cc.

References edm::MapOfVectors< K, T >::loadNext(), LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

335  {
336  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
337 
338  if (devices_.empty()) {
339  stringstream ss;
340  ss << "[SiStripConfigDb::" << __func__ << "]"
341  << " Found no cached device descriptions!";
342  //edm::LogWarning(mlConfigDb_) << ss.str();
343  return;
344  }
345 
346  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
347  DeviceDescriptions temporary_cache;
348  if (partition.empty()) {
349  temporary_cache = DeviceDescriptions();
350  } else {
351  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
352  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
353  for (; iter != jter; ++iter) {
354  if (partition != iter->second.partitionName()) {
355  DeviceDescriptionsRange range = devices_.find(iter->second.partitionName());
356  if (range != devices_.emptyRange()) {
357  temporary_cache.loadNext(partition, DeviceDescriptionsV(range.begin(), range.end()));
358  } else {
359  // stringstream ss;
360  // ss << "[SiStripConfigDb::" << __func__ << "]"
361  // << " Cannot find partition \"" << iter->second.partitionName()
362  // << "\" in local cache!";
363  // edm::LogWarning(mlConfigDb_) << ss.str();
364  }
365  }
366  }
367  }
368 
369  // Delete objects in local cache for specified partition (or all if not specified)
371  if (partition.empty()) {
372  if (!devices_.empty()) {
373  devs = DeviceDescriptionsRange(devices_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
374  devices_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
375  } else {
376  devs = devices_.emptyRange();
377  }
378  } else {
379  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
380  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
381  for (; iter != jter; ++iter) {
382  if (partition == iter->second.partitionName()) {
383  break;
384  }
385  }
386  devs = devices_.find(iter->second.partitionName());
387  }
388 
389  if (devs != devices_.emptyRange()) {
390  DeviceDescriptionsV::const_iterator ifed = devs.begin();
391  DeviceDescriptionsV::const_iterator jfed = devs.end();
392  for (; ifed != jfed; ++ifed) {
393  if (*ifed) {
394  delete *ifed;
395  }
396  }
397  } else {
398  stringstream ss;
399  ss << "[SiStripConfigDb::" << __func__ << "]";
400  if (partition.empty()) {
401  ss << " Found no device descriptions in local cache!";
402  } else {
403  ss << " Found no device descriptions in local cache for partition \"" << partition << "\"!";
404  }
405  edm::LogWarning(mlConfigDb_) << ss.str();
406  }
407 
408  // Overwrite local cache with temporary cache
409  devices_ = temporary_cache;
410 }
range emptyRange() const
Definition: MapOfVectors.h:71
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
edm::MapOfVectors< std::string, DeviceDescription * > DeviceDescriptions
#define LogTrace(id)
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
DeviceDescriptions::range DeviceDescriptionsRange
DeviceDescriptions devices_
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
std::vector< DeviceDescription * > DeviceDescriptionsV

◆ clearFedConnections()

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

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

Definition at line 269 of file FedConnections.cc.

References edm::MapOfVectors< K, T >::loadNext(), LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

269  {
270  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
271 
272  if (connections_.empty()) {
273  stringstream ss;
274  ss << "[SiStripConfigDb::" << __func__ << "]"
275  << " Found no cached FED connections!";
276  //edm::LogWarning(mlConfigDb_) << ss.str();
277  return;
278  }
279 
280  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
281  FedConnections temporary_cache;
282  if (partition.empty()) {
283  temporary_cache = FedConnections();
284  } else {
285  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
286  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
287  for (; iter != jter; ++iter) {
288  if (partition != iter->second.partitionName()) {
289  FedConnectionsRange range = connections_.find(iter->second.partitionName());
290  if (range != connections_.emptyRange()) {
291  temporary_cache.loadNext(partition, FedConnectionsV(range.begin(), range.end()));
292  } else {
293  // stringstream ss;
294  // ss << "[SiStripConfigDb::" << __func__ << "]"
295  // << " Cannot find partition \"" << iter->second.partitionName()
296  // << "\" in local cache!";
297  // edm::LogWarning(mlConfigDb_) << ss.str();
298  }
299  }
300  }
301  }
302 
303  // Delete objects in local cache for specified partition (or all if not specified)
304  FedConnectionsRange conns;
305  if (partition.empty()) {
306  if (!connections_.empty()) {
307  conns = FedConnectionsRange(connections_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
308  connections_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
309  } else {
310  conns = connections_.emptyRange();
311  }
312  } else {
313  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
314  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
315  for (; iter != jter; ++iter) {
316  if (partition == iter->second.partitionName()) {
317  break;
318  }
319  }
320  conns = connections_.find(iter->second.partitionName());
321  }
322 
323  if (conns != connections_.emptyRange()) {
324  FedConnectionsV::const_iterator ifed = conns.begin();
325  FedConnectionsV::const_iterator jfed = conns.end();
326  for (; ifed != jfed; ++ifed) {
327  if (*ifed) {
328  delete *ifed;
329  }
330  }
331  } else {
332  stringstream ss;
333  ss << "[SiStripConfigDb::" << __func__ << "]";
334  if (partition.empty()) {
335  ss << " Found no FED connections in local cache!";
336  } else {
337  ss << " Found no FED connections in local cache for partition \"" << partition << "\"!";
338  }
339  edm::LogWarning(mlConfigDb_) << ss.str();
340  }
341 
342  // Overwrite local cache with temporary cache
343  connections_ = temporary_cache;
344 }
range emptyRange() const
Definition: MapOfVectors.h:71
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
FedConnections connections_
#define LogTrace(id)
FedConnections::range FedConnectionsRange
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
SiStripDbParams dbParams_
std::vector< FedConnection * > FedConnectionsV
Log< level::Warning, false > LogWarning
edm::MapOfVectors< std::string, FedConnection * > FedConnections

◆ clearFedDescriptions()

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

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

Definition at line 268 of file FedDescriptions.cc.

References l1tstage2emulator_dqm_sourceclient-live_cfg::feds, edm::MapOfVectors< K, T >::loadNext(), LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

268  {
269  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
270 
271  if (feds_.empty()) {
272  stringstream ss;
273  ss << "[SiStripConfigDb::" << __func__ << "]"
274  << " Found no cached FED descriptions!";
275  //edm::LogWarning(mlConfigDb_) << ss.str();
276  return;
277  }
278 
279  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
280  FedDescriptions temporary_cache;
281  if (partition.empty()) {
282  temporary_cache = FedDescriptions();
283  } else {
284  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
285  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
286  for (; iter != jter; ++iter) {
287  if (partition != iter->second.partitionName()) {
288  FedDescriptionsRange range = feds_.find(iter->second.partitionName());
289  if (range != feds_.emptyRange()) {
290  temporary_cache.loadNext(partition, FedDescriptionsV(range.begin(), range.end()));
291  }
292  } else {
293  FedDescriptionsRange range = feds_.find(iter->second.partitionName());
294  if (range != feds_.emptyRange()) {
295  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
296  << " Deleting FED descriptions for partition \"" << iter->second.partitionName()
297  << "\" from local cache...";
298  }
299  }
300  }
301  }
302 
303  // Delete objects in local cache for specified partition (or all if not specified)
305  if (partition.empty()) {
306  if (!feds_.empty()) {
307  feds = FedDescriptionsRange(feds_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
308  feds_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
309  } else {
310  feds = feds_.emptyRange();
311  }
312  } else {
313  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
314  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
315  for (; iter != jter; ++iter) {
316  if (partition == iter->second.partitionName()) {
317  break;
318  }
319  }
320  feds = feds_.find(iter->second.partitionName());
321  }
322 
323  if (feds != feds_.emptyRange()) {
324  FedDescriptionsV::const_iterator ifed = feds.begin();
325  FedDescriptionsV::const_iterator jfed = feds.end();
326  for (; ifed != jfed; ++ifed) {
327  if (*ifed) {
328  delete *ifed;
329  }
330  }
331  } else {
332  stringstream ss;
333  ss << "[SiStripConfigDb::" << __func__ << "]";
334  if (partition.empty()) {
335  ss << " Found no FED descriptions in local cache!";
336  } else {
337  ss << " Found no FED descriptions in local cache for partition \"" << partition << "\"!";
338  }
339  edm::LogWarning(mlConfigDb_) << ss.str();
340  }
341 
342  // Overwrite local cache with temporary cache
343  feds_ = temporary_cache;
344 }
range emptyRange() const
Definition: MapOfVectors.h:71
FedDescriptions::range FedDescriptionsRange
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
FedDescriptions feds_
edm::MapOfVectors< std::string, FedDescription * > FedDescriptions
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
std::vector< FedDescription * > FedDescriptionsV

◆ clearLocalCache()

void SiStripConfigDb::clearLocalCache ( )
private

Definition at line 175 of file SiStripConfigDb.cc.

References clearAnalysisDescriptions(), clearDcuDetIds(), clearDeviceDescriptions(), clearFedConnections(), clearFedDescriptions(), fedIds_, LogTrace, sistrip::mlConfigDb_, and typedDevices_.

Referenced by closeDbConnection(), and openDbConnection().

175  {
176  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
177  << " Clearing local caches...";
178 
182  clearDcuDetIds();
184 
185  typedDevices_.clear();
186  fedIds_.clear();
187 }
DeviceDescriptionsV typedDevices_
void clearDeviceDescriptions(std::string partition="")
#define LogTrace(id)
static const char mlConfigDb_[]
void clearAnalysisDescriptions(std::string partition="")
void clearFedConnections(std::string partition="")
void clearDcuDetIds(std::string partition="")
Definition: DcuDetIds.cc:270
void clearFedDescriptions(std::string partition="")

◆ clone() [1/3]

void SiStripConfigDb::clone ( const DcuDetIdMap in,
DcuDetIdsV out 
) const
private

Definition at line 373 of file DcuDetIds.cc.

References cuy::ii, input, and findQualityFiles::jj.

373  {
374  output.clear();
375  DcuDetIdMap::const_iterator ii = input.begin();
376  DcuDetIdMap::const_iterator jj = input.end();
377  for (; ii != jj; ++ii) {
378  if (ii->second) {
379  output.push_back(std::make_pair(ii->first, new TkDcuInfo(*(ii->second))));
380  }
381  }
382 }
static std::string const input
Definition: EdmProvDump.cc:50
ii
Definition: cuy.py:589
Definition: output.py:1

◆ clone() [2/3]

void SiStripConfigDb::clone ( const DcuDetIdsV in,
DcuDetIdMap out 
) const
private

Definition at line 386 of file DcuDetIds.cc.

References cuy::ii, input, and findQualityFiles::jj.

386  {
387  output.clear();
388  DcuDetIdsV::const_iterator ii = input.begin();
389  DcuDetIdsV::const_iterator jj = input.end();
390  for (; ii != jj; ++ii) {
391  if (ii->second) {
392  output[ii->first] = new TkDcuInfo(*(ii->second));
393  }
394  }
395 }
static std::string const input
Definition: EdmProvDump.cc:50
ii
Definition: cuy.py:589
Definition: output.py:1

◆ clone() [3/3]

void SiStripConfigDb::clone ( const DcuDetIdsV in,
DcuDetIdsV out 
) const
private

Definition at line 399 of file DcuDetIds.cc.

References cuy::ii, input, and findQualityFiles::jj.

399  {
400  output.clear();
401  DcuDetIdsV::const_iterator ii = input.begin();
402  DcuDetIdsV::const_iterator jj = input.end();
403  for (; ii != jj; ++ii) {
404  if (ii->second) {
405  output.push_back(std::make_pair(ii->first, new TkDcuInfo(*(ii->second))));
406  }
407  }
408 }
static std::string const input
Definition: EdmProvDump.cc:50
ii
Definition: cuy.py:589
Definition: output.py:1

◆ closeDbConnection()

void SiStripConfigDb::closeDbConnection ( )
protected

Closes connection to DeviceFactory API.

Definition at line 136 of file SiStripConfigDb.cc.

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

Referenced by ~SiStripConfigDb().

136  {
137  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
138  << " Closing connection to database...";
139 
140  // Check if connection exists
141  if (!openConnection_) {
142  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
143  << " No connection open!";
144  return;
145  }
146  openConnection_ = false;
147 
148  // Clear local caches
149  clearLocalCache();
150 
151  try {
152  if (factory_) {
153  delete factory_;
154  }
155  } catch (...) {
156  handleException(__func__, "Attempting to delete DeviceFactory object...");
157  }
158  factory_ = nullptr;
159 
160  try {
161  if (dbCache_) {
162  delete dbCache_;
163  }
164  } catch (...) {
165  handleException(__func__, "Attempting to delete DbClient object...");
166  }
167  dbCache_ = nullptr;
168 
169  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
170  << " Closed connection to database...";
171 }
DeviceFactory * factory_
#define LogTrace(id)
static const char mlConfigDb_[]
void handleException(const std::string &method_name, const std::string &extra_info="") const
DbClient * dbCache_
Log< level::Warning, false > LogWarning

◆ databaseCache()

DbClient *const SiStripConfigDb::databaseCache ( std::string  method_name = "") const
protected

Returns pointer to DeviceFactory API, with check if NULL.

Definition at line 208 of file SiStripConfigDb.cc.

References dbCache_, sistrip::mlConfigDb_, and contentValuesCheck::ss.

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

208  {
209  if (dbCache_) {
210  return dbCache_;
211  } else {
212  if (!method_name.empty()) {
213  stringstream ss;
214  ss << "[SiStripConfigDb::" << __func__ << "]"
215  << " NULL pointer to DbClient requested by"
216  << " method SiStripConfigDb::" << method_name << "()!";
217  edm::LogWarning(mlConfigDb_) << ss.str();
218  }
219  return nullptr;
220  }
221 }
static const char mlConfigDb_[]
DbClient * dbCache_
Log< level::Warning, false > LogWarning

◆ dbParams()

const SiStripDbParams & SiStripConfigDb::dbParams ( ) const
inlineprotected

◆ deviceAddress() [1/2]

SiStripConfigDb::DeviceAddress SiStripConfigDb::deviceAddress ( const deviceDescription &  description)
protected

Extracts unique hardware address of device from description.

Definition at line 503 of file DeviceDescriptions.cc.

References generateTowerEtThresholdLUT::addr, submitPVResolutionJobs::desc, makeListRunsInFiles::description, sistrip::FEC_CRATE_OFFSET, sistrip::FEC_RING_OFFSET, and SiStripFecKey::lldChan().

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

503  {
504  deviceDescription& desc = const_cast<deviceDescription&>(description);
505 
506  DeviceAddress addr;
507  try {
508  addr.fecCrate_ = static_cast<uint16_t>(desc.getCrateId() + sistrip::FEC_CRATE_OFFSET); //@@ temporary offset?
509  addr.fecSlot_ = static_cast<uint16_t>(desc.getFecSlot());
510  addr.fecRing_ = static_cast<uint16_t>(desc.getRingSlot() + sistrip::FEC_RING_OFFSET); //@@ temporary offset?
511  addr.ccuAddr_ = static_cast<uint16_t>(desc.getCcuAddress());
512  addr.ccuChan_ = static_cast<uint16_t>(desc.getChannel());
513  addr.lldChan_ = static_cast<uint16_t>(SiStripFecKey::lldChan(desc.getAddress()));
514  addr.i2cAddr_ = static_cast<uint16_t>(desc.getAddress());
515  } catch (...) {
516  handleException(__func__);
517  }
518 
519  return addr;
520 }
static const uint16_t FEC_RING_OFFSET
const uint16_t & lldChan() const
void handleException(const std::string &method_name, const std::string &extra_info="") const
static const uint16_t FEC_CRATE_OFFSET

◆ deviceAddress() [2/2]

SiStripConfigDb::DeviceAddress SiStripConfigDb::deviceAddress ( const AnalysisDescription desc)
protected

Extracts unique hardware address of device from description.

Definition at line 504 of file AnalysisDescriptions.cc.

References generateTowerEtThresholdLUT::addr, submitPVResolutionJobs::desc, sistrip::FEC_CRATE_OFFSET, sistrip::FEC_RING_OFFSET, and SiStripFecKey::lldChan().

504  {
505  DeviceAddress addr;
506  try {
507  addr.fecCrate_ = static_cast<uint16_t>(desc.getCrate() + sistrip::FEC_CRATE_OFFSET);
508  addr.fecSlot_ = static_cast<uint16_t>(desc.getSlot());
509  addr.fecRing_ = static_cast<uint16_t>(desc.getRing() + sistrip::FEC_RING_OFFSET);
510  addr.ccuAddr_ = static_cast<uint16_t>(desc.getCcuAdr());
511  addr.ccuChan_ = static_cast<uint16_t>(desc.getCcuChan());
512  addr.lldChan_ = static_cast<uint16_t>(SiStripFecKey::lldChan(desc.getI2cAddr()));
513  addr.i2cAddr_ = static_cast<uint16_t>(desc.getI2cAddr());
514  addr.fedId_ = static_cast<uint16_t>(desc.getFedId()); //@@ offset required? crate/slot needed?
515  addr.feUnit_ = static_cast<uint16_t>(desc.getFeUnit());
516  addr.feChan_ = static_cast<uint16_t>(desc.getFeChan());
517  } catch (...) {
518  handleException(__func__);
519  }
520 
521  return addr;
522 }
static const uint16_t FEC_RING_OFFSET
const uint16_t & lldChan() const
void handleException(const std::string &method_name, const std::string &extra_info="") const
static const uint16_t FEC_CRATE_OFFSET

◆ deviceFactory()

DeviceFactory *const SiStripConfigDb::deviceFactory ( std::string  method_name = "") const
protected

Returns pointer to DeviceFactory API, with check if NULL.

Definition at line 191 of file SiStripConfigDb.cc.

References factory_, sistrip::mlConfigDb_, and contentValuesCheck::ss.

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

191  {
192  if (factory_) {
193  return factory_;
194  } else {
195  if (!method_name.empty()) {
196  stringstream ss;
197  ss << "[SiStripConfigDb::" << __func__ << "]"
198  << " NULL pointer to DeviceFactory requested by"
199  << " method SiStripConfigDb::" << method_name << "()!";
200  edm::LogWarning(mlConfigDb_) << ss.str();
201  }
202  return nullptr;
203  }
204 }
DeviceFactory * factory_
static const char mlConfigDb_[]
Log< level::Warning, false > LogWarning

◆ deviceType()

string SiStripConfigDb::deviceType ( const enumDeviceType &  device_type) const
private

Returns device identifier based on device type.

Definition at line 524 of file DeviceDescriptions.cc.

524  {
525  if (device_type == PLL) {
526  return "PLL";
527  } else if (device_type == LASERDRIVER) {
528  return "LLD";
529  } else if (device_type == DOH) {
530  return "DOH";
531  } else if (device_type == APVMUX) {
532  return "MUX";
533  } else if (device_type == APV25) {
534  return "APV";
535  } else if (device_type == DCU) {
536  return "DCU";
537  } else if (device_type == GOH) {
538  return "GOH";
539  } else {
540  return "UNKNOWN DEVICE!";
541  }
542 }

◆ findDcuDetId() [1/2]

SiStripConfigDb::DcuDetIdsV::const_iterator SiStripConfigDb::findDcuDetId ( DcuDetIdsV::const_iterator  begin,
DcuDetIdsV::const_iterator  end,
uint32_t  dcu_id 
)
staticprotected

Utility method.

Definition at line 412 of file DcuDetIds.cc.

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

414  {
415  DcuDetIdsV::const_iterator iter = begin;
416  DcuDetIdsV::const_iterator jter = end;
417  for (; iter != jter; ++iter) {
418  if (iter->second && iter->second->getDcuHardId() == dcu_id) {
419  return iter;
420  }
421  }
422  return end;
423 }

◆ findDcuDetId() [2/2]

SiStripConfigDb::DcuDetIdsV::iterator SiStripConfigDb::findDcuDetId ( DcuDetIdsV::iterator  begin,
DcuDetIdsV::iterator  end,
uint32_t  dcu_id 
)
staticprotected

Utility method.

Definition at line 427 of file DcuDetIds.cc.

429  {
430  DcuDetIdsV::iterator iter = begin;
431  DcuDetIdsV::iterator jter = end;
432  for (; iter != jter; ++iter) {
433  if (iter->second && iter->second->getDcuHardId() == dcu_id) {
434  return iter;
435  }
436  }
437  return end;
438 }

◆ getAnalysisDescriptions()

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 20 of file AnalysisDescriptions.cc.

References SiStripPartition::defaultPartitionName_, LogTrace, sistrip::mlConfigDb_, np, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

21  {
22  // Check
23  if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
24  (dbParams_.usingDbCache() && !databaseCache(__func__))) {
25  return analyses_.emptyRange();
26  }
27 
28  try {
29  if (!dbParams_.usingDbCache()) {
30  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
31  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
32  for (; iter != jter; ++iter) {
33  if (partition.empty() || partition == iter->second.partitionName()) {
34  if (iter->second.partitionName() == SiStripPartition::defaultPartitionName_) {
35  continue;
36  }
37 
38  AnalysisDescriptionsRange range = analyses_.find(iter->second.partitionName());
39  if (range == analyses_.emptyRange()) {
41  if (analysis_type == AnalysisDescription::T_ANALYSIS_FASTFEDCABLING) {
42  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
43  iter->second.fastCablingVersion().first,
44  iter->second.fastCablingVersion().second,
45  analysis_type);
46  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_TIMING) {
47  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
48  iter->second.apvTimingVersion().first,
49  iter->second.apvTimingVersion().second,
50  analysis_type);
51  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_OPTOSCAN) {
52  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
53  iter->second.optoScanVersion().first,
54  iter->second.optoScanVersion().second,
55  analysis_type);
56  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_VPSPSCAN) {
57  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
58  iter->second.vpspScanVersion().first,
59  iter->second.vpspScanVersion().second,
60  analysis_type);
61  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_CALIBRATION) {
62  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
63  iter->second.apvCalibVersion().first,
64  iter->second.apvCalibVersion().second,
65  analysis_type);
66  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_PEDESTALS) {
67  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
68  iter->second.pedestalsVersion().first,
69  iter->second.pedestalsVersion().second,
70  analysis_type);
71  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_PEDSFULLNOISE) {
72  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
73  iter->second.pedestalsVersion().first,
74  iter->second.pedestalsVersion().second,
75  analysis_type);
76  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY) {
77  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
78  iter->second.apvLatencyVersion().first,
79  iter->second.apvLatencyVersion().second,
80  analysis_type);
81  } else if (analysis_type == AnalysisDescription::T_ANALYSIS_FINEDELAY) {
82  tmp1 = deviceFactory(__func__)->getAnalysisHistory(iter->second.partitionName(),
83  iter->second.fineDelayVersion().first,
84  iter->second.fineDelayVersion().second,
85  analysis_type);
86  } else {
87  std::stringstream ss;
88  ss << "[SiStripConfigDb::" << __func__ << "]"
89  << " Unexpected analysis type \"" << analysisType(analysis_type) << "\"! Aborting download...";
90  edm::LogWarning(mlConfigDb_) << ss.str();
91  return analyses_.emptyRange();
92  }
93 
94  // Make local copy
96  CommissioningAnalysisFactory::vectorCopy(tmp1, tmp2);
97 
98  // Add to cache
99  analyses_.loadNext(iter->second.partitionName(), tmp2);
100 
101  // Some debug
102  AnalysisDescriptionsRange anals = analyses_.find(iter->second.partitionName());
103  std::stringstream ss;
104  ss << "[SiStripConfigDb::" << __func__ << "]"
105  << " Downloaded " << anals.size() << " analysis descriptions of type \"" << analysisType(analysis_type)
106  << "\" to local cache for partition \"" << iter->second.partitionName() << "\"" << std::endl;
107  ss << "[SiStripConfigDb::" << __func__ << "]"
108  << " Cache holds analysis descriptions for " << analyses_.size() << " partitions.";
109  LogTrace(mlConfigDb_) << ss.str();
110  }
111  }
112  }
113 
114  } else { // Use database cache
115  std::stringstream ss;
116  ss << "[SiStripConfigDb::" << __func__ << "]"
117  << " No database cache for analysis objects!";
118  edm::LogWarning(mlConfigDb_) << ss.str();
119  }
120 
121  } catch (...) {
122  handleException(__func__);
123  }
124 
125  // Create range object
126  uint16_t np = 0;
127  uint16_t nc = 0;
129  if (!partition.empty()) {
130  anals = analyses_.find(partition);
131  np = 1;
132  nc = anals.size();
133  } else {
134  if (!analyses_.empty()) {
135  anals =
136  AnalysisDescriptionsRange(analyses_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
137  analyses_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
138  } else {
139  anals = analyses_.emptyRange();
140  }
141  np = analyses_.size();
142  nc = anals.size();
143  }
144 
145  stringstream ss;
146  ss << "[SiStripConfigDb::" << __func__ << "]"
147  << " Found " << nc << " analysis descriptions";
148  if (!dbParams_.usingDbCache()) {
149  ss << " in " << np << " database partition(s)";
150  } else {
151  ss << " from shared memory name '" << dbParams_.sharedMemory() << "'";
152  }
153  if (analyses_.empty()) {
154  edm::LogWarning(mlConfigDb_) << ss.str();
155  } else {
156  LogTrace(mlConfigDb_) << ss.str();
157  }
158 
159  return anals;
160 }
static const std::string defaultPartitionName_
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
DbClient *const databaseCache(std::string method_name="") const
AnalysisDescriptions analyses_
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
int np
Definition: AMPTWrapper.h:43
bool empty() const
Definition: MapOfVectors.h:96
std::string analysisType(AnalysisType) const
AnalysisDescriptions::range AnalysisDescriptionsRange
size_type size() const
Definition: MapOfVectors.h:94
void handleException(const std::string &method_name, const std::string &extra_info="") const
std::string sharedMemory() const
SiStripDbParams dbParams_
std::vector< AnalysisDescription * > AnalysisDescriptionsV
Log< level::Warning, false > LogWarning
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ getDcuDetIds()

SiStripConfigDb::DcuDetIdsRange SiStripConfigDb::getDcuDetIds ( std::string  partition = "")
protected

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

Definition at line 10 of file DcuDetIds.cc.

References clone(), SiStripPartition::defaultPartitionName_, math::cholesky::dst, LogTrace, sistrip::mlConfigDb_, np, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, TrackRefitter_38T_cff::src, and contentValuesCheck::ss.

Referenced by FastFedCablingHistosUsingDb::addDcuDetIds(), CommissioningHistosUsingDb::buildDetInfo(), and FastFedCablingHistosUsingDb::uploadConfigurations().

10  {
11  // Check
12  if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
13  (dbParams_.usingDbCache() && !databaseCache(__func__))) {
14  return dcuDetIds_.emptyRange();
15  }
16 
17  try {
18  if (!dbParams_.usingDbCache()) {
19  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
20  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
21  for (; iter != jter; ++iter) {
22  if (partition.empty() || partition == iter->second.partitionName()) {
23  if (iter->second.partitionName() == SiStripPartition::defaultPartitionName_) {
24  continue;
25  }
26 
27  DcuDetIdsRange range = dcuDetIds_.find(iter->second.partitionName());
28  if (range == dcuDetIds_.emptyRange()) {
29  deviceFactory(__func__)->addDetIdPartition(
30  iter->second.partitionName(), iter->second.dcuVersion().first, iter->second.dcuVersion().second);
31 
32  // Retrieve DCU-DetId map
33  DcuDetIdMap src = deviceFactory(__func__)->getInfos();
34 
35  // Make local copy
37  clone(src, dst);
38 
39  // Add to cache
40  dcuDetIds_.loadNext(iter->second.partitionName(), dst);
41  }
42  }
43  }
44 
45  } else { // Using database cache
46 
47  // Retrieve DCU-DetId map
48  DcuDetIdMap* src = databaseCache(__func__)->getInfos();
49 
50  if (src) {
51  // Make local copy
53  clone(*src, dst);
54 
55  // Add to cache
57 
58  } else {
59  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
60  << " NULL pointer to Dcu-DetId map!";
61  }
62  }
63 
64  } catch (...) {
65  handleException(__func__);
66  }
67 
68  // Create range object
69  uint16_t np = 0;
70  uint16_t nc = 0;
72  if (!partition.empty()) {
74  np = 1;
75  nc = range.size();
76  } else {
77  if (!dcuDetIds_.empty()) {
78  range = DcuDetIdsRange(dcuDetIds_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
79  dcuDetIds_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
80  } else {
82  }
83  np = dcuDetIds_.size();
84  nc = range.size();
85  }
86 
87  stringstream ss;
88  ss << "[SiStripConfigDb::" << __func__ << "]"
89  << " Found " << nc << " entries in DCU-DetId map";
90  if (!dbParams_.usingDb()) {
91  ss << " in " << dbParams_.inputDcuInfoXmlFiles().size() << " 'module.xml' file(s)";
92  } else {
93  if (!dbParams_.usingDbCache()) {
94  ss << " in " << np << " database partition(s)";
95  } else {
96  ss << " from shared memory name '" << dbParams_.sharedMemory() << "'";
97  }
98  }
99  if (dcuDetIds_.empty()) {
100  edm::LogWarning(mlConfigDb_) << ss.str();
101  } else {
102  LogTrace(mlConfigDb_) << ss.str();
103  }
104 
105  return range;
106 }
bool usingDb() const
static const std::string defaultPartitionName_
DcuDetIds::range DcuDetIdsRange
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
DbClient *const databaseCache(std::string method_name="") const
Sgi::hash_map< unsigned long, TkDcuInfo * > DcuDetIdMap
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
int np
Definition: AMPTWrapper.h:43
bool empty() const
Definition: MapOfVectors.h:96
std::vector< std::string > inputDcuInfoXmlFiles() const
std::vector< DcuDetId > DcuDetIdsV
size_type size() const
Definition: MapOfVectors.h:94
constexpr void M2 & dst
void handleException(const std::string &method_name, const std::string &extra_info="") const
std::string sharedMemory() const
SiStripDbParams dbParams_
void clone(const DcuDetIdMap &in, DcuDetIdsV &out) const
Definition: DcuDetIds.cc:373
Log< level::Warning, false > LogWarning
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const
DcuDetIds dcuDetIds_

◆ getDeviceDescriptions() [1/2]

SiStripConfigDb::DeviceDescriptionsRange SiStripConfigDb::getDeviceDescriptions ( std::string  partition = "")
protected

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

Definition at line 11 of file DeviceDescriptions.cc.

References SiStripPartition::defaultPartitionName_, LogTrace, sistrip::mlConfigDb_, np, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

11  {
12  // Check
13  if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
14  (dbParams_.usingDbCache() && !databaseCache(__func__))) {
15  return devices_.emptyRange();
16  }
17 
18  try {
19  if (!dbParams_.usingDbCache()) {
20  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
21  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
22  for (; iter != jter; ++iter) {
23  if (partition.empty() || partition == iter->second.partitionName()) {
24  if (iter->second.partitionName() == SiStripPartition::defaultPartitionName_) {
25  continue;
26  }
27 
28  DeviceDescriptionsRange range = devices_.find(iter->second.partitionName());
29  if (range == devices_.emptyRange()) {
30  // Retrieve conections
32  deviceFactory(__func__)->getFecDeviceDescriptions(iter->second.partitionName(),
33  tmp1,
34  iter->second.fecVersion().first,
35  iter->second.fecVersion().second,
36  //#ifdef USING_DATABASE_MASKING
37  iter->second.maskVersion().first,
38  iter->second.maskVersion().second,
39  //#endif
40  false); //@@ do not get DISABLED devices
41 
42  // Make local copy
44  FecFactory::vectorCopyI(tmp2, tmp1, true);
45 
46  // Add to cache
47  devices_.loadNext(iter->second.partitionName(), tmp2);
48 
49  // Some debug
50  DeviceDescriptionsRange range = devices_.find(iter->second.partitionName());
51  std::stringstream ss;
52  ss << "[SiStripConfigDb::" << __func__ << "]"
53  << " Downloaded " << range.size() << " device descriptions to local cache for partition \""
54  << iter->second.partitionName() << "\"" << std::endl;
55  ss << "[SiStripConfigDb::" << __func__ << "]"
56  << " Cache holds device descriptions for " << devices_.size() << " partitions.";
57  LogTrace(mlConfigDb_) << ss.str();
58  }
59  }
60  }
61 
62  } else { // Using database cache
63 
64  DeviceDescriptionsV* tmp1 = databaseCache(__func__)->getDevices();
65 
66  if (tmp1) {
67  // Make local copy
69  FecFactory::vectorCopyI(tmp2, *tmp1, true);
70 
71  // Add to cache
73 
74  } else {
75  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
76  << " NULL pointer to DeviceDescriptions vector!";
77  }
78  }
79 
80  } catch (...) {
81  handleException(__func__);
82  }
83 
84  // Create range object
85  uint16_t np = 0;
86  uint16_t nc = 0;
88  if (!partition.empty()) {
89  devs = devices_.find(partition);
90  np = 1;
91  nc = devs.size();
92  } else {
93  if (!devices_.empty()) {
94  devs = DeviceDescriptionsRange(devices_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
95  devices_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
96  } else {
97  devs = devices_.emptyRange();
98  }
99  np = devices_.size();
100  nc = devs.size();
101  }
102 
103  stringstream ss;
104  ss << "[SiStripConfigDb::" << __func__ << "]"
105  << " Found " << nc << " device descriptions";
106  if (!dbParams_.usingDb()) {
107  ss << " in " << dbParams_.inputFecXmlFiles().size() << " 'fec.xml' file(s)";
108  } else {
109  if (!dbParams_.usingDbCache()) {
110  ss << " in " << np << " database partition(s)";
111  } else {
112  ss << " from shared memory name '" << dbParams_.sharedMemory() << "'";
113  }
114  }
115  if (devices_.empty()) {
116  edm::LogWarning(mlConfigDb_) << ss.str();
117  } else {
118  LogTrace(mlConfigDb_) << ss.str();
119  }
120 
121  return devs;
122 }
bool usingDb() const
static const std::string defaultPartitionName_
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
DbClient *const databaseCache(std::string method_name="") const
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
int np
Definition: AMPTWrapper.h:43
bool empty() const
Definition: MapOfVectors.h:96
DeviceDescriptions::range DeviceDescriptionsRange
size_type size() const
Definition: MapOfVectors.h:94
void handleException(const std::string &method_name, const std::string &extra_info="") const
std::string sharedMemory() const
DeviceDescriptions devices_
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
std::vector< std::string > inputFecXmlFiles() const
std::vector< DeviceDescription * > DeviceDescriptionsV
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ getDeviceDescriptions() [2/2]

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 126 of file DeviceDescriptions.cc.

References getDeviceDescriptions(), LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, contentValuesCheck::ss, and createJobs::tmp.

127  {
128  typedDevices_.clear();
129  apvDevices_.clear();
130  muxDevices_.clear();
131  dcuDevices_.clear();
132  lldDevices_.clear();
133  pllDevices_.clear();
134  dohDevices_.clear();
135 
137 
138  if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
139  (dbParams_.usingDbCache() && !databaseCache(__func__))) {
140  return tmp;
141  }
142 
143  try {
145  if (!devs.empty()) {
146  DeviceDescriptionsV tmp(devs.begin(), devs.end());
147  typedDevices_ = FecFactory::getDeviceFromDeviceVector(tmp, device_type);
148  }
149  } catch (...) {
150  handleException(__func__);
151  }
152 
153  if (device_type == APV25) {
156  } else if (device_type == APVMUX) {
159  } else if (device_type == DCU) {
162  } else if (device_type == LASERDRIVER) {
165  } else if (device_type == PLL) {
168  } else if (device_type == DOH) {
171  } else {
173  }
174 
175  // stringstream sss;
176  // sss << " Number of devices:"
177  // << " TYP: " << typedDevices_.size()
178  // << " APV: " << apvDevices_.size()
179  // << " MUX: " << muxDevices_.size()
180  // << " DCU: " << dcuDevices_.size()
181  // << " LLD: " << lldDevices_.size()
182  // << " PLL: " << pllDevices_.size()
183  // << " DOH: " << dohDevices_.size()
184  // << " tmp: " << tmp.size();
185  // LogTrace(mlConfigDb_) << sss.str();
186 
187  stringstream ss;
188  ss << "[SiStripConfigDb::" << __func__ << "]"
189  << " Extracted " << tmp.size() << " device descriptions (for devices of type " << deviceType(device_type) << ")";
190  LogTrace(mlConfigDb_) << ss.str();
191 
192  return tmp;
193 }
DeviceDescriptionsV apvDevices_
DeviceDescriptionsV typedDevices_
DeviceDescriptionsV dohDevices_
DeviceDescriptionsV lldDevices_
DbClient *const databaseCache(std::string method_name="") const
DeviceDescriptionsV pllDevices_
#define LogTrace(id)
static const char mlConfigDb_[]
DeviceDescriptionsV dcuDevices_
DeviceDescriptions::range DeviceDescriptionsRange
void handleException(const std::string &method_name, const std::string &extra_info="") const
DeviceDescriptionsV muxDevices_
SiStripDbParams dbParams_
std::string deviceType(const enumDeviceType &device_type) const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
tmp
align.sh
Definition: createJobs.py:716
std::vector< DeviceDescription * > DeviceDescriptionsV
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ getFedConnections()

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

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

Definition at line 11 of file FedConnections.cc.

References SiStripPartition::defaultPartitionName_, LogTrace, sistrip::mlConfigDb_, np, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

11  {
12  // Check
13  if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
14  (dbParams_.usingDbCache() && !databaseCache(__func__))) {
15  return connections_.emptyRange();
16  }
17 
18  try {
19  if (!dbParams_.usingDbCache()) {
20  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
21  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
22  for (; iter != jter; ++iter) {
23  if (partition.empty() || partition == iter->second.partitionName()) {
24  if (iter->second.partitionName() == SiStripPartition::defaultPartitionName_) {
25  continue;
26  }
27 
28  FedConnectionsRange range = connections_.find(iter->second.partitionName());
29  if (range == connections_.emptyRange()) {
30  FedConnectionsV tmp2;
31 
32  // Retrieve connections
33  FedConnectionsV tmp1;
34  deviceFactory(__func__)->getConnectionDescriptions(iter->second.partitionName(),
35  tmp1,
36  iter->second.cabVersion().first,
37  iter->second.cabVersion().second,
38  //#ifdef USING_DATABASE_MASKING
39  iter->second.maskVersion().first,
40  iter->second.maskVersion().second,
41  //#endif
42  false); //@@ do not get DISABLED connections
43 
44  // Make local copy
45  ConnectionFactory::vectorCopyI(tmp2, tmp1, true);
46 
47  // Add to cache
48  connections_.loadNext(iter->second.partitionName(), tmp2);
49 
50  // Some debug
51  FedConnectionsRange conns = connections_.find(iter->second.partitionName());
52  std::stringstream ss;
53  ss << "[SiStripConfigDb::" << __func__ << "]"
54  << " Downloaded " << conns.size() << " FED connections to local cache for partition \""
55  << iter->second.partitionName() << "\"" << std::endl;
56  ss << "[SiStripConfigDb::" << __func__ << "]"
57  << " Cache holds FED connections for " << connections_.size() << " partitions.";
58  LogTrace(mlConfigDb_) << ss.str();
59  }
60  }
61  }
62 
63  } else { // Use database cache
64 
65  FedConnectionsV* tmp1 = databaseCache(__func__)->getConnections();
66 
67  if (tmp1) {
68  // Make local copy
69  FedConnectionsV tmp2;
70  ConnectionFactory::vectorCopyI(tmp2, *tmp1, true);
71 
72  // Add to cache
74 
75  } else {
76  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
77  << " NULL pointer to FedConnections vector!";
78  }
79  }
80 
81  } catch (...) {
82  handleException(__func__);
83  }
84 
85  // Create range object
86  uint16_t np = 0;
87  uint16_t nc = 0;
88  FedConnectionsRange conns;
89  if (!partition.empty()) {
90  conns = connections_.find(partition);
91  np = 1;
92  nc = conns.size();
93  } else {
94  if (!connections_.empty()) {
95  conns = FedConnectionsRange(connections_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
96  connections_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
97  } else {
98  conns = connections_.emptyRange();
99  }
100  np = connections_.size();
101  nc = conns.size();
102  }
103 
104  stringstream ss;
105  ss << "[SiStripConfigDb::" << __func__ << "]"
106  << " Found " << nc << " FED connections";
107  if (!dbParams_.usingDb()) {
108  ss << " in " << dbParams_.inputModuleXmlFiles().size() << " 'module.xml' file(s)";
109  } else {
110  if (!dbParams_.usingDbCache()) {
111  ss << " in " << np << " database partition(s)";
112  } else {
113  ss << " from shared memory name '" << dbParams_.sharedMemory() << "'";
114  }
115  }
116  if (connections_.empty()) {
117  edm::LogWarning(mlConfigDb_) << ss.str();
118  } else {
119  LogTrace(mlConfigDb_) << ss.str();
120  }
121 
122  return conns;
123 }
bool usingDb() const
static const std::string defaultPartitionName_
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
DbClient *const databaseCache(std::string method_name="") const
std::vector< std::string > inputModuleXmlFiles() const
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
FedConnections connections_
#define LogTrace(id)
FedConnections::range FedConnectionsRange
static const char mlConfigDb_[]
int np
Definition: AMPTWrapper.h:43
bool empty() const
Definition: MapOfVectors.h:96
size_type size() const
Definition: MapOfVectors.h:94
void handleException(const std::string &method_name, const std::string &extra_info="") const
std::string sharedMemory() const
SiStripDbParams dbParams_
std::vector< FedConnection * > FedConnectionsV
Log< level::Warning, false > LogWarning
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ getFedDescriptions()

SiStripConfigDb::FedDescriptionsRange SiStripConfigDb::getFedDescriptions ( std::string  partition = "")
protected

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

Definition at line 12 of file FedDescriptions.cc.

References SiStripPartition::defaultPartitionName_, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, LogTrace, sistrip::mlConfigDb_, np, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

12  {
13  // Check
14  if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
15  (dbParams_.usingDbCache() && !databaseCache(__func__))) {
16  return feds_.emptyRange();
17  }
18 
19  try {
20  if (!dbParams_.usingDbCache()) {
21  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
22  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
23  for (; iter != jter; ++iter) {
24  if (partition.empty() || partition == iter->second.partitionName()) {
25  if (iter->second.partitionName() == SiStripPartition::defaultPartitionName_) {
26  continue;
27  }
28 
29  FedDescriptionsRange range = feds_.find(iter->second.partitionName());
30  if (range == feds_.emptyRange()) {
31  // Extract versions
32  deviceFactory(__func__)->setUsingStrips(usingStrips_);
33  int16_t major = iter->second.fedVersion().first;
34  int16_t minor = iter->second.fedVersion().second;
35  if (iter->second.fedVersion().first == 0 && iter->second.fedVersion().second == 0) {
36  major = -1; //@@ "current state" for fed factory!
37  minor = -1; //@@ "current state" for fed factory!
38  }
39 
40  // Retrive FED descriptions
41  FedDescriptionsV tmp1;
42  tmp1 = *(deviceFactory(__func__)->getFed9UDescriptions(iter->second.partitionName(), major, minor));
43 
44  // Make local copy
45  FedDescriptionsV tmp2;
46  Fed9U::Fed9UDeviceFactory::vectorCopy(tmp2, tmp1);
47 
48  // Add to cache
49  feds_.loadNext(iter->second.partitionName(), tmp2);
50 
51  // Some debug
52  FedDescriptionsRange feds = feds_.find(iter->second.partitionName());
53  std::stringstream ss;
54  ss << "[SiStripConfigDb::" << __func__ << "]"
55  << " Downloaded " << feds.size() << " FED descriptions to local cache for partition \""
56  << iter->second.partitionName() << "\"" << std::endl;
57  ss << "[SiStripConfigDb::" << __func__ << "]"
58  << " Cache holds FED descriptions for " << feds_.size() << " partitions.";
59  LogTrace(mlConfigDb_) << ss.str();
60  }
61  }
62  }
63 
64  } else { // Using database cache
65 
66  FedDescriptionsV* tmp1 = databaseCache(__func__)->getFed9UDescriptions();
67 
68  if (tmp1) {
69  // Make local copy
70  FedDescriptionsV tmp2;
71  Fed9U::Fed9UDeviceFactory::vectorCopy(tmp2, *tmp1);
72 
73  // Add to cache
75 
76  } else {
77  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
78  << " NULL pointer to FED descriptions vector!";
79  }
80  }
81 
82  } catch (...) {
83  handleException(__func__);
84  }
85 
86  // Create range object
87  uint16_t np = 0;
88  uint16_t nc = 0;
90  if (!partition.empty()) {
92  np = 1;
93  nc = feds.size();
94  } else {
95  if (!feds_.empty()) {
96  feds = FedDescriptionsRange(feds_.find(dbParams_.partitions().begin()->second.partitionName()).begin(),
97  feds_.find((--(dbParams_.partitions().end()))->second.partitionName()).end());
98  } else {
99  feds = feds_.emptyRange();
100  }
101  np = feds_.size();
102  nc = feds.size();
103  }
104 
105  stringstream ss;
106  ss << "[SiStripConfigDb::" << __func__ << "]"
107  << " Found " << nc << " FED descriptions";
108  if (!dbParams_.usingDb()) {
109  ss << " in " << dbParams_.inputFedXmlFiles().size() << " 'fed.xml' file(s)";
110  } else {
111  if (!dbParams_.usingDbCache()) {
112  ss << " in " << np << " database partition(s)";
113  } else {
114  ss << " from shared memory name '" << dbParams_.sharedMemory() << "'";
115  }
116  }
117  if (feds_.empty()) {
118  edm::LogWarning(mlConfigDb_) << ss.str();
119  } else {
120  LogTrace(mlConfigDb_) << ss.str();
121  }
122 
123  return feds;
124 }
bool usingDb() const
static const std::string defaultPartitionName_
void loadNext(K const &k, std::vector< T > const &v)
Definition: MapOfVectors.h:87
range emptyRange() const
Definition: MapOfVectors.h:71
DbClient *const databaseCache(std::string method_name="") const
FedDescriptions::range FedDescriptionsRange
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
int np
Definition: AMPTWrapper.h:43
bool empty() const
Definition: MapOfVectors.h:96
FedDescriptions feds_
std::vector< std::string > inputFedXmlFiles() const
size_type size() const
Definition: MapOfVectors.h:94
void handleException(const std::string &method_name, const std::string &extra_info="") const
std::string sharedMemory() const
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
std::vector< FedDescription * > FedDescriptionsV
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ getFedIds()

SiStripConfigDb::FedIdsRange SiStripConfigDb::getFedIds ( std::string  partition = "")
protected

Extracts FED ids from FED descriptions.

Definition at line 431 of file FedDescriptions.cc.

References l1tstage2emulator_dqm_sourceclient-live_cfg::feds, sistrip::mlCabling_, sistrip::mlConfigDb_, and l1ctLayer1_patternWriters_cff::partition.

431  {
432  fedIds_.clear();
433 
434  if ((!dbParams_.usingDbCache() && !deviceFactory(__func__)) ||
435  (dbParams_.usingDbCache() && !databaseCache(__func__))) {
436  return FedIdsRange(fedIds_.end(), fedIds_.end());
437  }
438 
439  try {
440  // Inhibit download of strip info
441  bool using_strips = usingStrips_;
442  if (factory_) {
443  factory_->setUsingStrips(false);
444  }
446  if (factory_) {
447  factory_->setUsingStrips(using_strips);
448  }
449 
450  if (!feds.empty()) {
451  FedDescriptionsV::const_iterator ifed = feds.begin();
452  FedDescriptionsV::const_iterator jfed = feds.end();
453  for (; ifed != jfed; ++ifed) {
454  if (*ifed) {
455  fedIds_.push_back((*ifed)->getFedId());
456  } else {
457  edm::LogError(mlCabling_) << "[SiStripConfigDb::" << __func__ << "]"
458  << " NULL pointer to FedDescription!";
459  continue;
460  }
461  }
462  }
463 
464  } catch (...) {
465  handleException(__func__);
466  }
467 
468  if (fedIds_.empty()) {
469  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
470  << " No FED ids found!";
471  }
472 
473  return FedIdsRange(fedIds_.begin(), fedIds_.end());
474 }
DeviceFactory * factory_
FedDescriptionsRange getFedDescriptions(std::string partition="")
DbClient *const databaseCache(std::string method_name="") const
FedDescriptions::range FedDescriptionsRange
Log< level::Error, false > LogError
static const char mlConfigDb_[]
static const char mlCabling_[]
void handleException(const std::string &method_name, const std::string &extra_info="") const
boost::iterator_range< FedIds::const_iterator > FedIdsRange
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ handleException()

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

Handles exceptions thrown by software.

Definition at line 661 of file SiStripConfigDb.cc.

References MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, sistrip::mlConfigDb_, and contentValuesCheck::ss.

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

661  {
662  std::stringstream ss;
663  try {
664  throw; // rethrow caught exception to be dealt with below
665  }
666 
667  catch (const cms::Exception& e) {
668  ss << " Caught cms::Exception in method " << method_name << " with message: " << std::endl << e.what();
669  if (!extra_info.empty()) {
670  ss << "Additional info: " << extra_info << std::endl;
671  }
672  //throw e; // rethrow cms::Exception
673  }
674 
675  catch (const oracle::occi::SQLException& e) {
676  ss << " Caught oracle::occi::SQLException in method " << method_name << " with message: " << std::endl
677  << e.getMessage();
678  if (!extra_info.empty()) {
679  ss << "Additional info: " << extra_info << std::endl;
680  }
681  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
682  }
683 
684  catch (const FecExceptionHandler& e) {
685  ss << " Caught FecExceptionHandler exception in method " << method_name << " with message: " << std::endl
686  << const_cast<FecExceptionHandler&>(e).what();
687  if (!extra_info.empty()) {
688  ss << "Additional info: " << extra_info << std::endl;
689  }
690  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
691  }
692 
693  // catch ( const Fed9UDeviceFactoryException& e ) {
694  // ss << " Caught Fed9UDeviceFactoryException exception in method "
695  // << method_name << " with message: " << std::endl
696  // << e.what();
697  // if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
698  // //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
699  // }
700 
701  catch (const ICUtils::ICException& e) {
702  ss << " Caught ICUtils::ICException in method " << method_name << " with message: " << std::endl << e.what();
703  if (!extra_info.empty()) {
704  ss << "Additional info: " << extra_info << std::endl;
705  }
706  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
707  }
708 
709  catch (const exception& e) {
710  ss << " Caught std::exception in method " << method_name << " with message: " << std::endl << e.what();
711  if (!extra_info.empty()) {
712  ss << "Additional info: " << extra_info << std::endl;
713  }
714  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
715  }
716 
717  catch (...) {
718  ss << " Caught unknown exception in method " << method_name << " (No message) " << std::endl;
719  if (!extra_info.empty()) {
720  ss << "Additional info: " << extra_info << std::endl;
721  }
722  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
723  }
724 
725  // Message
726  edm::LogError(mlConfigDb_) << ss.str();
727 }
Log< level::Error, false > LogError
static const char mlConfigDb_[]

◆ openDbConnection()

void SiStripConfigDb::openDbConnection ( )
protected

Establishes connection to DeviceFactory API.

Definition at line 98 of file SiStripConfigDb.cc.

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

Referenced by SiStripConfigDb().

98  {
99  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
100  << " Opening connection to database...";
101 
102  // Check if connection already exists
103  if (openConnection_) {
104  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
105  << " Connection already open!";
106  return;
107  }
108  openConnection_ = true;
109 
110  // Establish database connection
111  if (dbParams_.usingDb()) {
112  if (dbParams_.usingDbCache()) {
114  } else {
115  usingDatabase();
116  }
117  } else {
118  usingXmlFiles();
119  }
120 
121  std::stringstream ss;
122  ss << "[SiStripConfigDb::" << __func__ << "]"
123  << " Database connection parameters: " << std::endl
124  << dbParams_;
125  edm::LogVerbatim(mlConfigDb_) << ss.str();
126 
127  // Clear local caches
128  clearLocalCache();
129 
130  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
131  << " Opened connection to database!";
132 }
Log< level::Info, true > LogVerbatim
bool usingDb() const
#define LogTrace(id)
static const char mlConfigDb_[]
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
bool usingDbCache() const

◆ partitions()

void SiStripConfigDb::partitions ( std::list< std::string > &  partitions) const
protected

Retrieves all partitions names from database.

Definition at line 947 of file SiStripConfigDb.cc.

References deviceFactory(), hgcalPerformanceValidation::df, and sistrip::mlConfigDb_.

Referenced by usingDatabase().

947  {
948  partitions.clear();
949 
950  // Check DF pointer
951  DeviceFactory* const df = deviceFactory(__func__);
952  if (!df) {
953  edm::LogError(mlConfigDb_) << "[SiStripPartition::" << __func__ << "]"
954  << " NULL pointer to DeviceFactory object!";
955  return;
956  }
957 
958  partitions = df->getAllPartitionNames();
959 }
Log< level::Error, false > LogError
static const char mlConfigDb_[]
void partitions(std::list< std::string > &) const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ printAnalysisDescriptions()

void SiStripConfigDb::printAnalysisDescriptions ( std::string  partition = "")
protected

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

Definition at line 417 of file AnalysisDescriptions.cc.

References generateTowerEtThresholdLUT::addr, hltExoticaValidator_cfi::analyses, data, spr::find(), cuy::ii, findQualityFiles::jj, SiStripKey::key(), submitPVResolutionJobs::key, LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, jetUpdater_cfi::sort, contentValuesCheck::ss, groupFilesInBlocks::temp, and createJobs::tmp.

417  {
418  std::stringstream ss;
419  ss << "[SiStripConfigDb::" << __func__ << "]"
420  << " Contents of AnalysisDescriptions container:" << std::endl;
421  ss << " Number of partitions: " << analyses_.size() << std::endl;
422 
423  // Loop through partitions
424  uint16_t cntr = 0;
427  for (; ianal != janal; ++ianal) {
428  cntr++;
429  if (partition.empty() || partition == ianal->first) {
430  ss << " Partition number : " << cntr << " (out of " << analyses_.size() << ")" << std::endl;
431  ss << " Partition name : \"" << ianal->first << "\"" << std::endl;
432  ss << " Num of analyses : " << ianal->second.size() << std::endl;
433 
434  // Extract FEC crate, slot, etc
435  std::map<uint32_t, vector<uint32_t> > analyses;
436  AnalysisDescriptionsV::const_iterator iter = ianal->second.begin();
437  AnalysisDescriptionsV::const_iterator jter = ianal->second.end();
438  for (; iter != jter; ++iter) {
439  if (*iter) {
440  DeviceAddress addr = deviceAddress(**iter);
441  uint32_t key = SiStripFecKey(addr.fecCrate_, addr.fecSlot_, addr.fecRing_, 0, 0, 0, 0).key();
442  uint32_t data = SiStripFecKey(addr.fecCrate_,
443  addr.fecSlot_,
444  addr.fecRing_,
445  addr.ccuAddr_,
446  addr.ccuChan_,
447  addr.lldChan_,
448  addr.i2cAddr_)
449  .key();
450  if (find(analyses[key].begin(), analyses[key].end(), data) == analyses[key].end()) {
451  analyses[key].push_back(data);
452  }
453  }
454  }
455 
456  // Sort contents
457  std::map<uint32_t, std::vector<uint32_t> > tmp;
458  std::map<uint32_t, std::vector<uint32_t> >::const_iterator ii = analyses.begin();
459  std::map<uint32_t, std::vector<uint32_t> >::const_iterator jj = analyses.end();
460  for (; ii != jj; ++ii) {
461  std::vector<uint32_t> temp = ii->second;
462  std::sort(temp.begin(), temp.end());
463  std::vector<uint32_t>::const_iterator iii = temp.begin();
464  std::vector<uint32_t>::const_iterator jjj = temp.end();
465  for (; iii != jjj; ++iii) {
466  tmp[ii->first].push_back(*iii);
467  }
468  }
469  analyses.clear();
470  analyses = tmp;
471 
472  // Print FEC crate, slot, etc...
473  std::map<uint32_t, std::vector<uint32_t> >::const_iterator ianal = analyses.begin();
474  std::map<uint32_t, std::vector<uint32_t> >::const_iterator janal = analyses.end();
475  for (; ianal != janal; ++ianal) {
476  SiStripFecKey key(ianal->first);
477  ss << " Found " << std::setw(3) << ianal->second.size() << " analyses for FEC crate/slot/ring "
478  << key.fecCrate() << "/" << key.fecSlot() << "/" << key.fecRing();
479  //<< " (ccu/module/lld/i2c): ";
480  // if ( !ianal->second.empty() ) {
481  // uint16_t first = ianal->second.front();
482  // uint16_t last = ianal->second.front();
483  // std::vector<uint32_t>::const_iterator chan = ianal->second.begin();
484  // for ( ; chan != ianal->second.end(); chan++ ) {
485  // if ( chan != ianal->second.begin() ) {
486  // if ( *chan != last+1 ) {
487  // ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
488  // if ( chan != ianal->second.end() ) { first = *(chan+1); }
489  // }
490  // }
491  // last = *chan;
492  // }
493  // if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
494  ss << std::endl;
495  }
496  }
497  }
498 
499  LogTrace(mlConfigDb_) << ss.str();
500 }
AnalysisDescriptions analyses_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
#define LogTrace(id)
static const char mlConfigDb_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const uint32_t & key() const
Definition: SiStripKey.h:120
key
prepare the HTCondor submission files and eventually submit them
DeviceAddress deviceAddress(const deviceDescription &)
ii
Definition: cuy.py:589
size_type size() const
Definition: MapOfVectors.h:94
const_iterator end() const
Definition: MapOfVectors.h:123
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
tmp
align.sh
Definition: createJobs.py:716
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: MapOfVectors.h:121

◆ printDcuDetIds()

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

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

Definition at line 349 of file DcuDetIds.cc.

References LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, and contentValuesCheck::ss.

349  {
350  std::stringstream ss;
351  ss << "[SiStripConfigDb::" << __func__ << "]"
352  << " Contents of DcuDetIds container:" << std::endl;
353  ss << " Number of partitions: " << dcuDetIds_.size() << std::endl;
354 
355  // Loop through partitions
356  uint16_t cntr = 0;
359  for (; idcu != jdcu; ++idcu) {
360  cntr++;
361  if (partition.empty() || partition == idcu->first) {
362  ss << " Partition number : " << cntr << " (out of " << dcuDetIds_.size() << ")" << std::endl;
363  ss << " Partition name : \"" << idcu->first << "\"" << std::endl;
364  ss << " Size of DCU-DetId map : " << idcu->second.size() << std::endl;
365  }
366  }
367 
368  LogTrace(mlConfigDb_) << ss.str();
369 }
#define LogTrace(id)
static const char mlConfigDb_[]
size_type size() const
Definition: MapOfVectors.h:94
const_iterator end() const
Definition: MapOfVectors.h:123
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: MapOfVectors.h:121
DcuDetIds dcuDetIds_

◆ printDeviceDescriptions()

void SiStripConfigDb::printDeviceDescriptions ( std::string  partition = "")
protected

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

Definition at line 414 of file DeviceDescriptions.cc.

References generateTowerEtThresholdLUT::addr, data, cms::alpakatools::devices(), spr::find(), cuy::ii, findQualityFiles::jj, SiStripKey::key(), submitPVResolutionJobs::key, LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, jetUpdater_cfi::sort, contentValuesCheck::ss, groupFilesInBlocks::temp, and createJobs::tmp.

414  {
415  std::stringstream ss;
416  ss << "[SiStripConfigDb::" << __func__ << "]"
417  << " Contents of DeviceDescriptions container:" << std::endl;
418  ss << " Number of partitions: " << devices_.size() << std::endl;
419 
420  // Loop through partitions
421  uint16_t cntr = 0;
424  for (; idev != jdev; ++idev) {
425  cntr++;
426  if (partition.empty() || partition == idev->first) {
427  ss << " Partition number : " << cntr << " (out of " << devices_.size() << ")" << std::endl;
428  ss << " Partition name : \"" << idev->first << "\"" << std::endl;
429  ss << " Num of devices : " << idev->second.size() << std::endl;
430 
431  // Extract FEC crate, slot, etc
432  std::map<uint32_t, vector<std::string> > devices;
433  DeviceDescriptionsV::const_iterator iter = idev->second.begin();
434  DeviceDescriptionsV::const_iterator jter = idev->second.end();
435  for (; iter != jter; ++iter) {
436  if (*iter) {
437  DeviceAddress addr = deviceAddress(**iter);
438  uint32_t key = SiStripFecKey(addr.fecCrate_, addr.fecSlot_, addr.fecRing_, 0, 0, 0, 0).key();
439  std::stringstream data;
440  data << (*iter)->getDeviceType() << "_"
441  << SiStripFecKey(addr.fecCrate_,
442  addr.fecSlot_,
443  addr.fecRing_,
444  addr.ccuAddr_,
445  addr.ccuChan_,
446  addr.lldChan_,
447  addr.i2cAddr_)
448  .key();
449  if (find(devices[key].begin(), devices[key].end(), data.str()) == devices[key].end()) {
450  devices[key].push_back(data.str());
451  }
452  }
453  }
454 
455  // Sort contents
456  std::map<uint32_t, std::vector<std::string> > tmp;
457  std::map<uint32_t, std::vector<std::string> >::const_iterator ii = devices.begin();
458  std::map<uint32_t, std::vector<std::string> >::const_iterator jj = devices.end();
459  for (; ii != jj; ++ii) {
460  std::vector<std::string> temp = ii->second;
461  std::sort(temp.begin(), temp.end());
462  std::vector<std::string>::const_iterator iii = temp.begin();
463  std::vector<std::string>::const_iterator jjj = temp.end();
464  for (; iii != jjj; ++iii) {
465  tmp[ii->first].push_back(*iii);
466  }
467  }
468  devices.clear();
469  devices = tmp;
470 
471  // Print FEC crate, slot, etc...
472  std::map<uint32_t, std::vector<std::string> >::const_iterator idev = devices.begin();
473  std::map<uint32_t, std::vector<std::string> >::const_iterator jdev = devices.end();
474  for (; idev != jdev; ++idev) {
475  SiStripFecKey key(idev->first);
476  ss << " Found " << std::setw(3) << idev->second.size() << " devices for FEC crate/slot/ring " << key.fecCrate()
477  << "/" << key.fecSlot() << "/" << key.fecRing();
478  //<< " (ccu/module/lld/i2c): ";
479  // if ( !idev->second.empty() ) {
480  // uint16_t first = idev->second.front();
481  // uint16_t last = idev->second.front();
482  // std::vector<std::string>::const_iterator chan = idev->second.begin();
483  // for ( ; chan != idev->second.end(); chan++ ) {
484  // if ( chan != idev->second.begin() ) {
485  // if ( *chan != last+1 ) {
486  // ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
487  // if ( chan != idev->second.end() ) { first = *(chan+1); }
488  // }
489  // }
490  // last = *chan;
491  // }
492  // if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
493  ss << std::endl;
494  }
495  }
496  }
497 
498  LogTrace(mlConfigDb_) << ss.str();
499 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
#define LogTrace(id)
static const char mlConfigDb_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const uint32_t & key() const
Definition: SiStripKey.h:120
key
prepare the HTCondor submission files and eventually submit them
DeviceAddress deviceAddress(const deviceDescription &)
ii
Definition: cuy.py:589
size_type size() const
Definition: MapOfVectors.h:94
const_iterator end() const
Definition: MapOfVectors.h:123
DeviceDescriptions devices_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:35
tmp
align.sh
Definition: createJobs.py:716
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: MapOfVectors.h:121

◆ printFedConnections()

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

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

Definition at line 348 of file FedConnections.cc.

References l1tstage2emulator_dqm_sourceclient-live_cfg::feds, spr::find(), dqmdumpme::first, cuy::ii, findQualityFiles::jj, dqmdumpme::last, LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, jetUpdater_cfi::sort, contentValuesCheck::ss, groupFilesInBlocks::temp, and createJobs::tmp.

348  {
349  std::stringstream ss;
350  ss << "[SiStripConfigDb::" << __func__ << "]"
351  << " Contents of FedConnections container:" << std::endl;
352  ss << " Number of partitions: " << connections_.size() << std::endl;
353 
354  // Loop through partitions
355  uint16_t cntr = 0;
358  for (; iconn != jconn; ++iconn) {
359  cntr++;
360  if (partition.empty() || partition == iconn->first) {
361  ss << " Partition number : " << cntr << " (out of " << connections_.size() << ")" << std::endl;
362  ss << " Partition name : \"" << iconn->first << "\"" << std::endl;
363  ss << " Num of connections : " << iconn->second.size() << std::endl;
364 
365  // Extract FED ids and channels
366  std::map<uint16_t, vector<uint16_t> > feds;
367  FedConnectionsV::const_iterator iter = iconn->second.begin();
368  FedConnectionsV::const_iterator jter = iconn->second.end();
369  for (; iter != jter; ++iter) {
370  if (*iter) {
371  uint16_t fed_id = (*iter)->getFedId();
372  uint16_t fed_ch = (*iter)->getFedChannel();
373  if (find(feds[fed_id].begin(), feds[fed_id].end(), fed_ch) == feds[fed_id].end()) {
374  feds[fed_id].push_back(fed_ch);
375  }
376  }
377  }
378 
379  // Sort contents
380  std::map<uint16_t, std::vector<uint16_t> > tmp;
381  std::map<uint16_t, std::vector<uint16_t> >::const_iterator ii = feds.begin();
382  std::map<uint16_t, std::vector<uint16_t> >::const_iterator jj = feds.end();
383  for (; ii != jj; ++ii) {
384  std::vector<uint16_t> temp = ii->second;
385  std::sort(temp.begin(), temp.end());
386  std::vector<uint16_t>::const_iterator iii = temp.begin();
387  std::vector<uint16_t>::const_iterator jjj = temp.end();
388  for (; iii != jjj; ++iii) {
389  tmp[ii->first].push_back(*iii);
390  }
391  }
392  feds.clear();
393  feds = tmp;
394 
395  // Print FED ids and channels
396  std::map<uint16_t, std::vector<uint16_t> >::const_iterator ifed = feds.begin();
397  std::map<uint16_t, std::vector<uint16_t> >::const_iterator jfed = feds.end();
398  for (; ifed != jfed; ++ifed) {
399  ss << " Found " << std::setw(2) << ifed->second.size() << " channels for FED id " << std::setw(3)
400  << ifed->first << " : ";
401  if (!ifed->second.empty()) {
402  uint16_t first = ifed->second.front();
403  uint16_t last = ifed->second.front();
404  std::vector<uint16_t>::const_iterator ichan = ifed->second.begin();
405  std::vector<uint16_t>::const_iterator jchan = ifed->second.end();
406  for (; ichan != jchan; ++ichan) {
407  if (ichan != ifed->second.begin()) {
408  if (*ichan != last + 1) {
409  ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
410  if (ichan != ifed->second.end()) {
411  first = *(ichan + 1);
412  }
413  }
414  }
415  last = *ichan;
416  }
417  if (first != last) {
418  ss << std::setw(2) << first << "->" << std::setw(2) << last;
419  }
420  ss << std::endl;
421  }
422  }
423  }
424  }
425 
426  LogTrace(mlConfigDb_) << ss.str();
427 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
FedConnections connections_
#define LogTrace(id)
static const char mlConfigDb_[]
ii
Definition: cuy.py:589
size_type size() const
Definition: MapOfVectors.h:94
const_iterator end() const
Definition: MapOfVectors.h:123
tmp
align.sh
Definition: createJobs.py:716
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: MapOfVectors.h:121

◆ printFedDescriptions()

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

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

Definition at line 348 of file FedDescriptions.cc.

References data, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, spr::find(), dqmdumpme::first, cuy::ii, findQualityFiles::jj, submitPVResolutionJobs::key, dqmdumpme::last, LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, jetUpdater_cfi::sort, contentValuesCheck::ss, groupFilesInBlocks::temp, and createJobs::tmp.

348  {
349  std::stringstream ss;
350  ss << "[SiStripConfigDb::" << __func__ << "]"
351  << " Contents of FedDescriptions container:" << std::endl;
352  ss << " Number of partitions: " << feds_.size() << std::endl;
353 
354  // Loop through partitions
355  uint16_t cntr = 0;
358  for (; iconn != jconn; ++iconn) {
359  cntr++;
360  if (partition.empty() || partition == iconn->first) {
361  ss << " Partition number : " << cntr << " (out of " << feds_.size() << ")" << std::endl;
362  ss << " Partition name : \"" << iconn->first << "\"" << std::endl;
363  ss << " Num of FED ids : " << iconn->second.size() << std::endl;
364 
365  // Extract FED crates and ids
366  std::map<uint16_t, vector<uint16_t> > feds;
367  FedDescriptionsV::const_iterator iter = iconn->second.begin();
368  FedDescriptionsV::const_iterator jter = iconn->second.end();
369  for (; iter != jter; ++iter) {
370  if (*iter) {
371  uint16_t key = (*iter)->getCrateNumber();
372  uint16_t data = (*iter)->getFedId();
373  if (find(feds[key].begin(), feds[key].end(), data) == feds[key].end()) {
374  feds[key].push_back(data);
375  }
376  }
377  }
378 
379  // Sort contents
380  std::map<uint16_t, std::vector<uint16_t> > tmp;
381  std::map<uint16_t, std::vector<uint16_t> >::const_iterator ii = feds.begin();
382  std::map<uint16_t, std::vector<uint16_t> >::const_iterator jj = feds.end();
383  for (; ii != jj; ++ii) {
384  std::vector<uint16_t> temp = ii->second;
385  std::sort(temp.begin(), temp.end());
386  std::vector<uint16_t>::const_iterator iii = temp.begin();
387  std::vector<uint16_t>::const_iterator jjj = temp.end();
388  for (; iii != jjj; ++iii) {
389  tmp[ii->first].push_back(*iii);
390  }
391  }
392  feds.clear();
393  feds = tmp;
394 
395  // Print FED crates and ids
396  std::map<uint16_t, std::vector<uint16_t> >::const_iterator ifed = feds.begin();
397  std::map<uint16_t, std::vector<uint16_t> >::const_iterator jfed = feds.end();
398  for (; ifed != jfed; ++ifed) {
399  ss << " Found " << std::setw(2) << ifed->second.size() << " FED ids for crate number " << std::setw(2)
400  << ifed->first << " : ";
401  if (!ifed->second.empty()) {
402  uint16_t first = ifed->second.front();
403  uint16_t last = ifed->second.front();
404  std::vector<uint16_t>::const_iterator icrate = ifed->second.begin();
405  std::vector<uint16_t>::const_iterator jcrate = ifed->second.end();
406  for (; icrate != jcrate; ++icrate) {
407  if (icrate != ifed->second.begin()) {
408  if (*icrate != last + 1) {
409  ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
410  if (icrate != ifed->second.end()) {
411  first = *(icrate + 1);
412  }
413  }
414  }
415  last = *icrate;
416  }
417  if (first != last) {
418  ss << std::setw(2) << first << "->" << std::setw(2) << last;
419  }
420  ss << std::endl;
421  }
422  }
423  }
424  }
425 
426  LogTrace(mlConfigDb_) << ss.str();
427 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
#define LogTrace(id)
static const char mlConfigDb_[]
FedDescriptions feds_
key
prepare the HTCondor submission files and eventually submit them
ii
Definition: cuy.py:589
size_type size() const
Definition: MapOfVectors.h:94
const_iterator end() const
Definition: MapOfVectors.h:123
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
tmp
align.sh
Definition: createJobs.py:716
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: MapOfVectors.h:121

◆ runs() [1/3]

void SiStripConfigDb::runs ( SiStripConfigDb::Runs runs) const
protected

Retrieves all runs from database.

Definition at line 743 of file SiStripConfigDb.cc.

References python.cmstools::all(), sistrip::APV_LATENCY, sistrip::APV_TIMING, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, sistrip::DAQ_SCOPE_MODE, deviceFactory(), hgcalPerformanceValidation::df, sistrip::FAST_CABLING, sistrip::FED_CABLING, sistrip::FED_TIMING, sistrip::FINE_DELAY, sistrip::FINE_DELAY_PLL, sistrip::FINE_DELAY_TTC, cuy::ii, findQualityFiles::jj, sistrip::mlConfigDb_, sistrip::MULTI_MODE, sistrip::OPTO_SCAN, sistrip::PEDESTALS, sistrip::PHYSICS, sistrip::PHYSICS_ZS, sistrip::QUITE_FAST_CABLING, alignCSCRings::r, groupFilesInBlocks::temp, sistrip::UNDEFINED_RUN_TYPE, sistrip::UNKNOWN_RUN_TYPE, and sistrip::VPSP_SCAN.

743  {
744  runs.clear();
745 
746  // Check DF pointer
747  DeviceFactory* const df = deviceFactory(__func__);
748  if (!df) {
749  edm::LogError(mlConfigDb_) << "[SiStripPartition::" << __func__ << "]"
750  << " NULL pointer to DeviceFactory object!";
751  return;
752  }
753 
754  // Retrieve runs
755  tkRunVector all;
756  all = df->getAllRuns();
757 
758  // Iterate through tkRunVector
759  tkRunVector::const_iterator ii = all.begin();
760  tkRunVector::const_iterator jj = all.end();
761  for (; ii != jj; ++ii) {
762  // Check TkRun pointer
763  if (*ii) {
764  // Retrieve run type
765  uint16_t type = (*ii)->getModeId((*ii)->getMode());
767  if (type == 1) {
769  } else if (type == 2) {
771  } else if (type == 3) {
773  } else if (type == 33) {
775  } else if (type == 4) {
777  } else if (type == 5) {
779  } else if (type == 6) {
781  } else if (type == 7) {
783  } else if (type == 10) {
785  } else if (type == 8) {
787  } else if (type == 12) {
789  } else if (type == 13) {
791  } else if (type == 14) {
793  } else if (type == 15) {
795  } else if (type == 16) {
797  } else if (type == 17) {
799  } else if (type == 18) {
801  } else if (type == 19) {
803  } else if (type == 20) {
805  } else if (type == 21) {
807  } else if (type == 0) {
809  } else {
811  }
812 
813  // Store run details
814  Run r;
815  r.type_ = temp;
816  r.partition_ = (*ii)->getPartitionName();
817  r.number_ = (*ii)->getRunNumber();
818  runs.push_back(r);
819 
820  } else {
821  edm::LogWarning(mlConfigDb_) << "[SiStripPartition::" << __func__ << "]"
822  << " NULL pointer to TkRun object!";
823  }
824  }
825 }
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
Log< level::Error, false > LogError
void runs(Runs &) const
static const char mlConfigDb_[]
ii
Definition: cuy.py:589
Log< level::Warning, false > LogWarning
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ runs() [2/3]

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 829 of file SiStripConfigDb.cc.

References dbParams_, newFWLiteAna::found, cuy::ii, recoMuon::in, findQualityFiles::jj, sistrip::mlConfigDb_, MillePedeFileConverter_cfg::out, SiStripDbParams::partition(), SiStripDbParams::partitions(), sistrip::UNDEFINED_RUN_TYPE, and sistrip::UNKNOWN_RUN_TYPE.

831  {
832  out.clear();
833 
834  // Check partition name (if not empty string)
835  if (!optional_partition.empty()) {
836  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partition(optional_partition);
837  if (iter == dbParams_.partitions().end()) {
838  edm::LogWarning(mlConfigDb_) << "[SiStripPartition::" << __func__ << "]"
839  << " Partition name not found!";
840  return;
841  }
842  }
843 
844  // Iterate through runs
845  Runs::const_iterator ii = in.begin();
846  Runs::const_iterator jj = in.end();
847  for (; ii != jj; ++ii) {
848  // Check partition name
849  if (ii->partition_ == optional_partition || optional_partition.empty()) {
850  // Check run type
851  if (ii->type_ != sistrip::UNKNOWN_RUN_TYPE && ii->type_ != sistrip::UNDEFINED_RUN_TYPE) {
852  // Check run number
853  if (ii->number_) {
854  bool found = false;
855  if (out.find(ii->type_) != out.end()) {
856  Runs::const_iterator irun = out[ii->type_].begin();
857  Runs::const_iterator jrun = out[ii->type_].end();
858  while (!found && irun != jrun) {
859  if (irun->number_ == ii->number_) {
860  found = true;
861  }
862  ++irun;
863  }
864  }
865  // Check if run number already found
866  if (!found) {
867  out[ii->type_].push_back(*ii);
868  } else {
869  // edm::LogWarning(mlConfigDb_)
870  // << "[SiStripPartition::" << __func__ << "]"
871  // << " Run number already found!";
872  }
873  } else {
874  // edm::LogWarning(mlConfigDb_)
875  // << "[SiStripPartition::" << __func__ << "]"
876  // << " NULL run number!";
877  }
878  } else {
879  // edm::LogWarning(mlConfigDb_)
880  // << "[SiStripPartition::" << __func__ << "]"
881  // << " Unexpected run type!";
882  }
883  } else {
884  // edm::LogWarning(mlConfigDb_)
885  // << "[SiStripPartition::" << __func__ << "]"
886  // << " Partition name does not match!";
887  }
888  }
889 }
const_iterator_range partitions() const
static const char mlConfigDb_[]
SiStripPartitions::const_iterator partition(std::string partition_name) const
ii
Definition: cuy.py:589
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning

◆ runs() [3/3]

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 893 of file SiStripConfigDb.cc.

References newFWLiteAna::found, cuy::ii, recoMuon::in, findQualityFiles::jj, MillePedeFileConverter_cfg::out, and sistrip::UNDEFINED_RUN_TYPE.

895  {
896  out.clear();
897 
898  // Iterate through runs
899  Runs::const_iterator ii = in.begin();
900  Runs::const_iterator jj = in.end();
901  for (; ii != jj; ++ii) {
902  // Check partition name
903  if (!ii->partition_.empty()) {
904  // Check run type
905  if (ii->type_ == optional_type || optional_type == sistrip::UNDEFINED_RUN_TYPE) {
906  // Check run number
907  if (ii->number_) {
908  bool found = false;
909  if (out.find(ii->partition_) != out.end()) {
910  Runs::const_iterator irun = out[ii->partition_].begin();
911  Runs::const_iterator jrun = out[ii->partition_].end();
912  while (!found && irun != jrun) {
913  if (irun->number_ == ii->number_) {
914  found = true;
915  }
916  ++irun;
917  }
918  }
919  // Check if run number already found
920  if (!found) {
921  out[ii->partition_].push_back(*ii);
922  } else {
923  // edm::LogWarning(mlConfigDb_)
924  // << "[SiStripPartition::" << __func__ << "]"
925  // << " Run number already found!";
926  }
927  } else {
928  // edm::LogWarning(mlConfigDb_)
929  // << "[SiStripPartition::" << __func__ << "]"
930  // << " NULL run number!";
931  }
932  } else {
933  // edm::LogWarning(mlConfigDb_)
934  // << "[SiStripPartition::" << __func__ << "]"
935  // << " Run type does not match!";
936  }
937  } else {
938  // edm::LogWarning(mlConfigDb_)
939  // << "[SiStripPartition::" << __func__ << "]"
940  // << " NULL value for partition!";
941  }
942  }
943 }
ii
Definition: cuy.py:589

◆ uploadAnalysisDescriptions()

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

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

list of all analysis type

Definition at line 230 of file AnalysisDescriptions.cc.

References spr::find(), LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, contentValuesCheck::ss, and BeamSplash_cfg::version.

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

230  {
231  if (dbParams_.usingDbCache()) {
232  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
233  << " Using database cache! No uploads allowed!";
234  return;
235  }
236 
237  if (!deviceFactory(__func__)) {
238  return;
239  }
240 
241  if (analyses_.empty()) {
242  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
243  << " Found no cached analysis descriptions, therefore no upload!";
244  return;
245  }
246 
247  if (calibration_for_physics && !allowCalibUpload_) {
248  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
249  << " Attempting to upload calibration constants"
250  << " without uploading any hardware descriptions!"
251  << " Aborting upload...";
252  return;
253  } else {
254  allowCalibUpload_ = false;
255  }
256 
257  try {
258  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
259  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
260  for (; iter != jter; ++iter) {
261  if (partition.empty() || partition == iter->second.partitionName()) {
262  AnalysisDescriptionsRange range = analyses_.find(iter->second.partitionName());
263  if (range != analyses_.emptyRange()) {
264  AnalysisDescriptionsV anals(range.begin(), range.end());
265 
266  vector<AnalysisType>
267  analysis_type; // check how many different analysis type we have --> more than one analysis table could be uploaded in the same job
268  for (auto element : anals) {
269  if (std::find(analysis_type.begin(), analysis_type.end(), element->getType()) == analysis_type.end() and
270  element->getType() != AnalysisDescription::T_UNKNOWN) {
271  analysis_type.push_back(element->getType());
272  } else if (element->getType() == AnalysisDescription::T_UNKNOWN) {
273  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
274  << " Analysis type is UNKNOWN. Aborting upload!";
275  return;
276  }
277  }
278 
279  vector<AnalysisDescriptionsV> analysisToUpload; // in case there are more than one analysis type to be uploaded
280  for (auto type : analysis_type) {
281  AnalysisDescriptionsV ana_temp;
282  for (auto element : anals) {
283  if (element->getType() == type)
284  ana_temp.push_back(element);
285  }
286  analysisToUpload.push_back(ana_temp);
287  }
288 
289  // perform the upload
290  for (auto analysis : analysisToUpload) {
291  uint32_t version = deviceFactory(__func__)->uploadAnalysis(iter->second.runNumber(),
292  iter->second.partitionName(),
293  analysis.front()->getType(),
294  analysis,
295  calibration_for_physics);
296  // Update current state with analysis descriptions
297  if (calibration_for_physics) {
298  deviceFactory(__func__)->uploadAnalysisState(version);
299  }
300  }
301 
302  // Some debug
303  std::stringstream ss;
304  ss << "[SiStripConfigDb::" << __func__ << "]"
305  << " Uploaded " << anals.size() << " device descriptions to database for partition \""
306  << iter->second.partitionName() << "\".";
307  LogTrace(mlConfigDb_) << ss.str();
308 
309  } else {
310  stringstream ss;
311  ss << "[SiStripConfigDb::" << __func__ << "]"
312  << " Vector of device descriptions is empty for partition \"" << iter->second.partitionName()
313  << "\", therefore aborting upload for this partition!";
314  edm::LogWarning(mlConfigDb_) << ss.str();
315  continue;
316  }
317 
318  } else {
319  // stringstream ss;
320  // ss << "[SiStripConfigDb::" << __func__ << "]"
321  // << " Cannot find partition \"" << partition
322  // << "\" in cached partitions list: \""
323  // << dbParams_.partitionNames( dbParams_.partitionNames() )
324  // << "\", therefore aborting upload for this partition!";
325  // edm::LogWarning(mlConfigDb_) << ss.str();
326  }
327  }
328  } catch (...) {
329  handleException(__func__);
330  }
331 
332  allowCalibUpload_ = true;
333 }
range emptyRange() const
Definition: MapOfVectors.h:71
AnalysisDescriptions analyses_
range find(K const &k) const
Definition: MapOfVectors.h:110
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
AnalysisDescriptions::range AnalysisDescriptionsRange
void handleException(const std::string &method_name, const std::string &extra_info="") const
SiStripDbParams dbParams_
std::vector< AnalysisDescription * > AnalysisDescriptionsV
static std::atomic< bool > allowCalibUpload_
Log< level::Warning, false > LogWarning
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ uploadDcuDetIds()

void SiStripConfigDb::uploadDcuDetIds ( std::string  partition = "")
protected

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

Definition at line 183 of file DcuDetIds.cc.

References sistrip::mlConfigDb_, and contentValuesCheck::ss.

183  {
184  stringstream ss;
185  ss << "[SiStripConfigDb::" << __func__ << "]"
186  << " Cannot upload to database! This functionality not allowed!";
187  edm::LogWarning(mlConfigDb_) << ss.str();
188 
189  /*
190  addAllDetId => all detids
191  addAllDetId => to download (up to you)
192  change in the detids
193  setTkDcuInfo
194  getCurrentStates
195  setCurrentState
196  addDetIpartiton
197  AddAllDetId
198  */
199 
200  // if ( dbParams_.usingDbCache() ) {
201  // edm::LogWarning(mlConfigDb_)
202  // << "[SiStripConfigDb::" << __func__ << "]"
203  // << " Using database cache! No uploads allowed!";
204  // return;
205  // }
206 
207  // if ( !deviceFactory(__func__) ) { return; }
208 
209  // if ( dcuDetIds_.empty() ) {
210  // stringstream ss;
211  // ss << "[SiStripConfigDb::" << __func__ << "]"
212  // << " Found no cached DCU-DetId map, therefore no upload!";
213  // edm::LogWarning(mlConfigDb_) << ss.str();
214  // return;
215  // }
216 
217  // try {
218 
219  // SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
220  // SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
221  // for ( ; iter != jter; ++iter ) {
222 
223  // if ( partition == "" || partition == iter->second.partitionName() ) {
224 
225  // DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
226  // if ( range != dcuDetIds_.emptyRange() ) {
227 
228  // // Extract
229  // DcuDetIdMap dst;
230  // clone( DcuDetIdsV( range.begin(), range.end() ), dst );
231  // deviceFactory(__func__)->setTkDcuInfo( dst );
232  // getcurrentstate
233  // deviceFactory(__func__)->addAllDetId();
234 
235  // // Some debug
236  // std::stringstream ss;
237  // ss << "[SiStripConfigDb::" << __func__ << "]"
238  // << " Uploaded " << dst.size()
239  // << " DCU-DetId map to DB/xml for partition \""
240  // << iter->second.partitionName() << "\".";
241  // LogTrace(mlConfigDb_) << ss.str();
242 
243  // } else {
244  // stringstream ss;
245  // ss << "[SiStripConfigDb::" << __func__ << "]"
246  // << " Vector of DCU-DetId map is empty for partition \""
247  // << iter->second.partitionName()
248  // << "\", therefore aborting upload for this partition!";
249  // edm::LogWarning(mlConfigDb_) << ss.str();
250  // continue;
251  // }
252 
253  // } else {
254  // // stringstream ss;
255  // // ss << "[SiStripConfigDb::" << __func__ << "]"
256  // // << " Cannot find partition \"" << partition
257  // // << "\" in cached partitions list: \""
258  // // << dbParams_.partitionNames( dbParams_.partitionNames() )
259  // // << "\", therefore aborting upload for this partition!";
260  // // edm::LogWarning(mlConfigDb_) << ss.str();
261  // }
262 
263  // }
264 
265  // } catch (... ) { handleException( __func__, "Problems updating objects in TkDcuInfoFactory!" ); }
266 }
static const char mlConfigDb_[]
Log< level::Warning, false > LogWarning

◆ uploadDeviceDescriptions()

void SiStripConfigDb::uploadDeviceDescriptions ( std::string  partition = "")
protected

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

Definition at line 264 of file DeviceDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

264  {
265  if (dbParams_.usingDbCache()) {
266  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
267  << " Using database cache! No uploads allowed!";
268  return;
269  }
270 
271  if (!deviceFactory(__func__)) {
272  return;
273  }
274 
275  if (devices_.empty()) {
276  stringstream ss;
277  ss << "[SiStripConfigDb::" << __func__ << "]"
278  << " Found no cached device descriptions, therefore no upload!";
279  edm::LogWarning(mlConfigDb_) << ss.str();
280  return;
281  }
282 
283  try {
284  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
285  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
286  for (; iter != jter; ++iter) {
287  if (partition.empty() || partition == iter->second.partitionName()) {
288  DeviceDescriptionsRange range = devices_.find(iter->second.partitionName());
289  if (range != devices_.emptyRange()) {
290  DeviceDescriptionsV devs(range.begin(), range.end());
291 
292  SiStripPartition::Versions fecVersion = iter->second.fecVersion();
293  deviceFactory(__func__)->setFecDeviceDescriptions(devs,
294  iter->second.partitionName(),
295  &(fecVersion.first),
296  &(fecVersion.second),
297  true); // new major version
298 
299  // Some debug
300  std::stringstream ss;
301  ss << "[SiStripConfigDb::" << __func__ << "]"
302  << " Uploaded " << devs.size() << " device descriptions to database for partition \""
303  << iter->second.partitionName() << "\".";
304  LogTrace(mlConfigDb_) << ss.str();
305 
306  } else {
307  stringstream ss;
308  ss << "[SiStripConfigDb::" << __func__ << "]"
309  << " Vector of device descriptions is empty for partition \"" << iter->second.partitionName()
310  << "\", therefore aborting upload for this partition!";
311  edm::LogWarning(mlConfigDb_) << ss.str();
312  continue;
313  }
314 
315  } else {
316  // stringstream ss;
317  // ss << "[SiStripConfigDb::" << __func__ << "]"
318  // << " Cannot find partition \"" << partition
319  // << "\" in cached partitions list: \""
320  // << dbParams_.partitionNames( dbParams_.partitionNames() )
321  // << "\", therefore aborting upload for this partition!";
322  // edm::LogWarning(mlConfigDb_) << ss.str();
323  }
324  }
325 
326  } catch (...) {
327  handleException(__func__);
328  }
329 
330  allowCalibUpload_ = true;
331 }
range emptyRange() const
Definition: MapOfVectors.h:71
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
DeviceDescriptions::range DeviceDescriptionsRange
std::pair< uint32_t, uint32_t > Versions
void handleException(const std::string &method_name, const std::string &extra_info="") const
DeviceDescriptions devices_
SiStripDbParams dbParams_
static std::atomic< bool > allowCalibUpload_
Log< level::Warning, false > LogWarning
std::vector< DeviceDescription * > DeviceDescriptionsV
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ uploadFedConnections()

void SiStripConfigDb::uploadFedConnections ( std::string  partition = "")
protected

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

Definition at line 196 of file FedConnections.cc.

References LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

196  {
197  if (dbParams_.usingDbCache()) {
198  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
199  << " Using database cache! No uploads allowed!";
200  return;
201  }
202 
203  if (!deviceFactory(__func__)) {
204  return;
205  }
206 
207  if (connections_.empty()) {
208  stringstream ss;
209  ss << "[SiStripConfigDb::" << __func__ << "]"
210  << " Found no cached FED connections, therefore no upload!";
211  edm::LogWarning(mlConfigDb_) << ss.str();
212  return;
213  }
214 
215  if (dbParams_.usingDb()) {
216  try {
217  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
218  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
219  for (; iter != jter; ++iter) {
220  if (partition.empty() || partition == iter->second.partitionName()) {
221  FedConnectionsRange range = connections_.find(iter->second.partitionName());
222  if (range != connections_.emptyRange()) {
223  FedConnectionsV conns(range.begin(), range.end());
224 
225  SiStripPartition::Versions cabVersion = iter->second.cabVersion();
226  deviceFactory(__func__)->setConnectionDescriptions(conns,
227  iter->second.partitionName(),
228  &(cabVersion.first),
229  &(cabVersion.second),
230  true); // new major version
231 
232  // Some debug
233  std::stringstream ss;
234  ss << "[SiStripConfigDb::" << __func__ << "]"
235  << " Uploaded " << conns.size() << " FED connections to database for partition \""
236  << iter->second.partitionName() << "\".";
237  LogTrace(mlConfigDb_) << ss.str();
238 
239  } else {
240  stringstream ss;
241  ss << "[SiStripConfigDb::" << __func__ << "]"
242  << " Vector of FED connections is empty for partition \"" << iter->second.partitionName()
243  << "\", therefore aborting upload for this partition!";
244  edm::LogWarning(mlConfigDb_) << ss.str();
245  continue;
246  }
247 
248  } else {
249  // stringstream ss;
250  // ss << "[SiStripConfigDb::" << __func__ << "]"
251  // << " Cannot find partition \"" << partition
252  // << "\" in cached partitions list: \""
253  // << dbParams_.partitionNames( dbParams_.partitionNames() )
254  // << "\", therefore aborting upload for this partition!";
255  // edm::LogWarning(mlConfigDb_) << ss.str();
256  }
257  }
258 
259  } catch (...) {
260  handleException(__func__);
261  }
262  }
263 
264  allowCalibUpload_ = true;
265 }
bool usingDb() const
range emptyRange() const
Definition: MapOfVectors.h:71
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
FedConnections connections_
#define LogTrace(id)
FedConnections::range FedConnectionsRange
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
std::pair< uint32_t, uint32_t > Versions
void handleException(const std::string &method_name, const std::string &extra_info="") const
SiStripDbParams dbParams_
static std::atomic< bool > allowCalibUpload_
std::vector< FedConnection * > FedConnectionsV
Log< level::Warning, false > LogWarning
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ uploadFedDescriptions()

void SiStripConfigDb::uploadFedDescriptions ( std::string  partition = "")
protected

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

Definition at line 197 of file FedDescriptions.cc.

References l1tstage2emulator_dqm_sourceclient-live_cfg::feds, LogTrace, sistrip::mlConfigDb_, l1ctLayer1_patternWriters_cff::partition, FastTimerService_cff::range, and contentValuesCheck::ss.

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

197  {
198  if (dbParams_.usingDbCache()) {
199  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
200  << " Using database cache! No uploads allowed!";
201  return;
202  }
203 
204  if (!deviceFactory(__func__)) {
205  return;
206  }
207 
208  if (feds_.empty()) {
209  stringstream ss;
210  ss << "[SiStripConfigDb::" << __func__ << "]"
211  << " Found no cached FED descriptions, therefore no upload!";
212  edm::LogWarning(mlConfigDb_) << ss.str();
213  return;
214  }
215 
216  try {
217  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
218  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
219  for (; iter != jter; ++iter) {
220  if (partition.empty() || partition == iter->second.partitionName()) {
221  FedDescriptionsRange range = feds_.find(iter->second.partitionName());
222  if (range != feds_.emptyRange()) {
223  FedDescriptionsV feds(range.begin(), range.end());
224 
225  SiStripPartition::Versions fedVersion = iter->second.fedVersion();
226  deviceFactory(__func__)->setFed9UDescriptions(feds,
227  iter->second.partitionName(),
228  (uint16_t*)(&(fedVersion.first)),
229  (uint16_t*)(&(fedVersion.second)),
230  1); // new major version
231 
232  // Some debug
233  std::stringstream ss;
234  ss << "[SiStripConfigDb::" << __func__ << "]"
235  << " Uploaded " << feds.size() << " FED descriptions to database for partition \""
236  << iter->second.partitionName() << "\"";
237  LogTrace(mlConfigDb_) << ss.str();
238 
239  } else {
240  stringstream ss;
241  ss << "[SiStripConfigDb::" << __func__ << "]"
242  << " Vector of FED descriptions is empty for partition \"" << iter->second.partitionName()
243  << "\", therefore aborting upload for this partition!";
244  edm::LogWarning(mlConfigDb_) << ss.str();
245  continue;
246  }
247 
248  } else {
249  // stringstream ss;
250  // ss << "[SiStripConfigDb::" << __func__ << "]"
251  // << " Cannot find partition \"" << partition
252  // << "\" in cached partitions list: \""
253  // << dbParams_.partitionNames( dbParams_.partitionNames() )
254  // << "\", therefore aborting upload for this partition!";
255  // edm::LogWarning(mlConfigDb_) << ss.str();
256  }
257  }
258 
259  } catch (...) {
260  handleException(__func__);
261  }
262 
263  allowCalibUpload_ = true;
264 }
range emptyRange() const
Definition: MapOfVectors.h:71
FedDescriptions::range FedDescriptionsRange
range find(K const &k) const
Definition: MapOfVectors.h:110
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
bool empty() const
Definition: MapOfVectors.h:96
FedDescriptions feds_
std::pair< uint32_t, uint32_t > Versions
void handleException(const std::string &method_name, const std::string &extra_info="") const
SiStripDbParams dbParams_
static std::atomic< bool > allowCalibUpload_
Log< level::Warning, false > LogWarning
std::vector< FedDescription * > FedDescriptionsV
bool usingDbCache() const
DeviceFactory *const deviceFactory(std::string method_name="") const

◆ usingDatabase()

void SiStripConfigDb::usingDatabase ( )
private

Definition at line 225 of file SiStripConfigDb.cc.

References SiStripDbParams::addPartition(), SiStripDbParams::clearPartitions(), SiStripDbParams::confdb(), dbParams_, TauDecayModes::dec, deviceFactory(), sistrip::dir_, factory_, corrVsCorr::filename, handleException(), cuy::ii, findQualityFiles::jj, mps_splice::line, LogTrace, sistrip::mlConfigDb_, sistrip::null_, convertSQLiteXML::ok, l1ctLayer1_patternWriters_cff::partition, SiStripDbParams::partitionNames(), SiStripDbParams::partitions(), partitions(), SiStripDbParams::passwd(), castor_dqm_sourceclient_file_cfg::path, SiStripDbParams::path(), topSingleLeptonDQM_PU_cfi::pattern, pickleFileParser::slash, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, SiStripDbParams::tnsAdmin(), EnviromentSettings::user, SiStripDbParams::user(), and SiStripDbParams::usingDb().

Referenced by openDbConnection().

225  {
226  // Retrieve connection params from CONFDB env. var. and override .cfg values
227  std::string user = "";
228  std::string passwd = "";
229  std::string pToPrint = "******";
230  std::string path = "";
231  DbAccess::getDbConfiguration(user, passwd, path);
232  if (!user.empty() && !passwd.empty() && !path.empty()) {
233  std::stringstream ss;
234  ss << "[SiStripConfigDb::" << __func__ << "]"
235  << " Setting \"user/passwd@path\" to \"" << user << "/" << pToPrint << "@" << path
236  << "\" using 'CONFDB' environmental variable";
237  if (dbParams_.user() != null_ || dbParams_.passwd() != null_ || dbParams_.path() != null_) {
238  ss << " (Overwriting existing value of \"" << dbParams_.user() << "/" << pToPrint << "@" << dbParams_.path()
239  << "\" read from .cfg file)";
240  }
241  edm::LogVerbatim(mlConfigDb_) << ss.str() << std::endl;
242  dbParams_.confdb(user, passwd, path);
243 
244  } else if (dbParams_.user() != null_ && dbParams_.passwd() != null_ && dbParams_.path() != null_) {
245  std::stringstream ss;
246  ss << "[SiStripConfigDb::" << __func__ << "]"
247  << " Setting \"user/passwd@path\" to \"" << dbParams_.user() << "/" << pToPrint << "@" << dbParams_.path()
248  << "\" using 'ConfDb' configurable read from .cfg file";
249  edm::LogVerbatim(mlConfigDb_) << ss.str();
250 
251  } else {
252  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
253  << " Unable to retrieve 'user/passwd@path' parameters"
254  << " from 'CONFDB' environmental variable or .cfg file"
255  << " (present value is \"" << user << "/" << pToPrint << "@" << path
256  << "\"). Aborting connection to database...";
257  return;
258  }
259 
260  // Check TNS_ADMIN environmental variable
261  std::string pattern = "TNS_ADMIN";
262  std::string tns_admin = "/afs/cern.ch/project/oracle/admin";
263  if (std::getenv(pattern.c_str()) != nullptr) {
264  tns_admin = std::getenv(pattern.c_str());
265  edm::LogVerbatim(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
266  << " TNS_ADMIN is set to: \"" << tns_admin << "\"";
267  } else {
268  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
269  << " TNS_ADMIN is not set!"
270  << " Trying to use /afs and setting to: \"" << tns_admin << "\"";
271  }
272 
273  // Retrieve TNS_ADMIN from .cfg file and override
274  if (!dbParams_.tnsAdmin().empty()) {
275  std::stringstream ss;
276  ss << "[SiStripConfigDb::" << __func__ << "]"
277  << " Overriding TNS_ADMIN value using cfg file!" << std::endl
278  << " Original value : \"" << tns_admin << "\"!" << std::endl
279  << " New value : \"" << dbParams_.tnsAdmin() << "\"!";
280  tns_admin = dbParams_.tnsAdmin();
281  edm::LogVerbatim(mlConfigDb_) << ss.str();
282  }
283 
284  // Remove trailing slash and set TNS_ADMIN
285  if (tns_admin.empty()) {
286  tns_admin = ".";
287  }
288  std::string slash = tns_admin.substr(tns_admin.size() - 1, 1);
289  if (slash == sistrip::dir_) {
290  tns_admin = tns_admin.substr(0, tns_admin.size() - 1);
291  }
292  setenv(pattern.c_str(), tns_admin.c_str(), 1);
293 
294  // Check if database is found in tnsnames.ora file
295  std::string filename(tns_admin + "/tnsnames.ora");
296  std::ifstream tnsnames_ora(filename.c_str());
297  bool ok = false;
298  if (tnsnames_ora.is_open()) {
300  while (!tnsnames_ora.eof()) {
301  getline(tnsnames_ora, line);
302  if (!dbParams_.path().empty() && line.find(dbParams_.path()) != std::string::npos) {
303  ok = true;
304  }
305  }
306  } else {
307  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
308  << " Cannot open file \"" << filename << "\"";
309  }
310 
311  if (ok) {
312  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
313  << " Found database account \"" << dbParams_.path() << "\" in file \"" << filename << "\"!";
314  } else {
315  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
316  << " Cannot find database account \"" << dbParams_.path() << "\" in file \""
317  << filename << "\""
318  << " Aborting connection to database...";
319  return;
320  }
321 
322  // Create device factory object
323  try {
324  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
325  << " Creating DeviceFactory object...";
326  factory_ = new DeviceFactory(dbParams_.user(), dbParams_.passwd(), dbParams_.path());
327  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
328  << " Created DeviceFactory object!";
329  } catch (...) {
330  std::stringstream ss;
331  ss << "Failed to connect to database using parameters '" << dbParams_.user() << "/" << pToPrint << "@"
332  << dbParams_.path() << "' and partitions '" << dbParams_.partitionNames(dbParams_.partitionNames()) << "'";
333  handleException(__func__, ss.str());
334  return;
335  }
336 
337  // Check for valid pointer to DeviceFactory
338  if (deviceFactory(__func__)) {
339  std::stringstream ss;
340  ss << "[SiStripConfigDb::" << __func__ << "]"
341  << " DeviceFactory created at address 0x" << std::hex << std::setw(8) << std::setfill('0') << factory_
342  << std::dec << ", using database account with parameters '" << dbParams_.user() << "/" << pToPrint << "@"
343  << dbParams_.path();
344  LogTrace(mlConfigDb_) << ss.str();
345  } else {
346  edm::LogError(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
347  << " NULL pointer to DeviceFactory!"
348  << " Unable to connect to database using connection parameters '" << dbParams_.user()
349  << "/" << pToPrint << "@" << dbParams_.path() << "' and partitions '"
351  return;
352  }
353 
354  try {
355  deviceFactory(__func__)->setUsingDb(dbParams_.usingDb());
356  } catch (...) {
357  handleException(__func__, "Attempted to 'setUsingDb'");
358  }
359 
360  // Retrieve partition name from ENV_CMS_TK_PARTITION env. var. and override .cfg value
361  std::string partition = "ENV_CMS_TK_PARTITION";
362  if (std::getenv(partition.c_str()) != nullptr) {
363  std::stringstream ss;
364  ss << "[SiStripConfigDb::" << __func__ << "]"
365  << " Setting \"partitions\" to \"" << std::getenv(partition.c_str())
366  << "\" using 'ENV_CMS_TK_PARTITION' environmental variable";
367  if (!dbParams_.partitionNames().empty()) {
368  ss << " (Overwriting existing value of \"" << dbParams_.partitionNames(dbParams_.partitionNames())
369  << "\" read from .cfg file)";
370  }
371  edm::LogVerbatim(mlConfigDb_) << ss.str() << std::endl;
372 
373  // Build partitions from env. var.
374  std::vector<std::string> partitions = dbParams_.partitionNames(std::getenv(partition.c_str()));
375  if (!partitions.empty()) {
377  std::vector<std::string>::iterator ii = partitions.begin();
378  std::vector<std::string>::iterator jj = partitions.end();
379  for (; ii != jj; ++ii) {
382  }
383  }
384 
385  } else if (!dbParams_.partitionNames().empty()) {
386  std::stringstream ss;
387  ss << "[SiStripConfigDb::" << __func__ << "]"
388  << " Setting \"partitions\" to \"" << dbParams_.partitionNames(dbParams_.partitionNames())
389  << "\" using 'PartitionName' configurables read from .cfg file";
390  edm::LogVerbatim(mlConfigDb_) << ss.str();
391  } else {
392  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
393  << " Unable to retrieve 'partition' parameter"
394  << " from 'CONFDB' environmental variable or .cfg file!"
395  << " Aborting connection to database...";
396  return;
397  }
398 
399  // Check if should use current state, run number or versions
400  SiStripDbParams::SiStripPartitions::iterator ip = dbParams_.partitions().begin();
401  SiStripDbParams::SiStripPartitions::iterator jp = dbParams_.partitions().end();
402  for (; ip != jp; ++ip) {
403  ip->second.update(this);
404  }
405 }
Log< level::Info, true > LogVerbatim
std::string path() const
bool usingDb() const
std::string passwd() const
DeviceFactory * factory_
static const char dir_[]
Log< level::Error, false > LogError
const_iterator_range partitions() const
std::string user() const
#define LogTrace(id)
static const char mlConfigDb_[]
void partitions(std::list< std::string > &) const
std::vector< std::string > partitionNames() const
Container class for database partition parameters.
std::string confdb() const
ii
Definition: cuy.py:589
std::string tnsAdmin() const
void handleException(const std::string &method_name, const std::string &extra_info="") const
SiStripDbParams dbParams_
void addPartition(const SiStripPartition &)
Log< level::Warning, false > LogWarning
DeviceFactory *const deviceFactory(std::string method_name="") const
static const char null_[]
Definition: Constants.h:22

◆ usingDatabaseCache()

void SiStripConfigDb::usingDatabaseCache ( )
private

Definition at line 409 of file SiStripConfigDb.cc.

References SiStripDbParams::addPartition(), databaseCache(), dbCache_, dbParams_, TauDecayModes::dec, SiStripPartition::defaultPartitionName_, handleException(), LogTrace, sistrip::mlConfigDb_, SiStripDbParams::reset(), SiStripDbParams::sharedMemory(), SiStripPartition, contentValuesCheck::ss, groupFilesInBlocks::temp, SiStripDbParams::usingDb(), and SiStripDbParams::usingDbCache().

Referenced by openDbConnection().

409  {
410  // Reset all DbParams except for those concerning database cache
412  temp = dbParams_;
413  dbParams_.reset();
414  dbParams_.usingDb(temp.usingDb());
415  dbParams_.usingDbCache(temp.usingDbCache());
416  dbParams_.sharedMemory(temp.sharedMemory());
417 
418  // Add default partition
420 
421  // Check shared memory name from .cfg file
422  if (dbParams_.sharedMemory().empty()) {
423  std::stringstream ss;
424  ss << "[SiStripConfigDb::" << __func__ << "]"
425  << " Empty string for shared memory name!"
426  << " Cannot accept shared memory!";
427  edm::LogError(mlConfigDb_) << ss.str();
428  return;
429  }
430 
431  // Create database cache object
432  try {
433  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
434  << " Creating DbClient object...";
435  dbCache_ = new DbClient(dbParams_.sharedMemory());
436  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
437  << " Created DbClient object...";
438  } catch (...) {
439  std::stringstream ss;
440  ss << "Failed to connect to database cache using shared memory name: '" << dbParams_.sharedMemory() << "'!";
441  handleException(__func__, ss.str());
442  return;
443  }
444 
445  // Check for valid pointer to DbClient object
446  if (databaseCache(__func__)) {
447  std::stringstream ss;
448  ss << "[SiStripConfigDb::" << __func__ << "]"
449  << " DbClient object created at address 0x" << std::hex << std::setw(8) << std::setfill('0') << dbCache_
450  << std::dec << " using shared memory name '" << dbParams_.sharedMemory() << "'";
451  LogTrace(mlConfigDb_) << ss.str();
452  } else {
453  edm::LogError(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
454  << " NULL pointer to DbClient object!"
455  << " Unable to connect to database cache using shared memory name '"
456  << dbParams_.sharedMemory() << "'";
457  return;
458  }
459 
460  // Try retrieve descriptions from Database Client
461  try {
462  databaseCache(__func__)->parse();
463  } catch (...) {
464  handleException(__func__, "Attempted to called DbClient::parse() method");
465  }
466 }
bool usingDb() const
static const std::string defaultPartitionName_
DbClient *const databaseCache(std::string method_name="") const
Log< level::Error, false > LogError
#define LogTrace(id)
static const char mlConfigDb_[]
Container class for database connection parameters.
void handleException(const std::string &method_name, const std::string &extra_info="") const
std::string sharedMemory() const
SiStripDbParams dbParams_
DbClient * dbCache_
friend class SiStripPartition
void addPartition(const SiStripPartition &)
bool usingDbCache() const

◆ usingDb()

bool SiStripConfigDb::usingDb ( ) const
inlineprotected

Returns whether using database or xml files.

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

Definition at line 424 of file SiStripConfigDb.h.

References dbParams_, and SiStripDbParams::usingDb().

424 { return dbParams_.usingDb(); }
bool usingDb() const
SiStripDbParams dbParams_

◆ usingStrips() [1/2]

bool SiStripConfigDb::usingStrips ( ) const
inlineprotected

Strip-level info enabled/disabled within FED descriptions.

Indicates whether FED strip info is uploaded/downloaded.

Definition at line 427 of file SiStripConfigDb.h.

References usingStrips_.

427 { return usingStrips_; }

◆ usingStrips() [2/2]

void SiStripConfigDb::usingStrips ( bool  using_strips)
inlineprotected

Enables/disables strip-level info within FED descriptions.

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

Definition at line 430 of file SiStripConfigDb.h.

References usingStrips_.

430 { usingStrips_ = using_strips; }

◆ usingXmlFiles()

void SiStripConfigDb::usingXmlFiles ( )
private

Definition at line 470 of file SiStripConfigDb.cc.

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

Referenced by openDbConnection().

470  {
471  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
472  << " Using XML description files...";
473 
474  // Create device factory object
475  try {
476  factory_ = new DeviceFactory();
477  } catch (...) {
478  handleException(__func__, "Attempting to create DeviceFactory for use with xml files");
479  }
480 
481  // Check for valid pointer to DeviceFactory
482  if (deviceFactory(__func__)) {
483  std::stringstream ss;
484  ss << "[SiStripConfigDb::" << __func__ << "]"
485  << " DeviceFactory created at address 0x" << std::hex << std::setw(8) << std::setfill('0') << factory_
486  << std::dec << ", using XML description files";
487  LogTrace(mlConfigDb_) << ss.str();
488  } else {
489  edm::LogError(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
490  << " NULL pointer to DeviceFactory!"
491  << " Unable to connect to database!";
492  return;
493  }
494 
495  try {
496  deviceFactory(__func__)->setUsingDb(dbParams_.usingDb());
497  } catch (...) {
498  handleException(__func__, "Attempted to 'setUsingDb'");
499  }
500 
501  // Iterate through partitions
502  SiStripDbParams::SiStripPartitions::const_iterator ip = dbParams_.partitions().begin();
503  SiStripDbParams::SiStripPartitions::const_iterator jp = dbParams_.partitions().end();
504  for (; ip != jp; ++ip) {
505  // Input module.xml file
506  if (ip->second.inputModuleXml().empty()) {
507  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
508  << " NULL path to input 'module.xml' file!";
509  } else {
510  if (checkFileExists(ip->second.inputModuleXml())) {
511  try {
512  deviceFactory(__func__)->addConnectionFileName(ip->second.inputModuleXml());
513  } catch (...) {
514  handleException(__func__);
515  }
516  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
517  << " Added input 'module.xml' file: " << ip->second.inputModuleXml();
518  } else {
519  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
520  << " No 'module.xml' file found at " << ip->second.inputModuleXml();
521  ip->second.inputModuleXml() = "";
522  }
523  }
524 
525  // Input dcuinfo.xml file
526  if (ip->second.inputDcuInfoXml().empty()) {
527  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
528  << " NULL path to input 'dcuinfo.xml' file!";
529  } else {
530  if (checkFileExists(ip->second.inputDcuInfoXml())) {
531  try {
532  deviceFactory(__func__)->addTkDcuInfoFileName(ip->second.inputDcuInfoXml());
533  } catch (...) {
534  handleException(__func__);
535  }
536  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
537  << " Added 'dcuinfo.xml' file: " << ip->second.inputDcuInfoXml();
538  } else {
539  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
540  << " No 'dcuinfo.xml' file found at " << ip->second.inputDcuInfoXml();
541  ip->second.inputDcuInfoXml() = "";
542  }
543  }
544 
545  // Input FEC xml files
546  if (ip->second.inputFecXml().empty()) {
547  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
548  << " NULL paths to input 'fec.xml' files!";
549  } else {
550  for (const auto& iter : ip->second.inputFecXml()) {
551  if (iter.empty()) {
552  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
553  << " NULL path to input 'fec.xml' file!";
554  } else {
555  if (checkFileExists(iter)) {
556  try {
557  deviceFactory(__func__)->addFecFileName(iter);
558  } catch (...) {
559  handleException(__func__);
560  }
561  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
562  << " Added 'fec.xml' file: " << iter;
563  } else {
564  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
565  << " No 'fec.xml' file found at " << iter;
566  }
567  }
568  }
569  }
570 
571  // Input FED xml files
572  if (ip->second.inputFedXml().empty()) {
573  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
574  << " NULL paths to input 'fed.xml' files!";
575  } else {
576  for (const auto& iter : ip->second.inputFedXml()) {
577  if (iter.empty()) {
578  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
579  << " NULL path to input 'fed.xml' file!";
580  } else {
581  if (checkFileExists(iter)) {
582  try {
583  deviceFactory(__func__)->addFedFileName(iter);
584  } catch (...) {
585  handleException(__func__);
586  }
587  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
588  << " Added 'fed.xml' file: " << iter;
589  } else {
590  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
591  << " No 'fed.xml' file found at " << iter;
592  }
593  }
594  }
595  }
596  }
597 
598  // Output module.xml file
599  if (dbParams_.outputModuleXml().empty()) {
600  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
601  << " NULL path to output 'module.xml' file!"
602  << " Setting to '/tmp/module.xml'...";
603  dbParams_.outputModuleXml() = "/tmp/module.xml";
604  } else {
605  try {
606  ConnectionFactory* factory = deviceFactory(__func__);
607  factory->setOutputFileName(dbParams_.outputModuleXml());
608  } catch (...) {
609  handleException(__func__, "Problems setting output 'module.xml' file!");
610  }
611  }
612 
613  // Output dcuinfo.xml file
614  if (dbParams_.outputDcuInfoXml().empty()) {
615  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
616  << " NULL path to output 'dcuinfo.xml' file!"
617  << " Setting to '/tmp/dcuinfo.xml'...";
618  dbParams_.outputModuleXml() = "/tmp/dcuinfo.xml";
619  } else {
620  try {
621  TkDcuInfoFactory* factory = deviceFactory(__func__);
622  factory->setOutputFileName(dbParams_.outputDcuInfoXml());
623  } catch (...) {
624  handleException(__func__, "Problems setting output 'dcuinfo.xml' file!");
625  }
626  }
627 
628  // Output fec.xml file
629  if (dbParams_.outputFecXml().empty()) {
630  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
631  << " NULL path to output 'fec.xml' file!"
632  << " Setting to '/tmp/fec.xml'...";
633  dbParams_.outputFecXml() = "/tmp/fec.xml";
634  } else {
635  try {
636  FecDeviceFactory* factory = deviceFactory(__func__);
637  factory->setOutputFileName(dbParams_.outputFecXml());
638  } catch (...) {
639  handleException(__func__, "Problems setting output 'fec.xml' file!");
640  }
641  }
642 
643  // Output fed.xml file
644  if (dbParams_.outputFedXml().empty()) {
645  edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
646  << " NULL path to output 'fed.xml' file!"
647  << " Setting to '/tmp/fed.xml'...";
648  dbParams_.outputFedXml() = "/tmp/fed.xml";
649  } else {
650  try {
651  Fed9U::Fed9UDeviceFactory* factory = deviceFactory(__func__);
652  factory->setOutputFileName(dbParams_.outputFedXml());
653  } catch (...) {
654  handleException(__func__, "Problems setting output 'fed.xml' file!");
655  }
656  }
657 }
bool usingDb() const
DeviceFactory * factory_
std::string outputFecXml() const
std::string outputModuleXml() const
std::string outputFedXml() const
Log< level::Error, false > LogError
bool checkFileExists(const std::string &path)
const_iterator_range partitions() const
#define LogTrace(id)
static const char mlConfigDb_[]
std::string outputDcuInfoXml() const
void handleException(const std::string &method_name, const std::string &extra_info="") const
SiStripDbParams dbParams_
Log< level::Warning, false > LogWarning
DeviceFactory *const deviceFactory(std::string method_name="") const

Friends And Related Function Documentation

◆ ApvTimingHistosUsingDb

friend class ApvTimingHistosUsingDb
friend

Definition at line 82 of file SiStripConfigDb.h.

◆ CalibrationHistosUsingDb

friend class CalibrationHistosUsingDb
friend

Definition at line 91 of file SiStripConfigDb.h.

◆ CommissioningHistosUsingDb

friend class CommissioningHistosUsingDb
friend

Definition at line 79 of file SiStripConfigDb.h.

◆ DaqScopeModeHistosUsingDb

friend class DaqScopeModeHistosUsingDb
friend

Definition at line 92 of file SiStripConfigDb.h.

◆ FastFedCablingHistosUsingDb

friend class FastFedCablingHistosUsingDb
friend

Definition at line 80 of file SiStripConfigDb.h.

◆ FedCablingHistosUsingDb

friend class FedCablingHistosUsingDb
friend

Definition at line 81 of file SiStripConfigDb.h.

◆ FineDelayHistosUsingDb

friend class FineDelayHistosUsingDb
friend

Definition at line 90 of file SiStripConfigDb.h.

◆ LatencyHistosUsingDb

friend class LatencyHistosUsingDb
friend

Definition at line 89 of file SiStripConfigDb.h.

◆ NoiseHistosUsingDb

friend class NoiseHistosUsingDb
friend

Definition at line 87 of file SiStripConfigDb.h.

◆ OptoScanHistosUsingDb

friend class OptoScanHistosUsingDb
friend

Definition at line 83 of file SiStripConfigDb.h.

◆ PedestalsHistosUsingDb

friend class PedestalsHistosUsingDb
friend

Definition at line 84 of file SiStripConfigDb.h.

◆ PedsFullNoiseHistosUsingDb

friend class PedsFullNoiseHistosUsingDb
friend

Definition at line 85 of file SiStripConfigDb.h.

◆ PedsOnlyHistosUsingDb

friend class PedsOnlyHistosUsingDb
friend

Definition at line 86 of file SiStripConfigDb.h.

◆ SiStripCommissioningDbClient

friend class SiStripCommissioningDbClient
friend

Definition at line 77 of file SiStripConfigDb.h.

◆ SiStripCommissioningOfflineDbClient

Definition at line 78 of file SiStripConfigDb.h.

◆ SiStripCondObjBuilderFromDb

friend class SiStripCondObjBuilderFromDb
friend

Definition at line 73 of file SiStripConfigDb.h.

◆ SiStripFedCablingBuilderFromDb

friend class SiStripFedCablingBuilderFromDb
friend

Definition at line 70 of file SiStripConfigDb.h.

◆ SiStripNoiseBuilderFromDb

friend class SiStripNoiseBuilderFromDb
friend

Definition at line 72 of file SiStripConfigDb.h.

◆ SiStripPartition

friend class SiStripPartition
friend

Definition at line 95 of file SiStripConfigDb.h.

Referenced by usingDatabaseCache().

◆ SiStripPedestalsBuilderFromDb

friend class SiStripPedestalsBuilderFromDb
friend

Definition at line 71 of file SiStripConfigDb.h.

◆ SiStripPsuDetIdMap

friend class SiStripPsuDetIdMap
friend

Definition at line 74 of file SiStripConfigDb.h.

◆ testSiStripConfigDb

friend class testSiStripConfigDb
friend

Definition at line 96 of file SiStripConfigDb.h.

◆ VpspScanHistosUsingDb

friend class VpspScanHistosUsingDb
friend

Definition at line 88 of file SiStripConfigDb.h.

Member Data Documentation

◆ allowCalibUpload_

std::atomic< bool > SiStripConfigDb::allowCalibUpload_ {false}
staticprivate

Definition at line 415 of file SiStripConfigDb.h.

◆ analyses_

AnalysisDescriptions SiStripConfigDb::analyses_
private

Analysis descriptions for given commissioning run.

Definition at line 378 of file SiStripConfigDb.h.

◆ apvDevices_

DeviceDescriptionsV SiStripConfigDb::apvDevices_
private

Cache for devices of given type.

Definition at line 381 of file SiStripConfigDb.h.

◆ cntr_

std::atomic< uint32_t > SiStripConfigDb::cntr_ {0}
staticprivate

Static counter of instances of this class.

Definition at line 413 of file SiStripConfigDb.h.

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

◆ connections_

FedConnections SiStripConfigDb::connections_
private

FED-FEC connection descriptions.

Definition at line 366 of file SiStripConfigDb.h.

◆ dbCache_

DbClient* SiStripConfigDb::dbCache_
private

Pointer to the DbClient class.

Definition at line 358 of file SiStripConfigDb.h.

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

◆ dbParams_

SiStripDbParams SiStripConfigDb::dbParams_
private

Instance of struct that holds all DB connection parameters.

Definition at line 361 of file SiStripConfigDb.h.

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

◆ dcuDetIds_

DcuDetIds SiStripConfigDb::dcuDetIds_
private

DcuId-DetId map (map of TkDcuInfo objects).

Definition at line 375 of file SiStripConfigDb.h.

◆ dcuDevices_

DeviceDescriptionsV SiStripConfigDb::dcuDevices_
private

Cache for devices of given type.

Definition at line 387 of file SiStripConfigDb.h.

◆ devices_

DeviceDescriptions SiStripConfigDb::devices_
private

Device descriptions (including DCUs).

Definition at line 369 of file SiStripConfigDb.h.

◆ dohDevices_

DeviceDescriptionsV SiStripConfigDb::dohDevices_
private

Cache for devices of given type.

Definition at line 396 of file SiStripConfigDb.h.

◆ factory_

DeviceFactory* SiStripConfigDb::factory_
private

Pointer to the DeviceFactory API.

Definition at line 355 of file SiStripConfigDb.h.

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

◆ fedIds_

FedIds SiStripConfigDb::fedIds_
private

FED ids.

Definition at line 402 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

◆ feds_

FedDescriptions SiStripConfigDb::feds_
private

Fed9U descriptions.

Definition at line 372 of file SiStripConfigDb.h.

◆ lldDevices_

DeviceDescriptionsV SiStripConfigDb::lldDevices_
private

Cache for devices of given type.

Definition at line 390 of file SiStripConfigDb.h.

◆ muxDevices_

DeviceDescriptionsV SiStripConfigDb::muxDevices_
private

Cache for devices of given type.

Definition at line 384 of file SiStripConfigDb.h.

◆ openConnection_

bool SiStripConfigDb::openConnection_
private

Definition at line 410 of file SiStripConfigDb.h.

Referenced by closeDbConnection(), and openDbConnection().

◆ pllDevices_

DeviceDescriptionsV SiStripConfigDb::pllDevices_
private

Cache for devices of given type.

Definition at line 393 of file SiStripConfigDb.h.

◆ typedDevices_

DeviceDescriptionsV SiStripConfigDb::typedDevices_
private

Cache for devices of given type.

Definition at line 399 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

◆ usingStrips_

bool SiStripConfigDb::usingStrips_
private

Switch to enable/disable transfer of strip information.

Definition at line 407 of file SiStripConfigDb.h.

Referenced by usingStrips().