CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, DcuDetId
DcuDetIds
 
typedef DcuDetIds::range DcuDetIdsRange
 
typedef std::vector< DcuDetIdDcuDetIdsV
 
typedef deviceDescription DeviceDescription
 
typedef edm::MapOfVectors
< std::string,
DeviceDescription * > 
DeviceDescriptions
 
typedef DeviceDescriptions::range DeviceDescriptionsRange
 
typedef std::vector
< DeviceDescription * > 
DeviceDescriptionsV
 
typedef enumDeviceType DeviceType
 
typedef ConnectionDescription FedConnection
 
typedef edm::MapOfVectors
< std::string, FedConnection * > 
FedConnections
 
typedef FedConnections::range FedConnectionsRange
 
typedef std::vector
< FedConnection * > 
FedConnectionsV
 
typedef Fed9U::Fed9UDescription FedDescription
 
typedef edm::MapOfVectors
< std::string, FedDescription * > 
FedDescriptions
 
typedef FedDescriptions::range FedDescriptionsRange
 
typedef std::vector
< FedDescription * > 
FedDescriptionsV
 
typedef std::vector< uint16_t > FedIds
 
typedef boost::iterator_range
< FedIds::const_iterator > 
FedIdsRange
 
typedef std::vector< RunRuns
 
typedef std::map< std::string,
Runs
RunsByPartition
 
typedef std::map
< sistrip::RunType, Runs
RunsByType
 

Protected Member Functions

void addAnalysisDescriptions (std::string partition, AnalysisDescriptionsV &)
 
void addDcuDetIds (std::string partition, DcuDetIdsV &)
 
void addDeviceDescriptions (std::string partition, DeviceDescriptionsV &)
 
void addFedConnections (std::string partition, FedConnectionsV &)
 
void addFedDescriptions (std::string partition, FedDescriptionsV &)
 
std::string analysisType (AnalysisType) const
 
void clearAnalysisDescriptions (std::string partition="")
 
void clearDcuDetIds (std::string partition="")
 
void clearDeviceDescriptions (std::string partition="")
 
void clearFedConnections (std::string partition="")
 
void clearFedDescriptions (std::string partition="")
 
void closeDbConnection ()
 
DbClient *const databaseCache (std::string method_name="") const
 
const SiStripDbParamsdbParams () const
 
DeviceAddress deviceAddress (const 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 bool allowCalibUpload_ = false
 
static uint32_t cntr_ = 0
 

Friends

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

Detailed Description

An interface class to the DeviceFactory.

Author
R.Bainbridge

Definition at line 44 of file SiStripConfigDb.h.

Member Typedef Documentation

typedef CommissioningAnalysisDescription SiStripConfigDb::AnalysisDescription
protected

Definition at line 141 of file SiStripConfigDb.h.

Definition at line 142 of file SiStripConfigDb.h.

Definition at line 143 of file SiStripConfigDb.h.

Definition at line 144 of file SiStripConfigDb.h.

typedef CommissioningAnalysisDescription::commissioningType SiStripConfigDb::AnalysisType
protected

Definition at line 140 of file SiStripConfigDb.h.

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

Definition at line 133 of file SiStripConfigDb.h.

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

Definition at line 132 of file SiStripConfigDb.h.

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

Definition at line 134 of file SiStripConfigDb.h.

Definition at line 135 of file SiStripConfigDb.h.

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

Definition at line 136 of file SiStripConfigDb.h.

typedef deviceDescription SiStripConfigDb::DeviceDescription
protected

Definition at line 116 of file SiStripConfigDb.h.

Definition at line 117 of file SiStripConfigDb.h.

Definition at line 118 of file SiStripConfigDb.h.

Definition at line 119 of file SiStripConfigDb.h.

typedef enumDeviceType SiStripConfigDb::DeviceType
protected

Definition at line 115 of file SiStripConfigDb.h.

typedef ConnectionDescription SiStripConfigDb::FedConnection
protected

Definition at line 109 of file SiStripConfigDb.h.

Definition at line 110 of file SiStripConfigDb.h.

Definition at line 111 of file SiStripConfigDb.h.

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

Definition at line 112 of file SiStripConfigDb.h.

typedef Fed9U::Fed9UDescription SiStripConfigDb::FedDescription
protected

Definition at line 122 of file SiStripConfigDb.h.

Definition at line 123 of file SiStripConfigDb.h.

Definition at line 124 of file SiStripConfigDb.h.

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

Definition at line 125 of file SiStripConfigDb.h.

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

Definition at line 128 of file SiStripConfigDb.h.

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

Definition at line 129 of file SiStripConfigDb.h.

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

Definition at line 202 of file SiStripConfigDb.h.

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

Definition at line 206 of file SiStripConfigDb.h.

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

Definition at line 204 of file SiStripConfigDb.h.

Constructor & Destructor Documentation

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

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

Definition at line 21 of file SiStripConfigDb.cc.

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

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

Default destructor.

Definition at line 62 of file SiStripConfigDb.cc.

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

62  {
65  << "[SiStripConfigDb::" << __func__ << "]"
66  << " Destructing object...";
67  if ( cntr_ ) { cntr_--; }
68 }
static const char mlConfigDb_[]
static uint32_t cntr_
#define LogTrace(id)

Member Function Documentation

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

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

Definition at line 160 of file AnalysisDescriptions.cc.

References getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, contentValuesCheck::ss, and tmp.

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

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

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

Definition at line 108 of file DcuDetIds.cc.

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

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

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

Definition at line 199 of file DeviceDescriptions.cc.

References getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, contentValuesCheck::ss, and tmp.

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

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

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

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

Definition at line 131 of file FedDescriptions.cc.

References getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, contentValuesCheck::ss, and tmp.

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

Returns string for given analysis type.

Definition at line 512 of file AnalysisDescriptions.cc.

512  {
513  if ( analysis_type == AnalysisDescription::T_ANALYSIS_FASTFEDCABLING ) { return "FAST_CABLING"; }
514  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_TIMING ) { return "APV_TIMING"; }
515  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_OPTOSCAN ) { return "OPTO_SCAN"; }
516  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDESTALS ) { return "PEDESTALS"; }
517  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY ) { return "APV_LATENCY"; }
518  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_FINEDELAY ) { return "FINE_DELAY"; }
519  else if ( analysis_type == AnalysisDescription::T_ANALYSIS_CALIBRATION ) { return "CALIBRATION"; }
520  else if ( analysis_type == AnalysisDescription::T_UNKNOWN ) { return "UNKNOWN ANALYSIS TYPE"; }
521  else { return "UNDEFINED ANALYSIS TYPE"; }
522 }
bool SiStripConfigDb::checkFileExists ( const std::string &  path)
private

Checks whether file at "path" exists or not.

Definition at line 809 of file SiStripConfigDb.cc.

References recoMuon::in.

Referenced by usingXmlFiles().

809  {
810  fstream fs;
811  fs.open( path.c_str(), ios::in );
812  if( !fs.is_open() ) { return false; }
813  fs.close();
814  return true;
815 }
tuple path
else: Piece not in the list, fine.
void SiStripConfigDb::clearAnalysisDescriptions ( std::string  partition = "")
protected

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

Definition at line 326 of file AnalysisDescriptions.cc.

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

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

326  {
327  LogTrace(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]";
328 
329  if ( analyses_.empty() ) {
330  stringstream ss;
331  ss << "[SiStripConfigDb::" << __func__ << "]"
332  << " Found no cached analysis descriptions!";
333  //edm::LogWarning(mlConfigDb_) << ss.str();
334  return;
335  }
336 
337  // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified)
338  AnalysisDescriptions temporary_cache;
339  if ( partition == "" ) { temporary_cache = AnalysisDescriptions(); }
340  else {
341  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
342  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
343  for ( ; iter != jter; ++iter ) {
344  if ( partition != iter->second.partitionName() ) {
345  AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() );
346  if ( range != analyses_.emptyRange() ) {
347  temporary_cache.loadNext( partition, AnalysisDescriptionsV( range.begin(), range.end() ) );
348  } else {
349  // stringstream ss;
350  // ss << "[SiStripConfigDb::" << __func__ << "]"
351  // << " Cannot find partition \"" << iter->second.partitionName()
352  // << "\" in local cache!";
353  // edm::LogWarning(mlConfigDb_) << ss.str();
354  }
355  }
356  }
357  }
358 
359  // Delete objects in local cache for specified partition (or all if not specified)
361  if ( partition == "" ) {
362  if ( !analyses_.empty() ) {
363  anals = AnalysisDescriptionsRange( analyses_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
364  analyses_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
365  } else { anals = analyses_.emptyRange(); }
366  } else {
367  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
368  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
369  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
370  anals = analyses_.find( iter->second.partitionName() );
371  }
372 
373  if ( anals != analyses_.emptyRange() ) {
374  AnalysisDescriptionsV::const_iterator ianal = anals.begin();
375  AnalysisDescriptionsV::const_iterator janal = anals.end();
376  for ( ; ianal != janal; ++ianal ) { if ( *ianal ) { delete *ianal; } }
377  } else {
378  stringstream ss;
379  ss << "[SiStripConfigDb::" << __func__ << "]";
380  if ( partition == "" ) { ss << " Found no analysis descriptions in local cache!"; }
381  else { ss << " Found no analysis descriptions in local cache for partition \"" << partition << "\"!"; }
382  edm::LogWarning(mlConfigDb_) << ss.str();
383  }
384 
385  // Overwrite local cache with temporary cache
386  analyses_ = temporary_cache;
387 
388 }
AnalysisDescriptions analyses_
static const char mlConfigDb_[]
const_iterator_range partitions() const
edm::MapOfVectors< std::string, AnalysisDescription * > AnalysisDescriptions
#define end
Definition: vmac.h:37
range find(K const &k) const
Definition: MapOfVectors.h:120
#define LogTrace(id)
AnalysisDescriptions::range AnalysisDescriptionsRange
range emptyRange() const
Definition: MapOfVectors.h:80
bool empty() const
Definition: MapOfVectors.h:106
SiStripDbParams dbParams_
#define begin
Definition: vmac.h:30
std::vector< AnalysisDescription * > AnalysisDescriptionsV
void SiStripConfigDb::clearDcuDetIds ( std::string  partition = "")
protected

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

Definition at line 272 of file DcuDetIds.cc.

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

Referenced by clearLocalCache().

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

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

Definition at line 345 of file DeviceDescriptions.cc.

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

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

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

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

Definition at line 278 of file FedConnections.cc.

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

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

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

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

Definition at line 278 of file FedDescriptions.cc.

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

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

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

Definition at line 176 of file SiStripConfigDb.cc.

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

Referenced by closeDbConnection(), and openDbConnection().

176  {
177 
179  << "[SiStripConfigDb::" << __func__ << "]"
180  << " Clearing local caches...";
181 
185  clearDcuDetIds();
187 
188  typedDevices_.clear();
189  fedIds_.clear();
190 
191 }
DeviceDescriptionsV typedDevices_
void clearDeviceDescriptions(std::string partition="")
static const char mlConfigDb_[]
void clearAnalysisDescriptions(std::string partition="")
#define LogTrace(id)
void clearFedConnections(std::string partition="")
void clearDcuDetIds(std::string partition="")
Definition: DcuDetIds.cc:272
void clearFedDescriptions(std::string partition="")
void SiStripConfigDb::clone ( const DcuDetIdMap in,
DcuDetIdsV out 
) const
private

Definition at line 368 of file DcuDetIds.cc.

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

368  {
369  output.clear();
370  DcuDetIdMap::const_iterator ii = input.begin();
371  DcuDetIdMap::const_iterator jj = input.end();
372  for ( ; ii != jj; ++ii ) { if ( ii->second ) { output.push_back( std::make_pair( ii->first, new TkDcuInfo( *(ii->second) ) ) ); } }
373 }
int ii
Definition: cuy.py:588
static std::string const input
Definition: EdmProvDump.cc:44
void SiStripConfigDb::clone ( const DcuDetIdsV in,
DcuDetIdMap out 
) const
private

Definition at line 377 of file DcuDetIds.cc.

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

377  {
378  output.clear();
379  DcuDetIdsV::const_iterator ii = input.begin();
380  DcuDetIdsV::const_iterator jj = input.end();
381  for ( ; ii != jj; ++ii ) { if ( ii->second ) { output[ii->first] = new TkDcuInfo( *(ii->second) ); } }
382 }
int ii
Definition: cuy.py:588
static std::string const input
Definition: EdmProvDump.cc:44
void SiStripConfigDb::clone ( const DcuDetIdsV in,
DcuDetIdsV out 
) const
private

Definition at line 386 of file DcuDetIds.cc.

References cuy::ii, 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 ) { if ( ii->second ) { output.push_back( std::make_pair( ii->first, new TkDcuInfo( *(ii->second) ) ) ); } }
391 }
int ii
Definition: cuy.py:588
static std::string const input
Definition: EdmProvDump.cc:44
void SiStripConfigDb::closeDbConnection ( )
protected

Closes connection to DeviceFactory API.

Definition at line 140 of file SiStripConfigDb.cc.

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

Referenced by ~SiStripConfigDb().

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

Returns pointer to DeviceFactory API, with check if NULL.

Definition at line 211 of file SiStripConfigDb.cc.

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

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

211  {
212  if ( dbCache_ ) { return dbCache_; }
213  else {
214  if ( method_name != "" ) {
215  stringstream ss;
216  ss << "[SiStripConfigDb::" << __func__ << "]"
217  << " NULL pointer to DbClient requested by"
218  << " method SiStripConfigDb::" << method_name << "()!";
219  edm::LogWarning(mlConfigDb_) << ss.str();
220  }
221  return 0;
222  }
223 }
static const char mlConfigDb_[]
DbClient * dbCache_
const SiStripDbParams & SiStripConfigDb::dbParams ( ) const
inlineprotected
SiStripConfigDb::DeviceAddress SiStripConfigDb::deviceAddress ( const deviceDescription &  description)
protected

Extracts unique hardware address of device from description.

Definition at line 513 of file DeviceDescriptions.cc.

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

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

513  {
514 
515  deviceDescription& desc = const_cast<deviceDescription&>(description);
516 
517  DeviceAddress addr;
518  try {
519  addr.fecCrate_ = static_cast<uint16_t>( desc.getCrateId() + sistrip::FEC_CRATE_OFFSET ); //@@ temporary offset?
520  addr.fecSlot_ = static_cast<uint16_t>( desc.getFecSlot() );
521  addr.fecRing_ = static_cast<uint16_t>( desc.getRingSlot() + sistrip::FEC_RING_OFFSET ); //@@ temporary offset?
522  addr.ccuAddr_ = static_cast<uint16_t>( desc.getCcuAddress() );
523  addr.ccuChan_ = static_cast<uint16_t>( desc.getChannel() );
524  addr.lldChan_ = static_cast<uint16_t>( SiStripFecKey::lldChan( desc.getAddress() ) );
525  addr.i2cAddr_ = static_cast<uint16_t>( desc.getAddress() );
526  } catch (...) { handleException( __func__ ); }
527 
528  return addr;
529 }
void handleException(const std::string &method_name, const std::string &extra_info="") const
static const uint16_t FEC_RING_OFFSET
const uint16_t & lldChan() const
tuple description
Definition: idDealer.py:66
static const uint16_t FEC_CRATE_OFFSET
SiStripConfigDb::DeviceAddress SiStripConfigDb::deviceAddress ( const AnalysisDescription desc)
protected

Extracts unique hardware address of device from description.

Definition at line 491 of file AnalysisDescriptions.cc.

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

491  {
492 
493  DeviceAddress addr;
494  try {
495  addr.fecCrate_ = static_cast<uint16_t>( desc.getCrate() + sistrip::FEC_CRATE_OFFSET );
496  addr.fecSlot_ = static_cast<uint16_t>( desc.getSlot() );
497  addr.fecRing_ = static_cast<uint16_t>( desc.getRing() + sistrip::FEC_RING_OFFSET );
498  addr.ccuAddr_ = static_cast<uint16_t>( desc.getCcuAdr() );
499  addr.ccuChan_ = static_cast<uint16_t>( desc.getCcuChan() );
500  addr.lldChan_ = static_cast<uint16_t>( SiStripFecKey::lldChan( desc.getI2cAddr() ) );
501  addr.i2cAddr_ = static_cast<uint16_t>( desc.getI2cAddr() );
502  addr.fedId_ = static_cast<uint16_t>( desc.getFedId() ); //@@ offset required? crate/slot needed?
503  addr.feUnit_ = static_cast<uint16_t>( desc.getFeUnit() );
504  addr.feChan_ = static_cast<uint16_t>( desc.getFeChan() );
505  } catch (...) { handleException( __func__ ); }
506 
507  return addr;
508 }
void handleException(const std::string &method_name, const std::string &extra_info="") const
static const uint16_t FEC_RING_OFFSET
const uint16_t & lldChan() const
static const uint16_t FEC_CRATE_OFFSET
DeviceFactory *const SiStripConfigDb::deviceFactory ( std::string  method_name = "") const
protected

Returns pointer to DeviceFactory API, with check if NULL.

Definition at line 195 of file SiStripConfigDb.cc.

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

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

195  {
196  if ( factory_ ) { return factory_; }
197  else {
198  if ( method_name != "" ) {
199  stringstream ss;
200  ss << "[SiStripConfigDb::" << __func__ << "]"
201  << " NULL pointer to DeviceFactory requested by"
202  << " method SiStripConfigDb::" << method_name << "()!";
203  edm::LogWarning(mlConfigDb_) << ss.str();
204  }
205  return 0;
206  }
207 }
DeviceFactory * factory_
static const char mlConfigDb_[]
string SiStripConfigDb::deviceType ( const enumDeviceType &  device_type) const
private

Returns device identifier based on device type.

Definition at line 533 of file DeviceDescriptions.cc.

533  {
534  if ( device_type == PLL ) { return "PLL"; }
535  else if ( device_type == LASERDRIVER ) { return "LLD"; }
536  else if ( device_type == DOH ) { return "DOH"; }
537  else if ( device_type == APVMUX ) { return "MUX"; }
538  else if ( device_type == APV25 ) { return "APV"; }
539  else if ( device_type == DCU ) { return "DCU"; }
540  else if ( device_type == GOH ) { return "GOH"; }
541  else { return "UNKNOWN DEVICE!"; }
542 }
SiStripConfigDb::DcuDetIdsV::const_iterator SiStripConfigDb::findDcuDetId ( DcuDetIdsV::const_iterator  begin,
DcuDetIdsV::const_iterator  end,
uint32_t  dcu_id 
)
staticprotected

Utility method.

Definition at line 395 of file DcuDetIds.cc.

References begin, end, and getDQMSummary::iter.

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

397  {
398  DcuDetIdsV::const_iterator iter = begin;
399  DcuDetIdsV::const_iterator jter = end;
400  for ( ; iter != jter; ++iter ) {
401  if ( iter->second && iter->second->getDcuHardId() == dcu_id ) { return iter; }
402  }
403  return end;
404 }
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
SiStripConfigDb::DcuDetIdsV::iterator SiStripConfigDb::findDcuDetId ( DcuDetIdsV::iterator  begin,
DcuDetIdsV::iterator  end,
uint32_t  dcu_id 
)
staticprotected

Utility method.

Definition at line 408 of file DcuDetIds.cc.

References begin, end, and getDQMSummary::iter.

410  {
411  DcuDetIdsV::iterator iter = begin;
412  DcuDetIdsV::iterator jter = end;
413  for ( ; iter != jter; ++iter ) {
414  if ( iter->second && iter->second->getDcuHardId() == dcu_id ) { return iter; }
415  }
416  return end;
417 }
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
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 begin, SiStripPartition::defaultPartitionName_, end, getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, np, and contentValuesCheck::ss.

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

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

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

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

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

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

127  {
128 
129  typedDevices_.clear();
130  apvDevices_.clear();
131  muxDevices_.clear();
132  dcuDevices_.clear();
133  lldDevices_.clear();
134  pllDevices_.clear();
135  dohDevices_.clear();
136 
138 
139  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
140  ( dbParams_.usingDbCache() && !databaseCache(__func__) ) ) {
141  return tmp;
142  }
143 
144  try {
146  if ( !devs.empty() ) {
147  DeviceDescriptionsV tmp( devs.begin(), devs.end() );
148  typedDevices_ = FecFactory::getDeviceFromDeviceVector( tmp, device_type );
149  }
150  } catch (...) { handleException( __func__ ); }
151 
152  if ( device_type == APV25 ) {
153  apvDevices_.swap( typedDevices_ );
155  } else if ( device_type == APVMUX ) {
156  muxDevices_.swap( typedDevices_ );
158  } else if ( device_type == DCU ) {
159  dcuDevices_.swap( typedDevices_ );
161  } else if ( device_type == LASERDRIVER ) {
162  lldDevices_.swap( typedDevices_ );
164  } else if ( device_type == PLL ) {
165  pllDevices_.swap( typedDevices_ );
167  } else if ( device_type == DOH ) {
168  dohDevices_.swap( typedDevices_ );
170  } else {
172  }
173 
174 // stringstream sss;
175 // sss << " Number of devices:"
176 // << " TYP: " << typedDevices_.size()
177 // << " APV: " << apvDevices_.size()
178 // << " MUX: " << muxDevices_.size()
179 // << " DCU: " << dcuDevices_.size()
180 // << " LLD: " << lldDevices_.size()
181 // << " PLL: " << pllDevices_.size()
182 // << " DOH: " << dohDevices_.size()
183 // << " tmp: " << tmp.size();
184 // LogTrace(mlConfigDb_) << sss.str();
185 
186  stringstream ss;
187  ss << "[SiStripConfigDb::" << __func__ << "]"
188  << " Extracted " << tmp.size()
189  << " device descriptions (for devices of type "
190  << deviceType( device_type ) << ")";
191  LogTrace(mlConfigDb_) << ss.str();
192 
193  return tmp;
194 
195 }
DeviceDescriptionsV apvDevices_
DeviceDescriptionsV typedDevices_
DeviceDescriptionsV dohDevices_
DeviceDescriptionsV lldDevices_
DeviceFactory *const deviceFactory(std::string method_name="") const
void handleException(const std::string &method_name, const std::string &extra_info="") const
DeviceDescriptionsV pllDevices_
static const char mlConfigDb_[]
DeviceDescriptionsV dcuDevices_
DeviceDescriptions::range DeviceDescriptionsRange
#define LogTrace(id)
DbClient *const databaseCache(std::string method_name="") const
std::string deviceType(const enumDeviceType &device_type) const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
DeviceDescriptionsV muxDevices_
SiStripDbParams dbParams_
bool usingDbCache() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
std::vector< DeviceDescription * > DeviceDescriptionsV
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 begin, SiStripPartition::defaultPartitionName_, end, edm::false, getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, np, and contentValuesCheck::ss.

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

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

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

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

Extracts FED ids from FED descriptions.

Definition at line 430 of file FedDescriptions.cc.

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

Referenced by SiStripFedCablingBuilderFromDb::buildFecCablingFromDevices().

430  {
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 
441  // Inhibit download of strip info
442  bool using_strips = usingStrips_;
443  if ( factory_ ) { factory_->setUsingStrips( false ); }
444  FedDescriptionsRange feds = getFedDescriptions( partition );
445  if ( factory_ ) { factory_->setUsingStrips( using_strips ); }
446 
447  if ( !feds.empty() ) {
448  FedDescriptionsV::const_iterator ifed = feds.begin();
449  FedDescriptionsV::const_iterator jfed = feds.end();
450  for ( ; ifed != jfed; ++ifed ) {
451  if ( *ifed ) { fedIds_.push_back( (*ifed)->getFedId() ); }
452  else {
454  << "[SiStripConfigDb::" << __func__ << "]"
455  << " NULL pointer to FedDescription!";
456  continue;
457  }
458  }
459  }
460 
461  } catch (...) { handleException( __func__ ); }
462 
463  if ( fedIds_.empty() ) {
465  << "[SiStripConfigDb::" << __func__ << "]"
466  << " No FED ids found!";
467  }
468 
469  return FedIdsRange( fedIds_.begin(), fedIds_.end() );
470 
471 }
DeviceFactory * factory_
DeviceFactory *const deviceFactory(std::string method_name="") const
FedDescriptionsRange getFedDescriptions(std::string partition="")
void handleException(const std::string &method_name, const std::string &extra_info="") const
FedDescriptions::range FedDescriptionsRange
static const char mlConfigDb_[]
static const char mlCabling_[]
DbClient *const databaseCache(std::string method_name="") const
boost::iterator_range< FedIds::const_iterator > FedIdsRange
SiStripDbParams dbParams_
bool usingDbCache() const
void SiStripConfigDb::handleException ( const std::string &  method_name,
const std::string &  extra_info = "" 
) const
private

Handles exceptions thrown by software.

Definition at line 739 of file SiStripConfigDb.cc.

References alignCSCRings::e, cppFunctionSkipper::exception, sistrip::mlConfigDb_, contentValuesCheck::ss, and cms::Exception::what().

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

740  {
741 
742  std::stringstream ss;
743  try {
744  throw; // rethrow caught exception to be dealt with below
745  }
746 
747  catch ( const cms::Exception& e ) {
748  ss << " Caught cms::Exception in method "
749  << method_name << " with message: " << std::endl
750  << e.what();
751  if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
752  //throw e; // rethrow cms::Exception
753  }
754 
755  catch ( const oracle::occi::SQLException& e ) {
756  ss << " Caught oracle::occi::SQLException in method "
757  << method_name << " with message: " << std::endl
758  << e.getMessage();
759  if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
760  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
761  }
762 
763  catch ( const FecExceptionHandler& e ) {
764  ss << " Caught FecExceptionHandler exception in method "
765  << method_name << " with message: " << std::endl
766  << const_cast<FecExceptionHandler&>(e).what();
767  if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
768  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
769  }
770 
771 // catch ( const Fed9UDeviceFactoryException& e ) {
772 // ss << " Caught Fed9UDeviceFactoryException exception in method "
773 // << method_name << " with message: " << std::endl
774 // << e.what();
775 // if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
776 // //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
777 // }
778 
779  catch ( const ICUtils::ICException& e ) {
780  ss << " Caught ICUtils::ICException in method "
781  << method_name << " with message: " << std::endl
782  << e.what();
783  if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
784  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
785  }
786 
787  catch ( const exception& e ) {
788  ss << " Caught std::exception in method "
789  << method_name << " with message: " << std::endl
790  << e.what();
791  if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
792  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
793  }
794 
795  catch (...) {
796  ss << " Caught unknown exception in method "
797  << method_name << " (No message) " << std::endl;
798  if ( extra_info != "" ) { ss << "Additional info: " << extra_info << std::endl; }
799  //throw cms::Exception(mlConfigDb_) << ss.str() << std::endl;
800  }
801 
802  // Message
803  edm::LogError(mlConfigDb_) << ss.str();
804 
805 }
virtual char const * what() const
Definition: Exception.cc:141
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
static const char mlConfigDb_[]
void SiStripConfigDb::openDbConnection ( )
protected

Establishes connection to DeviceFactory API.

Definition at line 102 of file SiStripConfigDb.cc.

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

Referenced by SiStripConfigDb().

102  {
103 
105  << "[SiStripConfigDb::" << __func__ << "]"
106  << " Opening connection to database...";
107 
108  // Check if connection already exists
109  if ( openConnection_ ) {
111  << "[SiStripConfigDb::" << __func__ << "]"
112  << " Connection already open!";
113  return;
114  }
115  openConnection_ = true;
116 
117  // Establish database connection
118  if ( dbParams_.usingDb() ) {
120  else { usingDatabase(); }
121  } else { usingXmlFiles(); }
122 
123  std::stringstream ss;
124  ss << "[SiStripConfigDb::" << __func__ << "]"
125  << " Database connection parameters: "
126  << std::endl << dbParams_;
127  edm::LogVerbatim(mlConfigDb_) << ss.str();
128 
129  // Clear local caches
130  clearLocalCache();
131 
133  << "[SiStripConfigDb::" << __func__ << "]"
134  << " Opened connection to database!";
135 
136 }
bool usingDb() const
static const char mlConfigDb_[]
#define LogTrace(id)
SiStripDbParams dbParams_
bool usingDbCache() const
void SiStripConfigDb::partitions ( std::list< std::string > &  partitions) const
protected

Retrieves all partitions names from database.

Definition at line 1011 of file SiStripConfigDb.cc.

References deviceFactory(), and sistrip::mlConfigDb_.

Referenced by usingDatabase().

1011  {
1012 
1013  partitions.clear();
1014 
1015  // Check DF pointer
1016  DeviceFactory* const df = deviceFactory(__func__);
1017  if ( !df ) {
1019  << "[SiStripPartition::" << __func__ << "]"
1020  << " NULL pointer to DeviceFactory object!";
1021  return;
1022  }
1023 
1024  partitions = df->getAllPartitionNames();
1025 
1026 }
void partitions(std::list< std::string > &) const
DeviceFactory *const deviceFactory(std::string method_name="") const
static const char mlConfigDb_[]
void SiStripConfigDb::printAnalysisDescriptions ( std::string  partition = "")
protected

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

Definition at line 392 of file AnalysisDescriptions.cc.

References begin, SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, data, end, SiStripFecKey::fecCrate(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripFecKey::fecRing(), SiStripConfigDb::DeviceAddress::fecRing_, SiStripFecKey::fecSlot(), SiStripConfigDb::DeviceAddress::fecSlot_, spr::find(), SiStripConfigDb::DeviceAddress::i2cAddr_, cuy::ii, getDQMSummary::iter, findQualityFiles::jj, combine::key, SiStripKey::key(), SiStripConfigDb::DeviceAddress::lldChan_, LogTrace, sistrip::mlConfigDb_, python.multivaluedict::sort(), contentValuesCheck::ss, groupFilesInBlocks::temp, and tmp.

392  {
393 
394  std::stringstream ss;
395  ss << "[SiStripConfigDb::" << __func__ << "]"
396  << " Contents of AnalysisDescriptions container:" << std::endl;
397  ss << " Number of partitions: " << analyses_.size() << std::endl;
398 
399  // Loop through partitions
400  uint16_t cntr = 0;
403  for ( ; ianal != janal; ++ianal ) {
404 
405  cntr++;
406  if ( partition == "" || partition == ianal->first ) {
407 
408  ss << " Partition number : " << cntr << " (out of " << analyses_.size() << ")" << std::endl;
409  ss << " Partition name : \"" << ianal->first << "\"" << std::endl;
410  ss << " Num of analyses : " << ianal->second.size() << std::endl;
411 
412  // Extract FEC crate, slot, etc
413  std::map< uint32_t, vector<uint32_t> > analyses;
414  AnalysisDescriptionsV::const_iterator iter = ianal->second.begin();
415  AnalysisDescriptionsV::const_iterator jter = ianal->second.end();
416  for ( ; iter != jter; ++iter ) {
417  if ( *iter ) {
418  DeviceAddress addr = deviceAddress( **iter );
419  uint32_t key = SiStripFecKey( addr.fecCrate_,
420  addr.fecSlot_,
421  addr.fecRing_,
422  0,
423  0,
424  0,
425  0 ).key();
426  uint32_t data = SiStripFecKey( addr.fecCrate_,
427  addr.fecSlot_,
428  addr.fecRing_,
429  addr.ccuAddr_,
430  addr.ccuChan_,
431  addr.lldChan_,
432  addr.i2cAddr_ ).key();
433  if ( find( analyses[key].begin(), analyses[key].end(), data ) == analyses[key].end() ) {
434  analyses[key].push_back( data );
435  }
436  }
437  }
438 
439  // Sort contents
440  std::map< uint32_t, std::vector<uint32_t> > tmp;
441  std::map< uint32_t, std::vector<uint32_t> >::const_iterator ii = analyses.begin();
442  std::map< uint32_t, std::vector<uint32_t> >::const_iterator jj = analyses.end();
443  for ( ; ii != jj; ++ii ) {
444  std::vector<uint32_t> temp = ii->second;
445  std::sort( temp.begin(), temp.end() );
446  std::vector<uint32_t>::const_iterator iii = temp.begin();
447  std::vector<uint32_t>::const_iterator jjj = temp.end();
448  for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
449  }
450  analyses.clear();
451  analyses = tmp;
452 
453  // Print FEC crate, slot, etc...
454  std::map< uint32_t, std::vector<uint32_t> >::const_iterator ianal = analyses.begin();
455  std::map< uint32_t, std::vector<uint32_t> >::const_iterator janal = analyses.end();
456  for ( ; ianal != janal; ++ianal ) {
457  SiStripFecKey key(ianal->first);
458  ss << " Found " << std::setw(3) << ianal->second.size()
459  << " analyses for FEC crate/slot/ring "
460  << key.fecCrate() << "/"
461  << key.fecSlot() << "/"
462  << key.fecRing();
463  //<< " (ccu/module/lld/i2c): ";
464  // if ( !ianal->second.empty() ) {
465  // uint16_t first = ianal->second.front();
466  // uint16_t last = ianal->second.front();
467  // std::vector<uint32_t>::const_iterator chan = ianal->second.begin();
468  // for ( ; chan != ianal->second.end(); chan++ ) {
469  // if ( chan != ianal->second.begin() ) {
470  // if ( *chan != last+1 ) {
471  // ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
472  // if ( chan != ianal->second.end() ) { first = *(chan+1); }
473  // }
474  // }
475  // last = *chan;
476  // }
477  // if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
478  ss << std::endl;
479  }
480 
481  }
482 
483  }
484 
485  LogTrace(mlConfigDb_) << ss.str();
486 
487 }
AnalysisDescriptions analyses_
int ii
Definition: cuy.py:588
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const uint32_t & key() const
Definition: SiStripKey.h:125
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_iterator begin() const
Definition: MapOfVectors.h:129
size_type size() const
Definition: MapOfVectors.h:104
#define end
Definition: vmac.h:37
DeviceAddress deviceAddress(const deviceDescription &)
#define LogTrace(id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define begin
Definition: vmac.h:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
list key
Definition: combine.py:13
const_iterator end() const
Definition: MapOfVectors.h:133
void SiStripConfigDb::printDcuDetIds ( std::string  partition = "")
protected

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

Definition at line 338 of file DcuDetIds.cc.

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

338  {
339 
340  std::stringstream ss;
341  ss << "[SiStripConfigDb::" << __func__ << "]"
342  << " Contents of DcuDetIds container:" << std::endl;
343  ss << " Number of partitions: " << dcuDetIds_.size() << std::endl;
344 
345  // Loop through partitions
346  uint16_t cntr = 0;
349  for ( ; idcu != jdcu; ++idcu ) {
350 
351  cntr++;
352  if ( partition == "" || partition == idcu->first ) {
353 
354  ss << " Partition number : " << cntr << " (out of " << dcuDetIds_.size() << ")" << std::endl;
355  ss << " Partition name : \"" << idcu->first << "\"" << std::endl;
356  ss << " Size of DCU-DetId map : " << idcu->second.size() << std::endl;
357 
358  }
359 
360  }
361 
362  LogTrace(mlConfigDb_) << ss.str();
363 
364 }
static const char mlConfigDb_[]
const_iterator begin() const
Definition: MapOfVectors.h:129
size_type size() const
Definition: MapOfVectors.h:104
#define LogTrace(id)
const_iterator end() const
Definition: MapOfVectors.h:133
DcuDetIds dcuDetIds_
void SiStripConfigDb::printDeviceDescriptions ( std::string  partition = "")
protected

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

Definition at line 411 of file DeviceDescriptions.cc.

References begin, SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, data, end, SiStripFecKey::fecCrate(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripFecKey::fecRing(), SiStripConfigDb::DeviceAddress::fecRing_, SiStripFecKey::fecSlot(), SiStripConfigDb::DeviceAddress::fecSlot_, spr::find(), SiStripConfigDb::DeviceAddress::i2cAddr_, cuy::ii, getDQMSummary::iter, findQualityFiles::jj, combine::key, SiStripKey::key(), SiStripConfigDb::DeviceAddress::lldChan_, LogTrace, sistrip::mlConfigDb_, python.multivaluedict::sort(), contentValuesCheck::ss, groupFilesInBlocks::temp, and tmp.

411  {
412 
413  std::stringstream ss;
414  ss << "[SiStripConfigDb::" << __func__ << "]"
415  << " Contents of DeviceDescriptions container:" << std::endl;
416  ss << " Number of partitions: " << devices_.size() << std::endl;
417 
418  // Loop through partitions
419  uint16_t cntr = 0;
422  for ( ; idev != jdev; ++idev ) {
423 
424  cntr++;
425  if ( partition == "" || partition == idev->first ) {
426 
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_,
439  addr.fecSlot_,
440  addr.fecRing_,
441  0,
442  0,
443  0,
444  0 ).key();
445  std::stringstream data;
446  data << (*iter)->getDeviceType()
447  << "_"
448  << SiStripFecKey( addr.fecCrate_,
449  addr.fecSlot_,
450  addr.fecRing_,
451  addr.ccuAddr_,
452  addr.ccuChan_,
453  addr.lldChan_,
454  addr.i2cAddr_ ).key();
455  if ( find( devices[key].begin(), devices[key].end(), data.str() ) == devices[key].end() ) {
456  devices[key].push_back( data.str() );
457  }
458  }
459  }
460 
461  // Sort contents
462  std::map< uint32_t, std::vector<std::string> > tmp;
463  std::map< uint32_t, std::vector<std::string> >::const_iterator ii = devices.begin();
464  std::map< uint32_t, std::vector<std::string> >::const_iterator jj = devices.end();
465  for ( ; ii != jj; ++ii ) {
466  std::vector<std::string> temp = ii->second;
467  std::sort( temp.begin(), temp.end() );
468  std::vector<std::string>::const_iterator iii = temp.begin();
469  std::vector<std::string>::const_iterator jjj = temp.end();
470  for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
471  }
472  devices.clear();
473  devices = tmp;
474 
475  // Print FEC crate, slot, etc...
476  std::map< uint32_t, std::vector<std::string> >::const_iterator idev = devices.begin();
477  std::map< uint32_t, std::vector<std::string> >::const_iterator jdev = devices.end();
478  for ( ; idev != jdev; ++idev ) {
479  SiStripFecKey key(idev->first);
480  ss << " Found " << std::setw(3) << idev->second.size()
481  << " devices for FEC crate/slot/ring "
482  << key.fecCrate() << "/"
483  << key.fecSlot() << "/"
484  << key.fecRing();
485  //<< " (ccu/module/lld/i2c): ";
486  // if ( !idev->second.empty() ) {
487  // uint16_t first = idev->second.front();
488  // uint16_t last = idev->second.front();
489  // std::vector<std::string>::const_iterator chan = idev->second.begin();
490  // for ( ; chan != idev->second.end(); chan++ ) {
491  // if ( chan != idev->second.begin() ) {
492  // if ( *chan != last+1 ) {
493  // ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
494  // if ( chan != idev->second.end() ) { first = *(chan+1); }
495  // }
496  // }
497  // last = *chan;
498  // }
499  // if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
500  ss << std::endl;
501  }
502 
503  }
504 
505  }
506 
507  LogTrace(mlConfigDb_) << ss.str();
508 
509 }
int ii
Definition: cuy.py:588
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const uint32_t & key() const
Definition: SiStripKey.h:125
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_iterator begin() const
Definition: MapOfVectors.h:129
size_type size() const
Definition: MapOfVectors.h:104
#define end
Definition: vmac.h:37
DeviceAddress deviceAddress(const deviceDescription &)
#define LogTrace(id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
DeviceDescriptions devices_
#define begin
Definition: vmac.h:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
list key
Definition: combine.py:13
const_iterator end() const
Definition: MapOfVectors.h:133
void SiStripConfigDb::printFedConnections ( std::string  partition = "")
protected

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

Definition at line 344 of file FedConnections.cc.

References begin, end, spr::find(), first, cuy::ii, getDQMSummary::iter, findQualityFiles::jj, prof2calltree::last, LogTrace, sistrip::mlConfigDb_, python.multivaluedict::sort(), contentValuesCheck::ss, groupFilesInBlocks::temp, and tmp.

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

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

Definition at line 347 of file FedDescriptions.cc.

References begin, data, end, spr::find(), first, cuy::ii, getDQMSummary::iter, findQualityFiles::jj, combine::key, prof2calltree::last, LogTrace, sistrip::mlConfigDb_, python.multivaluedict::sort(), contentValuesCheck::ss, groupFilesInBlocks::temp, and tmp.

347  {
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 
360  cntr++;
361  if ( partition == "" || partition == iconn->first ) {
362 
363  ss << " Partition number : " << cntr << " (out of " << feds_.size() << ")" << std::endl;
364  ss << " Partition name : \"" << iconn->first << "\"" << std::endl;
365  ss << " Num of FED ids : " << iconn->second.size() << std::endl;
366 
367  // Extract FED crates and ids
368  std::map< uint16_t, vector<uint16_t> > feds;
369  FedDescriptionsV::const_iterator iter = iconn->second.begin();
370  FedDescriptionsV::const_iterator jter = iconn->second.end();
371  for ( ; iter != jter; ++iter ) {
372  if ( *iter ) {
373  uint16_t key = (*iter)->getCrateNumber();
374  uint16_t data = (*iter)->getFedId();
375  if ( find( feds[key].begin(), feds[key].end(), data ) == feds[key].end() ) {
376  feds[key].push_back( data );
377  }
378  }
379  }
380 
381  // Sort contents
382  std::map< uint16_t, std::vector<uint16_t> > tmp;
383  std::map< uint16_t, std::vector<uint16_t> >::const_iterator ii = feds.begin();
384  std::map< uint16_t, std::vector<uint16_t> >::const_iterator jj = feds.end();
385  for ( ; ii != jj; ++ii ) {
386  std::vector<uint16_t> temp = ii->second;
387  std::sort( temp.begin(), temp.end() );
388  std::vector<uint16_t>::const_iterator iii = temp.begin();
389  std::vector<uint16_t>::const_iterator jjj = temp.end();
390  for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
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()
400  << " FED ids for crate number " << std::setw(2) << 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() ) { first = *(icrate+1); }
411  }
412  }
413  last = *icrate;
414  }
415  if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
416  ss << std::endl;
417  }
418  }
419 
420  }
421 
422  }
423 
424  LogTrace(mlConfigDb_) << ss.str();
425 
426 }
int ii
Definition: cuy.py:588
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static const char mlConfigDb_[]
const_iterator begin() const
Definition: MapOfVectors.h:129
FedDescriptions feds_
size_type size() const
Definition: MapOfVectors.h:104
#define end
Definition: vmac.h:37
bool first
Definition: L1TdeRCT.cc:75
#define LogTrace(id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define begin
Definition: vmac.h:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
list key
Definition: combine.py:13
const_iterator end() const
Definition: MapOfVectors.h:133
void SiStripConfigDb::runs ( SiStripConfigDb::Runs runs) const
protected

Retrieves all runs from database.

Definition at line 819 of file SiStripConfigDb.cc.

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

Referenced by inputFilesetParser.inputFilesetParser::selectedRunsWithoutresult(), and inputFilesetParser.inputFilesetParser::selectedRunsWithresult().

819  {
820 
821  runs.clear();
822 
823  // Check DF pointer
824  DeviceFactory* const df = deviceFactory(__func__);
825  if ( !df ) {
827  << "[SiStripPartition::" << __func__ << "]"
828  << " NULL pointer to DeviceFactory object!";
829  return;
830  }
831 
832  // Retrieve runs
833  tkRunVector all;
834  all = df->getAllRuns();
835 
836  // Iterate through tkRunVector
837  tkRunVector::const_iterator ii = all.begin();
838  tkRunVector::const_iterator jj = all.end();
839  for ( ; ii != jj; ++ii ) {
840 
841  // Check TkRun pointer
842  if ( *ii ) {
843 
844  // Retrieve run type
845  uint16_t type = (*ii)->getModeId( (*ii)->getMode() );
847  if ( type == 1 ) { temp = sistrip::PHYSICS; }
848  else if ( type == 2 ) { temp = sistrip::PEDESTALS; }
849  else if ( type == 3 ) { temp = sistrip::CALIBRATION; }
850  else if ( type == 33 ) { temp = sistrip::CALIBRATION_DECO; }
851  else if ( type == 4 ) { temp = sistrip::OPTO_SCAN; }
852  else if ( type == 5 ) { temp = sistrip::APV_TIMING; }
853  else if ( type == 6 ) { temp = sistrip::APV_LATENCY; }
854  else if ( type == 7 ) { temp = sistrip::FINE_DELAY_PLL; }
855  else if ( type == 10 ) { temp = sistrip::MULTI_MODE; }
856  else if ( type == 8 ) { temp = sistrip::FINE_DELAY_TTC; }
857  else if ( type == 12 ) { temp = sistrip::FED_TIMING; }
858  else if ( type == 13 ) { temp = sistrip::FED_CABLING; }
859  else if ( type == 14 ) { temp = sistrip::VPSP_SCAN; }
860  else if ( type == 15 ) { temp = sistrip::DAQ_SCOPE_MODE; }
861  else if ( type == 16 ) { temp = sistrip::QUITE_FAST_CABLING; }
862  else if ( type == 17 ) { temp = sistrip::FINE_DELAY; }
863  else if ( type == 18 ) { temp = sistrip::PHYSICS_ZS; }
864  else if ( type == 19 ) { temp = sistrip::CALIBRATION_SCAN; }
865  else if ( type == 20 ) { temp = sistrip::CALIBRATION_SCAN_DECO; }
866  else if ( type == 21 ) { temp = sistrip::FAST_CABLING; }
867  else if ( type == 0 ) { temp = sistrip::UNDEFINED_RUN_TYPE; }
868  else { temp = sistrip::UNKNOWN_RUN_TYPE; }
869 
870  // Store run details
871  Run r;
872  r.type_ = temp;
873  r.partition_ = (*ii)->getPartitionName();
874  r.number_ = (*ii)->getRunNumber();
875  runs.push_back(r);
876 
877  } else {
879  << "[SiStripPartition::" << __func__ << "]"
880  << " NULL pointer to TkRun object!";
881  }
882 
883  }
884 
885 }
type
Definition: HCALResponse.h:21
DeviceFactory *const deviceFactory(std::string method_name="") const
void runs(Runs &) const
int ii
Definition: cuy.py:588
static const char mlConfigDb_[]
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 889 of file SiStripConfigDb.cc.

References dbParams_, newFWLiteAna::found, cuy::ii, getDQMSummary::iter, findQualityFiles::jj, sistrip::mlConfigDb_, SiStripDbParams::partition(), SiStripDbParams::partitions(), sistrip::UNDEFINED_RUN_TYPE, and sistrip::UNKNOWN_RUN_TYPE.

Referenced by inputFilesetParser.inputFilesetParser::selectedRunsWithoutresult(), and inputFilesetParser.inputFilesetParser::selectedRunsWithresult().

891  {
892 
893  out.clear();
894 
895  // Check partition name (if not empty string)
896  if ( !optional_partition.empty() ) {
897  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partition( optional_partition );
898  if ( iter == dbParams_.partitions().end() ) {
900  << "[SiStripPartition::" << __func__ << "]"
901  << " Partition name not found!";
902  return;
903  }
904  }
905 
906  // Iterate through runs
907  Runs::const_iterator ii = in.begin();
908  Runs::const_iterator jj = in.end();
909  for ( ; ii != jj; ++ii ) {
910  // Check partition name
911  if ( ii->partition_ == optional_partition || optional_partition == "" ) {
912  // Check run type
913  if ( ii->type_ != sistrip::UNKNOWN_RUN_TYPE &&
914  ii->type_ != sistrip::UNDEFINED_RUN_TYPE ) {
915  // Check run number
916  if ( ii->number_ ) {
917  bool found = false;
918  if ( out.find( ii->type_ ) != out.end() ) {
919  Runs::const_iterator irun = out[ ii->type_ ].begin();
920  Runs::const_iterator jrun = out[ ii->type_ ].end();
921  while ( !found && irun != jrun ) {
922  if ( irun->number_ == ii->number_ ) { found = true; }
923  ++irun;
924  }
925  }
926  // Check if run number already found
927  if ( !found ) {
928  out[ ii->type_ ].push_back( *ii );
929  } else {
930  // edm::LogWarning(mlConfigDb_)
931  // << "[SiStripPartition::" << __func__ << "]"
932  // << " Run number already found!";
933  }
934  } else {
935  // edm::LogWarning(mlConfigDb_)
936  // << "[SiStripPartition::" << __func__ << "]"
937  // << " NULL run number!";
938  }
939  } else {
940  // edm::LogWarning(mlConfigDb_)
941  // << "[SiStripPartition::" << __func__ << "]"
942  // << " Unexpected run type!";
943  }
944  } else {
945  // edm::LogWarning(mlConfigDb_)
946  // << "[SiStripPartition::" << __func__ << "]"
947  // << " Partition name does not match!";
948  }
949 
950  }
951 
952 }
int ii
Definition: cuy.py:588
static const char mlConfigDb_[]
const_iterator_range partitions() const
tuple out
Definition: dbtoconf.py:99
SiStripPartitions::const_iterator partition(std::string partition_name) const
SiStripDbParams dbParams_
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 956 of file SiStripConfigDb.cc.

References newFWLiteAna::found, cuy::ii, findQualityFiles::jj, and sistrip::UNDEFINED_RUN_TYPE.

Referenced by inputFilesetParser.inputFilesetParser::selectedRunsWithoutresult(), and inputFilesetParser.inputFilesetParser::selectedRunsWithresult().

958  {
959 
960  out.clear();
961 
962  // Iterate through runs
963  Runs::const_iterator ii = in.begin();
964  Runs::const_iterator jj = in.end();
965  for ( ; ii != jj; ++ii ) {
966  // Check partition name
967  if ( ii->partition_ != "" ) {
968  // Check run type
969  if ( ii->type_ == optional_type || optional_type == sistrip::UNDEFINED_RUN_TYPE ) {
970  // Check run number
971  if ( ii->number_ ) {
972  bool found = false;
973  if ( out.find( ii->partition_ ) != out.end() ) {
974  Runs::const_iterator irun = out[ ii->partition_ ].begin();
975  Runs::const_iterator jrun = out[ ii->partition_ ].end();
976  while ( !found && irun != jrun ) {
977  if ( irun->number_ == ii->number_ ) { found = true; }
978  ++irun;
979  }
980  }
981  // Check if run number already found
982  if ( !found ) {
983  out[ ii->partition_ ].push_back( *ii );
984  } else {
985  // edm::LogWarning(mlConfigDb_)
986  // << "[SiStripPartition::" << __func__ << "]"
987  // << " Run number already found!";
988  }
989  } else {
990  // edm::LogWarning(mlConfigDb_)
991  // << "[SiStripPartition::" << __func__ << "]"
992  // << " NULL run number!";
993  }
994  } else {
995  // edm::LogWarning(mlConfigDb_)
996  // << "[SiStripPartition::" << __func__ << "]"
997  // << " Run type does not match!";
998  }
999  } else {
1000  // edm::LogWarning(mlConfigDb_)
1001  // << "[SiStripPartition::" << __func__ << "]"
1002  // << " NULL value for partition!";
1003  }
1004 
1005  }
1006 
1007 }
int ii
Definition: cuy.py:588
tuple out
Definition: dbtoconf.py:99
void SiStripConfigDb::uploadAnalysisDescriptions ( bool  calibration_for_physics = false,
std::string  partition = "" 
)
protected

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

Definition at line 229 of file AnalysisDescriptions.cc.

References getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, contentValuesCheck::ss, and BeamSplash_cfg::version.

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

230  {
231 
232  if ( dbParams_.usingDbCache() ) {
234  << "[SiStripConfigDb::" << __func__ << "]"
235  << " Using database cache! No uploads allowed!";
236  return;
237  }
238 
239  if ( !deviceFactory(__func__) ) { return; }
240 
241  if ( analyses_.empty() ) {
243  << "[SiStripConfigDb::" << __func__ << "]"
244  << " Found no cached analysis descriptions, therefore no upload!";
245  return;
246  }
247 
248  if ( calibration_for_physics && !allowCalibUpload_ ) {
250  << "[SiStripConfigDb::" << __func__ << "]"
251  << " Attempting to upload calibration constants"
252  << " without uploading any hardware descriptions!"
253  << " Aborting upload...";
254  return;
255  } else { allowCalibUpload_ = false; }
256 
257  try {
258 
259  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
260  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
261  for ( ; iter != jter; ++iter ) {
262 
263  if ( partition == "" || partition == iter->second.partitionName() ) {
264 
265  AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() );
266  if ( range != analyses_.emptyRange() ) {
267 
268  AnalysisDescriptionsV anals( range.begin(), range.end() );
269 
270  AnalysisType analysis_type = AnalysisDescription::T_UNKNOWN;
271  if ( anals.front() ) { analysis_type = anals.front()->getType(); }
272  if ( analysis_type == AnalysisDescription::T_UNKNOWN ) {
274  << "[SiStripConfigDb::" << __func__ << "]"
275  << " Analysis type is UNKNOWN. Aborting upload!";
276  return;
277  }
278 
279  uint32_t version = deviceFactory(__func__)->uploadAnalysis( iter->second.runNumber(),
280  iter->second.partitionName(),
281  analysis_type,
282  anals,
283  calibration_for_physics );
284 
285  // Update current state with analysis descriptions
286  if ( calibration_for_physics ) { deviceFactory(__func__)->uploadAnalysisState( version ); }
287 
288  // Some debug
289  std::stringstream ss;
290  ss << "[SiStripConfigDb::" << __func__ << "]"
291  << " Uploaded " << anals.size()
292  << " device descriptions to database for partition \""
293  << iter->second.partitionName() << "\".";
294  LogTrace(mlConfigDb_) << ss.str();
295 
296  } else {
297  stringstream ss;
298  ss << "[SiStripConfigDb::" << __func__ << "]"
299  << " Vector of device descriptions is empty for partition \""
300  << iter->second.partitionName()
301  << "\", therefore aborting upload for this partition!";
302  edm::LogWarning(mlConfigDb_) << ss.str();
303  continue;
304  }
305 
306  } else {
307  // stringstream ss;
308  // ss << "[SiStripConfigDb::" << __func__ << "]"
309  // << " Cannot find partition \"" << partition
310  // << "\" in cached partitions list: \""
311  // << dbParams_.partitionNames( dbParams_.partitionNames() )
312  // << "\", therefore aborting upload for this partition!";
313  // edm::LogWarning(mlConfigDb_) << ss.str();
314  }
315 
316  }
317 
318  } catch (...) { handleException( __func__ ); }
319 
320  allowCalibUpload_ = true;
321 
322 }
DeviceFactory *const deviceFactory(std::string method_name="") const
void handleException(const std::string &method_name, const std::string &extra_info="") const
AnalysisDescriptions analyses_
static const char mlConfigDb_[]
const_iterator_range partitions() const
range find(K const &k) const
Definition: MapOfVectors.h:120
#define LogTrace(id)
AnalysisDescriptions::range AnalysisDescriptionsRange
range emptyRange() const
Definition: MapOfVectors.h:80
CommissioningAnalysisDescription::commissioningType AnalysisType
bool empty() const
Definition: MapOfVectors.h:106
static bool allowCalibUpload_
SiStripDbParams dbParams_
bool usingDbCache() const
std::vector< AnalysisDescription * > AnalysisDescriptionsV
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 
185  stringstream ss;
186  ss << "[SiStripConfigDb::" << __func__ << "]"
187  << " Cannot upload to database! This functionality not allowed!";
188  edm::LogWarning(mlConfigDb_) << ss.str();
189 
190  /*
191  addAllDetId => all detids
192  addAllDetId => to download (up to you)
193  change in the detids
194  setTkDcuInfo
195  getCurrentStates
196  setCurrentState
197  addDetIpartiton
198  AddAllDetId
199  */
200 
201  // if ( dbParams_.usingDbCache() ) {
202  // edm::LogWarning(mlConfigDb_)
203  // << "[SiStripConfigDb::" << __func__ << "]"
204  // << " Using database cache! No uploads allowed!";
205  // return;
206  // }
207 
208  // if ( !deviceFactory(__func__) ) { return; }
209 
210  // if ( dcuDetIds_.empty() ) {
211  // stringstream ss;
212  // ss << "[SiStripConfigDb::" << __func__ << "]"
213  // << " Found no cached DCU-DetId map, therefore no upload!";
214  // edm::LogWarning(mlConfigDb_) << ss.str();
215  // return;
216  // }
217 
218  // try {
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 
224  // if ( partition == "" || partition == iter->second.partitionName() ) {
225 
226  // DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
227  // if ( range != dcuDetIds_.emptyRange() ) {
228 
229  // // Extract
230  // DcuDetIdMap dst;
231  // clone( DcuDetIdsV( range.begin(), range.end() ), dst );
232  // deviceFactory(__func__)->setTkDcuInfo( dst );
233  // getcurrentstate
234  // deviceFactory(__func__)->addAllDetId();
235 
236  // // Some debug
237  // std::stringstream ss;
238  // ss << "[SiStripConfigDb::" << __func__ << "]"
239  // << " Uploaded " << dst.size()
240  // << " DCU-DetId map to DB/xml for partition \""
241  // << iter->second.partitionName() << "\".";
242  // LogTrace(mlConfigDb_) << ss.str();
243 
244  // } else {
245  // stringstream ss;
246  // ss << "[SiStripConfigDb::" << __func__ << "]"
247  // << " Vector of DCU-DetId map is empty for partition \""
248  // << iter->second.partitionName()
249  // << "\", therefore aborting upload for this partition!";
250  // edm::LogWarning(mlConfigDb_) << ss.str();
251  // continue;
252  // }
253 
254  // } else {
255  // // stringstream ss;
256  // // ss << "[SiStripConfigDb::" << __func__ << "]"
257  // // << " Cannot find partition \"" << partition
258  // // << "\" in cached partitions list: \""
259  // // << dbParams_.partitionNames( dbParams_.partitionNames() )
260  // // << "\", therefore aborting upload for this partition!";
261  // // edm::LogWarning(mlConfigDb_) << ss.str();
262  // }
263 
264  // }
265 
266  // } catch (... ) { handleException( __func__, "Problems updating objects in TkDcuInfoFactory!" ); }
267 
268 }
static const char mlConfigDb_[]
void SiStripConfigDb::uploadDeviceDescriptions ( std::string  partition = "")
protected

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

Definition at line 268 of file DeviceDescriptions.cc.

References getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, contentValuesCheck::ss, and funct::true.

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

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

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

Definition at line 197 of file FedConnections.cc.

References getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, contentValuesCheck::ss, and funct::true.

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

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

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

Definition at line 201 of file FedDescriptions.cc.

References getDQMSummary::iter, LogTrace, sistrip::mlConfigDb_, and contentValuesCheck::ss.

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

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

Definition at line 227 of file SiStripConfigDb.cc.

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

Referenced by openDbConnection().

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

Definition at line 453 of file SiStripConfigDb.cc.

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

Referenced by openDbConnection().

453  {
454 
455  // Reset all DbParams except for those concerning database cache
457  temp = dbParams_;
458  dbParams_.reset();
459  dbParams_.usingDb( temp.usingDb() );
462 
463  // Add default partition
465 
466  // Check shared memory name from .cfg file
467  if ( dbParams_.sharedMemory().empty() ) {
468  std::stringstream ss;
469  ss << "[SiStripConfigDb::" << __func__ << "]"
470  << " Empty string for shared memory name!"
471  << " Cannot accept shared memory!";
472  edm::LogError(mlConfigDb_) << ss.str();
473  return;
474  }
475 
476  // Create database cache object
477  try {
479  << "[SiStripConfigDb::" << __func__ << "]"
480  << " Creating DbClient object...";
481  dbCache_ = new DbClient( dbParams_.sharedMemory() );
483  << "[SiStripConfigDb::" << __func__ << "]"
484  << " Created DbClient object...";
485  } catch (...) {
486  std::stringstream ss;
487  ss << "Failed to connect to database cache using shared memory name: '"
488  << dbParams_.sharedMemory() << "'!";
489  handleException( __func__, ss.str() );
490  return;
491  }
492 
493  // Check for valid pointer to DbClient object
494  if ( databaseCache(__func__) ) {
495  std::stringstream ss;
496  ss << "[SiStripConfigDb::" << __func__ << "]"
497  << " DbClient object created at address 0x"
498  << std::hex << std::setw(8) << std::setfill('0') << dbCache_ << std::dec
499  << " using shared memory name '"
500  << dbParams_.sharedMemory() << "'";
501  LogTrace(mlConfigDb_) << ss.str();
502  } else {
504  << "[SiStripConfigDb::" << __func__ << "]"
505  << " NULL pointer to DbClient object!"
506  << " Unable to connect to database cache using shared memory name '"
507  << dbParams_.sharedMemory() << "'";
508  return;
509  }
510 
511  // Try retrieve descriptions from Database Client
512  try {
513  databaseCache(__func__)->parse();
514  } catch (...) {
515  handleException( __func__, "Attempted to called DbClient::parse() method" );
516  }
517 
518 }
static std::string defaultPartitionName_
void handleException(const std::string &method_name, const std::string &extra_info="") const
bool usingDb() const
static const char mlConfigDb_[]
std::string sharedMemory() const
#define LogTrace(id)
DbClient *const databaseCache(std::string method_name="") const
Container class for database connection parameters.
SiStripDbParams dbParams_
bool usingDbCache() const
DbClient * dbCache_
friend class SiStripPartition
void addPartition(const SiStripPartition &)
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 470 of file SiStripConfigDb.h.

References dbParams_, and SiStripDbParams::usingDb().

470 { return dbParams_.usingDb(); }
bool usingDb() const
SiStripDbParams dbParams_
bool SiStripConfigDb::usingStrips ( ) const
inlineprotected

Strip-level info enabled/disabled within FED descriptions.

Indicates whether FED strip info is uploaded/downloaded.

Definition at line 473 of file SiStripConfigDb.h.

References usingStrips_.

473 { return usingStrips_; }
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 476 of file SiStripConfigDb.h.

References usingStrips_.

476 { usingStrips_ = using_strips; }
void SiStripConfigDb::usingXmlFiles ( )
private

Definition at line 522 of file SiStripConfigDb.cc.

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

Referenced by openDbConnection().

522  {
524  << "[SiStripConfigDb::" << __func__ << "]"
525  << " Using XML description files...";
526 
527  // Create device factory object
528  try {
529  factory_ = new DeviceFactory();
530  } catch (...) {
531  handleException( __func__, "Attempting to create DeviceFactory for use with xml files" );
532  }
533 
534  // Check for valid pointer to DeviceFactory
535  if ( deviceFactory(__func__) ) {
536  std::stringstream ss;
537  ss << "[SiStripConfigDb::" << __func__ << "]"
538  << " DeviceFactory created at address 0x"
539  << std::hex << std::setw(8) << std::setfill('0') << factory_ << std::dec
540  << ", using XML description files";
541  LogTrace(mlConfigDb_) << ss.str();
542  } else {
544  << "[SiStripConfigDb::" << __func__ << "]"
545  << " NULL pointer to DeviceFactory!"
546  << " Unable to connect to database!";
547  return;
548  }
549 
550  try {
551  deviceFactory(__func__)->setUsingDb( dbParams_.usingDb() );
552  } catch (...) {
553  handleException( __func__, "Attempted to 'setUsingDb'" );
554  }
555 
556  // Iterate through partitions
557  SiStripDbParams::SiStripPartitions::const_iterator ip = dbParams_.partitions().begin();
558  SiStripDbParams::SiStripPartitions::const_iterator jp = dbParams_.partitions().end();
559  for ( ; ip != jp; ++ip ) {
560 
561  // Input module.xml file
562  if ( ip->second.inputModuleXml() == "" ) {
564  << "[SiStripConfigDb::" << __func__ << "]"
565  << " NULL path to input 'module.xml' file!";
566  } else {
567  if ( checkFileExists( ip->second.inputModuleXml() ) ) {
568  try {
569  deviceFactory(__func__)->addConnectionFileName( ip->second.inputModuleXml() );
570  } catch (...) {
571  handleException( __func__ );
572  }
574  << "[SiStripConfigDb::" << __func__ << "]"
575  << " Added input 'module.xml' file: " << ip->second.inputModuleXml();
576  } else {
578  << "[SiStripConfigDb::" << __func__ << "]"
579  << " No 'module.xml' file found at " << ip->second.inputModuleXml();
580  ip->second.inputModuleXml() = "";
581  }
582  }
583 
584  // Input dcuinfo.xml file
585  if ( ip->second.inputDcuInfoXml() == "" ) {
587  << "[SiStripConfigDb::" << __func__ << "]"
588  << " NULL path to input 'dcuinfo.xml' file!";
589  } else {
590  if ( checkFileExists( ip->second.inputDcuInfoXml() ) ) {
591  try {
592  deviceFactory(__func__)->addTkDcuInfoFileName( ip->second.inputDcuInfoXml() );
593  } catch (...) {
594  handleException( __func__ );
595  }
597  << "[SiStripConfigDb::" << __func__ << "]"
598  << " Added 'dcuinfo.xml' file: " << ip->second.inputDcuInfoXml();
599  } else {
601  << "[SiStripConfigDb::" << __func__ << "]"
602  << " No 'dcuinfo.xml' file found at " << ip->second.inputDcuInfoXml();
603  ip->second.inputDcuInfoXml() = "";
604  }
605  }
606 
607  // Input FEC xml files
608  if ( ip->second.inputFecXml().empty() ) {
610  << "[SiStripConfigDb::" << __func__ << "]"
611  << " NULL paths to input 'fec.xml' files!";
612  } else {
613  std::vector<std::string>::iterator iter = ip->second.inputFecXml().begin();
614  for ( ; iter != ip->second.inputFecXml().end(); iter++ ) {
615  if ( *iter == "" ) {
617  << "[SiStripConfigDb::" << __func__ << "]"
618  << " NULL path to input 'fec.xml' file!";
619  } else {
620  if ( checkFileExists( *iter ) ) {
621  try {
622  deviceFactory(__func__)->addFecFileName( *iter );
623  } catch (...) { handleException( __func__ ); }
625  << "[SiStripConfigDb::" << __func__ << "]"
626  << " Added 'fec.xml' file: " << *iter;
627  } else {
629  << "[SiStripConfigDb::" << __func__ << "]"
630  << " No 'fec.xml' file found at " << *iter;
631  *iter = "";
632  }
633  }
634  }
635  }
636 
637  // Input FED xml files
638  if ( ip->second.inputFedXml().empty() ) {
640  << "[SiStripConfigDb::" << __func__ << "]"
641  << " NULL paths to input 'fed.xml' files!";
642  } else {
643  std::vector<std::string>::iterator iter = ip->second.inputFedXml().begin();
644  for ( ; iter != ip->second.inputFedXml().end(); iter++ ) {
645  if ( *iter == "" ) {
647  << "[SiStripConfigDb::" << __func__ << "]"
648  << " NULL path to input 'fed.xml' file!";
649  } else {
650  if ( checkFileExists( *iter ) ) {
651  try {
652  deviceFactory(__func__)->addFedFileName( *iter );
653  } catch (...) {
654  handleException( __func__ );
655  }
657  << "[SiStripConfigDb::" << __func__ << "]"
658  << " Added 'fed.xml' file: " << *iter;
659  } else {
661  << "[SiStripConfigDb::" << __func__ << "]"
662  << " No 'fed.xml' file found at " << *iter;
663  *iter = "";
664  }
665  }
666  }
667  }
668 
669  }
670 
671  // Output module.xml file
672  if ( dbParams_.outputModuleXml() == "" ) {
674  << "[SiStripConfigDb::" << __func__ << "]"
675  << " NULL path to output 'module.xml' file!"
676  << " Setting to '/tmp/module.xml'...";
677  dbParams_.outputModuleXml() = "/tmp/module.xml";
678  } else {
679  try {
680  ConnectionFactory* factory = deviceFactory(__func__);
681  factory->setOutputFileName( dbParams_.outputModuleXml() );
682  } catch (...) {
683  handleException( __func__, "Problems setting output 'module.xml' file!" );
684  }
685  }
686 
687  // Output dcuinfo.xml file
688  if ( dbParams_.outputDcuInfoXml() == "" ) {
690  << "[SiStripConfigDb::" << __func__ << "]"
691  << " NULL path to output 'dcuinfo.xml' file!"
692  << " Setting to '/tmp/dcuinfo.xml'...";
693  dbParams_.outputModuleXml() = "/tmp/dcuinfo.xml";
694  } else {
695  try {
696  TkDcuInfoFactory* factory = deviceFactory(__func__);
697  factory->setOutputFileName( dbParams_.outputDcuInfoXml() );
698  } catch (...) {
699  handleException( __func__, "Problems setting output 'dcuinfo.xml' file!" );
700  }
701  }
702 
703  // Output fec.xml file
704  if ( dbParams_.outputFecXml() == "" ) {
706  << "[SiStripConfigDb::" << __func__ << "]"
707  << " NULL path to output 'fec.xml' file!"
708  << " Setting to '/tmp/fec.xml'...";
709  dbParams_.outputFecXml() = "/tmp/fec.xml";
710  } else {
711  try {
712  FecDeviceFactory* factory = deviceFactory(__func__);
713  factory->setOutputFileName( dbParams_.outputFecXml() );
714  } catch (...) {
715  handleException( __func__, "Problems setting output 'fec.xml' file!" );
716  }
717  }
718 
719  // Output fed.xml file
720  if ( dbParams_.outputFedXml() == "" ) {
722  << "[SiStripConfigDb::" << __func__ << "]"
723  << " NULL path to output 'fed.xml' file!"
724  << " Setting to '/tmp/fed.xml'...";
725  dbParams_.outputFedXml() = "/tmp/fed.xml";
726  } else {
727  try {
728  Fed9U::Fed9UDeviceFactory* factory = deviceFactory(__func__);
729  factory->setOutputFileName( dbParams_.outputFedXml() );
730  } catch (...) {
731  handleException( __func__, "Problems setting output 'fed.xml' file!" );
732  }
733  }
734 
735 }
DeviceFactory * factory_
DeviceFactory *const deviceFactory(std::string method_name="") const
void handleException(const std::string &method_name, const std::string &extra_info="") const
bool checkFileExists(const std::string &path)
bool usingDb() const
static const char mlConfigDb_[]
const_iterator_range partitions() const
std::string outputModuleXml() const
#define LogTrace(id)
std::string outputFedXml() const
SiStripDbParams dbParams_
std::string outputFecXml() const
std::string outputDcuInfoXml() const

Friends And Related Function Documentation

friend class ApvTimingHistosUsingDb
friend

Definition at line 88 of file SiStripConfigDb.h.

friend class CalibrationHistosUsingDb
friend

Definition at line 97 of file SiStripConfigDb.h.

friend class CommissioningHistosUsingDb
friend

Definition at line 85 of file SiStripConfigDb.h.

friend class FastFedCablingHistosUsingDb
friend

Definition at line 86 of file SiStripConfigDb.h.

friend class FedCablingHistosUsingDb
friend

Definition at line 87 of file SiStripConfigDb.h.

friend class FineDelayHistosUsingDb
friend

Definition at line 96 of file SiStripConfigDb.h.

friend class LatencyHistosUsingDb
friend

Definition at line 95 of file SiStripConfigDb.h.

friend class NoiseHistosUsingDb
friend

Definition at line 93 of file SiStripConfigDb.h.

friend class OptoScanHistosUsingDb
friend

Definition at line 89 of file SiStripConfigDb.h.

friend class PedestalsHistosUsingDb
friend

Definition at line 90 of file SiStripConfigDb.h.

friend class PedsFullNoiseHistosUsingDb
friend

Definition at line 91 of file SiStripConfigDb.h.

friend class PedsOnlyHistosUsingDb
friend

Definition at line 92 of file SiStripConfigDb.h.

friend class SiStripCommissioningDbClient
friend

Definition at line 83 of file SiStripConfigDb.h.

Definition at line 84 of file SiStripConfigDb.h.

friend class SiStripCondObjBuilderFromDb
friend

Definition at line 78 of file SiStripConfigDb.h.

friend class SiStripFedCablingBuilderFromDb
friend

Definition at line 75 of file SiStripConfigDb.h.

friend class SiStripNoiseBuilderFromDb
friend

Definition at line 77 of file SiStripConfigDb.h.

friend class SiStripPartition
friend

Definition at line 100 of file SiStripConfigDb.h.

Referenced by usingDatabaseCache().

friend class SiStripPedestalsBuilderFromDb
friend

Definition at line 76 of file SiStripConfigDb.h.

friend class SiStripPsuDetIdMap
friend

Definition at line 79 of file SiStripConfigDb.h.

friend class testSiStripConfigDb
friend

Definition at line 101 of file SiStripConfigDb.h.

friend class VpspScanHistosUsingDb
friend

Definition at line 94 of file SiStripConfigDb.h.

Member Data Documentation

bool SiStripConfigDb::allowCalibUpload_ = false
staticprivate

Definition at line 457 of file SiStripConfigDb.h.

AnalysisDescriptions SiStripConfigDb::analyses_
private

Analysis descriptions for given commissioning run.

Definition at line 418 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::apvDevices_
private

Cache for devices of given type.

Definition at line 421 of file SiStripConfigDb.h.

uint32_t SiStripConfigDb::cntr_ = 0
staticprivate

Static counter of instances of this class.

Definition at line 455 of file SiStripConfigDb.h.

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

FedConnections SiStripConfigDb::connections_
private

FED-FEC connection descriptions.

Definition at line 406 of file SiStripConfigDb.h.

DbClient* SiStripConfigDb::dbCache_
private

Pointer to the DbClient class.

Definition at line 396 of file SiStripConfigDb.h.

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

SiStripDbParams SiStripConfigDb::dbParams_
private

Instance of struct that holds all DB connection parameters.

Definition at line 399 of file SiStripConfigDb.h.

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

DcuDetIds SiStripConfigDb::dcuDetIds_
private

DcuId-DetId map (map of TkDcuInfo objects).

Definition at line 415 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::dcuDevices_
private

Cache for devices of given type.

Definition at line 427 of file SiStripConfigDb.h.

DeviceDescriptions SiStripConfigDb::devices_
private

Device descriptions (including DCUs).

Definition at line 409 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::dohDevices_
private

Cache for devices of given type.

Definition at line 436 of file SiStripConfigDb.h.

DeviceFactory* SiStripConfigDb::factory_
private

Pointer to the DeviceFactory API.

Definition at line 393 of file SiStripConfigDb.h.

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

FedIds SiStripConfigDb::fedIds_
private

FED ids.

Definition at line 442 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

FedDescriptions SiStripConfigDb::feds_
private

Fed9U descriptions.

Definition at line 412 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::lldDevices_
private

Cache for devices of given type.

Definition at line 430 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::muxDevices_
private

Cache for devices of given type.

Definition at line 424 of file SiStripConfigDb.h.

bool SiStripConfigDb::openConnection_
private

Definition at line 452 of file SiStripConfigDb.h.

Referenced by closeDbConnection(), and openDbConnection().

DeviceDescriptionsV SiStripConfigDb::pllDevices_
private

Cache for devices of given type.

Definition at line 433 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::typedDevices_
private

Cache for devices of given type.

Definition at line 439 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

bool SiStripConfigDb::usingStrips_
private

Switch to enable/disable transfer of strip information.

Definition at line 449 of file SiStripConfigDb.h.

Referenced by usingStrips().