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 45 of file SiStripConfigDb.h.

Member Typedef Documentation

typedef CommissioningAnalysisDescription SiStripConfigDb::AnalysisDescription
protected

Definition at line 142 of file SiStripConfigDb.h.

Definition at line 143 of file SiStripConfigDb.h.

Definition at line 144 of file SiStripConfigDb.h.

Definition at line 145 of file SiStripConfigDb.h.

typedef CommissioningAnalysisDescription::commissioningType SiStripConfigDb::AnalysisType
protected

Definition at line 141 of file SiStripConfigDb.h.

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

Definition at line 134 of file SiStripConfigDb.h.

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

Definition at line 133 of file SiStripConfigDb.h.

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

Definition at line 135 of file SiStripConfigDb.h.

Definition at line 136 of file SiStripConfigDb.h.

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

Definition at line 137 of file SiStripConfigDb.h.

typedef deviceDescription SiStripConfigDb::DeviceDescription
protected

Definition at line 117 of file SiStripConfigDb.h.

Definition at line 118 of file SiStripConfigDb.h.

Definition at line 119 of file SiStripConfigDb.h.

Definition at line 120 of file SiStripConfigDb.h.

typedef enumDeviceType SiStripConfigDb::DeviceType
protected

Definition at line 116 of file SiStripConfigDb.h.

typedef ConnectionDescription SiStripConfigDb::FedConnection
protected

Definition at line 110 of file SiStripConfigDb.h.

Definition at line 111 of file SiStripConfigDb.h.

Definition at line 112 of file SiStripConfigDb.h.

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

Definition at line 113 of file SiStripConfigDb.h.

typedef Fed9U::Fed9UDescription SiStripConfigDb::FedDescription
protected

Definition at line 123 of file SiStripConfigDb.h.

Definition at line 124 of file SiStripConfigDb.h.

Definition at line 125 of file SiStripConfigDb.h.

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

Definition at line 126 of file SiStripConfigDb.h.

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

Definition at line 129 of file SiStripConfigDb.h.

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

Definition at line 130 of file SiStripConfigDb.h.

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

Definition at line 203 of file SiStripConfigDb.h.

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

Definition at line 207 of file SiStripConfigDb.h.

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

Definition at line 205 of file SiStripConfigDb.h.

Constructor & Destructor Documentation

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

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

Definition at line 22 of file SiStripConfigDb.cc.

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

23  :
24  factory_(0),
25  dbCache_(0),
26  dbParams_(),
27  // Local cache
28  connections_(),
29  devices_(),
30  feds_(),
31  dcuDetIds_(),
32  analyses_(),
33  apvDevices_(),
34  muxDevices_(),
35  dcuDevices_(),
36  lldDevices_(),
37  pllDevices_(),
38  dohDevices_(),
39  typedDevices_(),
40  fedIds_(),
41  // Misc
42  usingStrips_(true),
43  openConnection_(false)
44 {
45  cntr_++;
47  << "[SiStripConfigDb::" << __func__ << "]"
48  << " Constructing database service..."
49  << " (Class instance: " << cntr_ << ")";
50 
51  // Set DB connection parameters
52  dbParams_.reset();
53  dbParams_.pset( pset );
54  //edm::LogVerbatim(mlConfigDb_) << dbParams_;
55 
56  // Open connection
58 
59 }
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 63 of file SiStripConfigDb.cc.

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

63  {
66  << "[SiStripConfigDb::" << __func__ << "]"
67  << " Destructing object...";
68  if ( cntr_ ) { cntr_--; }
69 }
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 163 of file AnalysisDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, and tmp.

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

163  {
164 
165  if ( !deviceFactory(__func__) ) { return; }
166 
167  if ( partition.empty() ) {
168  stringstream ss;
169  ss << "[SiStripConfigDb::" << __func__ << "]"
170  << " Partition string is empty,"
171  << " therefore cannot add analysis descriptions to local cache!";
172  edm::LogWarning(mlConfigDb_) << ss.str();
173  return;
174  }
175 
176  if ( anals.empty() ) {
177  stringstream ss;
178  ss << "[SiStripConfigDb::" << __func__ << "]"
179  << " Vector of analysis descriptions is empty,"
180  << " therefore cannot add analysis descriptions to local cache!";
181  edm::LogWarning(mlConfigDb_) << ss.str();
182  return;
183  }
184 
185  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
186  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
187  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
188  if ( iter == dbParams_.partitions().end() ) {
189  stringstream ss;
190  ss << "[SiStripConfigDb::" << __func__ << "]"
191  << " Partition \"" << partition
192  << "\" not found in partition list, "
193  << " therefore cannot add analysis descriptions!";
194  edm::LogWarning(mlConfigDb_) << ss.str();
195  return;
196  }
197 
198  AnalysisDescriptionsRange range = analyses_.find( partition );
199  if ( range == analyses_.emptyRange() ) {
200 
201  // Make local copy
203  CommissioningAnalysisFactory::vectorCopy( anals, tmp );
204 
205  // Add to local cache
206  analyses_.loadNext( partition, tmp );
207 
208  // Some debug
209  std::stringstream ss;
210  ss << "[SiStripConfigDb::" << __func__ << "]"
211  << " Added " << anals.size()
212  << " analysis descriptions to local cache for partition \""
213  << partition << "\"."
214  << " (Cache holds analysis descriptions for "
215  << analyses_.size() << " partitions.)";
216  LogTrace(mlConfigDb_) << ss.str();
217 
218  } else {
219  stringstream ss;
220  ss << "[SiStripConfigDb::" << __func__ << "]"
221  << " Partition \"" << partition
222  << "\" already found in local cache, "
223  << " therefore cannot add analysis descriptions!";
224  edm::LogWarning(mlConfigDb_) << ss.str();
225  return;
226  }
227 
228 }
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 109 of file DcuDetIds.cc.

References sistrip::mlConfigDb_.

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

References LogTrace, sistrip::mlConfigDb_, and tmp.

200  {
201 
202  if ( !deviceFactory(__func__) ) { return; }
203 
204  if ( partition.empty() ) {
205  stringstream ss;
206  ss << "[SiStripConfigDb::" << __func__ << "]"
207  << " Partition string is empty,"
208  << " therefore cannot add device descriptions to local cache!";
209  edm::LogWarning(mlConfigDb_) << ss.str();
210  return;
211  }
212 
213  if ( devs.empty() ) {
214  stringstream ss;
215  ss << "[SiStripConfigDb::" << __func__ << "]"
216  << " Vector of device descriptions is empty,"
217  << " therefore cannot add device descriptions to local cache!";
218  edm::LogWarning(mlConfigDb_) << ss.str();
219  return;
220  }
221 
222  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
223  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
224  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
225  if ( iter == dbParams_.partitions().end() ) {
226  stringstream ss;
227  ss << "[SiStripConfigDb::" << __func__ << "]"
228  << " Partition \"" << partition
229  << "\" not found in partition list, "
230  << " therefore cannot add device descriptions!";
231  edm::LogWarning(mlConfigDb_) << ss.str();
232  return;
233  }
234 
235  DeviceDescriptionsRange range = devices_.find( partition );
236  if ( range == devices_.emptyRange() ) {
237 
238  // Make local copy
240  FecFactory::vectorCopyI( tmp, devs, true );
241 
242  // Add to local cache
243  devices_.loadNext( partition, tmp );
244 
245  // Some debug
246  std::stringstream ss;
247  ss << "[SiStripConfigDb::" << __func__ << "]"
248  << " Added " << devs.size()
249  << " device descriptions to local cache for partition \""
250  << partition << "\"."
251  << " (Cache holds device descriptions for "
252  << devices_.size() << " partitions.)";
253  LogTrace(mlConfigDb_) << ss.str();
254 
255  } else {
256  stringstream ss;
257  ss << "[SiStripConfigDb::" << __func__ << "]"
258  << " Partition \"" << partition
259  << "\" already found in local cache, "
260  << " therefore cannot add device descriptions!";
261  edm::LogWarning(mlConfigDb_) << ss.str();
262  return;
263  }
264 
265 }
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 128 of file FedConnections.cc.

References LogTrace, sistrip::mlConfigDb_, and tmp.

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

128  {
129 
130  if ( !deviceFactory(__func__) ) { return; }
131 
132  if ( partition.empty() ) {
133  stringstream ss;
134  ss << "[SiStripConfigDb::" << __func__ << "]"
135  << " Partition string is empty,"
136  << " therefore cannot add FED connections to local cache!";
137  edm::LogWarning(mlConfigDb_) << ss.str();
138  return;
139  }
140 
141  if ( conns.empty() ) {
142  stringstream ss;
143  ss << "[SiStripConfigDb::" << __func__ << "]"
144  << " Vector of FED connections is empty,"
145  << " therefore cannot add FED connections to local cache!";
146  edm::LogWarning(mlConfigDb_) << ss.str();
147  return;
148  }
149 
150  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
151  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
152  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
153  if ( iter == dbParams_.partitions().end() ) {
154  stringstream ss;
155  ss << "[SiStripConfigDb::" << __func__ << "]"
156  << " Partition \"" << partition
157  << "\" not found in partition list, "
158  << " therefore cannot add FED connections!";
159  edm::LogWarning(mlConfigDb_) << ss.str();
160  return;
161  }
162 
163  FedConnectionsRange range = connections_.find( partition );
164  if ( range == connections_.emptyRange() ) {
165 
166  // Make local copy
168  ConnectionFactory::vectorCopyI( tmp, conns, true );
169 
170  // Add to local cache
171  connections_.loadNext( partition, tmp );
172 
173  // Some debug
174  std::stringstream ss;
175  ss << "[SiStripConfigDb::" << __func__ << "]"
176  << " Added " << conns.size()
177  << " FED connections to local cache for partition \""
178  << partition << "\"" << std::endl;
179  ss << "[SiStripConfigDb::" << __func__ << "]"
180  << " Cache holds FED connections for "
181  << connections_.size() << " partitions.";
182  LogTrace(mlConfigDb_) << ss.str();
183 
184  } else {
185  stringstream ss;
186  ss << "[SiStripConfigDb::" << __func__ << "]"
187  << " Partition \"" << partition
188  << "\" already found in local cache, "
189  << " therefore cannot add new FED connections!";
190  edm::LogWarning(mlConfigDb_) << ss.str();
191  return;
192  }
193 
194 }
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 132 of file FedDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, and tmp.

132  {
133 
134  if ( !deviceFactory(__func__) ) { return; }
135 
136  if ( partition.empty() ) {
137  stringstream ss;
138  ss << "[SiStripConfigDb::" << __func__ << "]"
139  << " Partition string is empty,"
140  << " therefore cannot add FED descriptions to local cache!";
141  edm::LogWarning(mlConfigDb_) << ss.str();
142  return;
143  }
144 
145  if ( feds.empty() ) {
146  stringstream ss;
147  ss << "[SiStripConfigDb::" << __func__ << "]"
148  << " Vector of FED descriptions is empty,"
149  << " therefore cannot add FED descriptions to local cache!";
150  edm::LogWarning(mlConfigDb_) << ss.str();
151  return;
152  }
153 
154  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
155  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
156  for ( ; iter != jter; ++iter ) { if ( partition == iter->second.partitionName() ) { break; } }
157  if ( iter == dbParams_.partitions().end() ) {
158  stringstream ss;
159  ss << "[SiStripConfigDb::" << __func__ << "]"
160  << " Partition \"" << partition
161  << "\" not found in partition list, "
162  << " therefore cannot add FED descriptions!";
163  edm::LogWarning(mlConfigDb_) << ss.str();
164  return;
165  }
166 
167  FedDescriptionsRange range = feds_.find( partition );
168  if ( range == feds_.emptyRange() ) {
169 
170  // Make local copy
172  Fed9U::Fed9UDeviceFactory::vectorCopy( tmp, feds );
173 
174  // Add to local cache
175  feds_.loadNext( partition, tmp );
176 
177  // Some debug
178  std::stringstream ss;
179  ss << "[SiStripConfigDb::" << __func__ << "]"
180  << " Added " << feds.size()
181  << " FED descriptions to local cache for partition \""
182  << iter->second.partitionName() << "\"" << std::endl;
183  ss << "[SiStripConfigDb::" << __func__ << "]"
184  << " Cache holds FED descriptions for "
185  << feds_.size() << " partitions.";
186  LogTrace(mlConfigDb_) << ss.str();
187 
188  } else {
189  stringstream ss;
190  ss << "[SiStripConfigDb::" << __func__ << "]"
191  << " Partition \"" << partition
192  << "\" already found in local cache, "
193  << " therefore cannot add new FED descriptions!";
194  edm::LogWarning(mlConfigDb_) << ss.str();
195  return;
196  }
197 
198 }
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 515 of file AnalysisDescriptions.cc.

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

Checks whether file at "path" exists or not.

Definition at line 810 of file SiStripConfigDb.cc.

References recoMuon::in.

Referenced by usingXmlFiles().

810  {
811  fstream fs;
812  fs.open( path.c_str(), ios::in );
813  if( !fs.is_open() ) { return false; }
814  fs.close();
815  return true;
816 }
list path
Definition: scaleCards.py:51
void SiStripConfigDb::clearAnalysisDescriptions ( std::string  partition = "")
protected

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

Definition at line 329 of file AnalysisDescriptions.cc.

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

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

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

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

Definition at line 273 of file DcuDetIds.cc.

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

Referenced by clearLocalCache().

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

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

Definition at line 346 of file DeviceDescriptions.cc.

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

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

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

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

Definition at line 279 of file FedConnections.cc.

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

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

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

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

Definition at line 279 of file FedDescriptions.cc.

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

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

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

Definition at line 177 of file SiStripConfigDb.cc.

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

Referenced by closeDbConnection(), and openDbConnection().

177  {
178 
180  << "[SiStripConfigDb::" << __func__ << "]"
181  << " Clearing local caches...";
182 
186  clearDcuDetIds();
188 
189  typedDevices_.clear();
190  fedIds_.clear();
191 
192 }
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:273
void clearFedDescriptions(std::string partition="")
void SiStripConfigDb::clone ( const DcuDetIdMap in,
DcuDetIdsV out 
) const
private

Definition at line 369 of file DcuDetIds.cc.

References findQualityFiles::jj.

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

Definition at line 378 of file DcuDetIds.cc.

References findQualityFiles::jj.

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

Definition at line 387 of file DcuDetIds.cc.

References findQualityFiles::jj.

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

Closes connection to DeviceFactory API.

Definition at line 141 of file SiStripConfigDb.cc.

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

Referenced by ~SiStripConfigDb().

141  {
142 
144  << "[SiStripConfigDb::" << __func__ << "]"
145  << " Closing connection to database...";
146 
147  // Check if connection exists
148  if ( !openConnection_ ) {
150  << "[SiStripConfigDb::" << __func__ << "]"
151  << " No connection open!";
152  return;
153  }
154  openConnection_ = false;
155 
156  // Clear local caches
157  clearLocalCache();
158 
159  try {
160  if ( factory_ ) { delete factory_; }
161  } catch (...) { handleException( __func__, "Attempting to delete DeviceFactory object..." ); }
162  factory_ = 0;
163 
164  try {
165  if ( dbCache_ ) { delete dbCache_; }
166  } catch (...) { handleException( __func__, "Attempting to delete DbClient object..." ); }
167  dbCache_ = 0;
168 
170  << "[SiStripConfigDb::" << __func__ << "]"
171  << " Closed connection to database...";
172 
173 }
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 212 of file SiStripConfigDb.cc.

References dbCache_, and sistrip::mlConfigDb_.

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

212  {
213  if ( dbCache_ ) { return dbCache_; }
214  else {
215  if ( method_name != "" ) {
216  stringstream ss;
217  ss << "[SiStripConfigDb::" << __func__ << "]"
218  << " NULL pointer to DbClient requested by"
219  << " method SiStripConfigDb::" << method_name << "()!";
220  edm::LogWarning(mlConfigDb_) << ss.str();
221  }
222  return 0;
223  }
224 }
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 514 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().

514  {
515 
516  deviceDescription& desc = const_cast<deviceDescription&>(description);
517 
518  DeviceAddress addr;
519  try {
520  addr.fecCrate_ = static_cast<uint16_t>( desc.getCrateId() + sistrip::FEC_CRATE_OFFSET ); //@@ temporary offset?
521  addr.fecSlot_ = static_cast<uint16_t>( desc.getFecSlot() );
522  addr.fecRing_ = static_cast<uint16_t>( desc.getRingSlot() + sistrip::FEC_RING_OFFSET ); //@@ temporary offset?
523  addr.ccuAddr_ = static_cast<uint16_t>( desc.getCcuAddress() );
524  addr.ccuChan_ = static_cast<uint16_t>( desc.getChannel() );
525  addr.lldChan_ = static_cast<uint16_t>( SiStripFecKey::lldChan( desc.getAddress() ) );
526  addr.i2cAddr_ = static_cast<uint16_t>( desc.getAddress() );
527  } catch (...) { handleException( __func__ ); }
528 
529  return addr;
530 }
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 494 of file AnalysisDescriptions.cc.

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

494  {
495 
496  DeviceAddress addr;
497  try {
498  addr.fecCrate_ = static_cast<uint16_t>( desc.getCrate() + sistrip::FEC_CRATE_OFFSET );
499  addr.fecSlot_ = static_cast<uint16_t>( desc.getSlot() );
500  addr.fecRing_ = static_cast<uint16_t>( desc.getRing() + sistrip::FEC_RING_OFFSET );
501  addr.ccuAddr_ = static_cast<uint16_t>( desc.getCcuAdr() );
502  addr.ccuChan_ = static_cast<uint16_t>( desc.getCcuChan() );
503  addr.lldChan_ = static_cast<uint16_t>( SiStripFecKey::lldChan( desc.getI2cAddr() ) );
504  addr.i2cAddr_ = static_cast<uint16_t>( desc.getI2cAddr() );
505  addr.fedId_ = static_cast<uint16_t>( desc.getFedId() ); //@@ offset required? crate/slot needed?
506  addr.feUnit_ = static_cast<uint16_t>( desc.getFeUnit() );
507  addr.feChan_ = static_cast<uint16_t>( desc.getFeChan() );
508  } catch (...) { handleException( __func__ ); }
509 
510  return addr;
511 }
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 196 of file SiStripConfigDb.cc.

References factory_, and sistrip::mlConfigDb_.

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

196  {
197  if ( factory_ ) { return factory_; }
198  else {
199  if ( method_name != "" ) {
200  stringstream ss;
201  ss << "[SiStripConfigDb::" << __func__ << "]"
202  << " NULL pointer to DeviceFactory requested by"
203  << " method SiStripConfigDb::" << method_name << "()!";
204  edm::LogWarning(mlConfigDb_) << ss.str();
205  }
206  return 0;
207  }
208 }
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 534 of file DeviceDescriptions.cc.

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

Utility method.

Definition at line 396 of file DcuDetIds.cc.

References begin, and end.

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

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

Utility method.

Definition at line 409 of file DcuDetIds.cc.

References begin, and end.

411  {
412  DcuDetIdsV::iterator iter = begin;
413  DcuDetIdsV::iterator jter = end;
414  for ( ; iter != jter; ++iter ) {
415  if ( iter->second && iter->second->getDcuHardId() == dcu_id ) { return iter; }
416  }
417  return end;
418 }
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescriptions ( AnalysisType  analysis_type,
std::string  partition = "" 
)
protected

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

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

Definition at line 23 of file AnalysisDescriptions.cc.

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

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

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

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

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

11  {
12 
13  // Check
14  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
15  ( dbParams_.usingDbCache() && !databaseCache(__func__) ) ) {
16  return dcuDetIds_.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  DcuDetIdsRange range = dcuDetIds_.find( iter->second.partitionName() );
32  if ( range == dcuDetIds_.emptyRange() ) {
33 
34  deviceFactory(__func__)->addDetIdPartition( iter->second.partitionName(),
35  iter->second.dcuVersion().first,
36  iter->second.dcuVersion().second );
37 
38  // Retrieve DCU-DetId map
39  DcuDetIdMap src = deviceFactory(__func__)->getInfos();
40 
41  // Make local copy
42  DcuDetIdsV dst;
43  clone( src, dst );
44 
45  // Add to cache
46  dcuDetIds_.loadNext( iter->second.partitionName(), dst );
47 
48  }
49 
50  }
51 
52  }
53 
54  } else { // Using database cache
55 
56  // Retrieve DCU-DetId map
57  DcuDetIdMap* src = databaseCache(__func__)->getInfos();
58 
59  if ( src ) {
60 
61  // Make local copy
62  DcuDetIdsV dst;
63  clone( *src, dst );
64 
65  // Add to cache
67 
68  } else {
70  << "[SiStripConfigDb::" << __func__ << "]"
71  << " NULL pointer to Dcu-DetId map!";
72  }
73 
74  }
75 
76  } catch (... ) { handleException( __func__ ); }
77 
78  // Create range object
79  uint16_t np = 0;
80  uint16_t nc = 0;
81  DcuDetIdsRange range;
82  if ( partition != "" ) {
83  range = dcuDetIds_.find( partition );
84  np = 1;
85  nc = range.size();
86  } else {
87  if ( !dcuDetIds_.empty() ) {
88  range = DcuDetIdsRange( dcuDetIds_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
89  dcuDetIds_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
90  } else { range = dcuDetIds_.emptyRange(); }
91  np = dcuDetIds_.size();
92  nc = range.size();
93  }
94 
95  stringstream ss;
96  ss << "[SiStripConfigDb::" << __func__ << "]"
97  << " Found " << nc << " entries in DCU-DetId map";
98  if ( !dbParams_.usingDb() ) { ss << " in " << dbParams_.inputDcuInfoXmlFiles().size() << " 'module.xml' file(s)"; }
99  else { if ( !dbParams_.usingDbCache() ) { ss << " in " << np << " database partition(s)"; }
100  else { ss << " from shared memory name '" << dbParams_.sharedMemory() << "'"; } }
101  if ( dcuDetIds_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
102  else { LogTrace(mlConfigDb_) << ss.str(); }
103 
104  return range;
105 }
void clone(const DcuDetIdMap &in, DcuDetIdsV &out) const
Definition: DcuDetIds.cc:369
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:38
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:31
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 12 of file DeviceDescriptions.cc.

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

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().

12  {
13 
14  // Check
15  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
16  ( dbParams_.usingDbCache() && !databaseCache(__func__) ) ) {
17  return devices_.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  DeviceDescriptionsRange range = devices_.find( iter->second.partitionName() );
33  if ( range == devices_.emptyRange() ) {
34 
35  // Retrieve conections
37  deviceFactory(__func__)->getFecDeviceDescriptions( iter->second.partitionName(),
38  tmp1,
39  iter->second.fecVersion().first,
40  iter->second.fecVersion().second,
41  //#ifdef USING_DATABASE_MASKING
42  iter->second.maskVersion().first,
43  iter->second.maskVersion().second,
44  //#endif
45  false ); //@@ do not get DISABLED devices
46 
47  // Make local copy
49  FecFactory::vectorCopyI( tmp2, tmp1, true );
50 
51  // Add to cache
52  devices_.loadNext( iter->second.partitionName(), tmp2 );
53 
54  // Some debug
55  DeviceDescriptionsRange range = devices_.find( iter->second.partitionName() );
56  std::stringstream ss;
57  ss << "[SiStripConfigDb::" << __func__ << "]"
58  << " Downloaded " << range.size()
59  << " device descriptions to local cache for partition \""
60  << iter->second.partitionName() << "\"" << std::endl;
61  ss << "[SiStripConfigDb::" << __func__ << "]"
62  << " Cache holds device descriptions for "
63  << devices_.size() << " partitions.";
64  LogTrace(mlConfigDb_) << ss.str();
65 
66  }
67 
68  }
69 
70  }
71 
72  } else { // Using database cache
73 
74  DeviceDescriptionsV* tmp1 = databaseCache(__func__)->getDevices();
75 
76  if ( tmp1 ) {
77 
78  // Make local copy
80  FecFactory::vectorCopyI( tmp2, *tmp1, true );
81 
82  // Add to cache
84 
85  } else {
87  << "[SiStripConfigDb::" << __func__ << "]"
88  << " NULL pointer to DeviceDescriptions vector!";
89  }
90 
91  }
92 
93  } catch (...) { handleException( __func__ ); }
94 
95  // Create range object
96  uint16_t np = 0;
97  uint16_t nc = 0;
99  if ( partition != "" ) {
100  devs = devices_.find( partition );
101  np = 1;
102  nc = devs.size();
103  } else {
104  if ( !devices_.empty() ) {
105  devs = DeviceDescriptionsRange( devices_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
106  devices_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
107  } else { devs = devices_.emptyRange(); }
108  np = devices_.size();
109  nc = devs.size();
110  }
111 
112  stringstream ss;
113  ss << "[SiStripConfigDb::" << __func__ << "]"
114  << " Found " << nc << " device descriptions";
115  if ( !dbParams_.usingDb() ) { ss << " in " << dbParams_.inputFecXmlFiles().size() << " 'fec.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 ( devices_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
119  else { LogTrace(mlConfigDb_) << ss.str(); }
120 
121  return devs;
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
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:38
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:31
bool usingDbCache() const
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 127 of file DeviceDescriptions.cc.

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

128  {
129 
130  typedDevices_.clear();
131  apvDevices_.clear();
132  muxDevices_.clear();
133  dcuDevices_.clear();
134  lldDevices_.clear();
135  pllDevices_.clear();
136  dohDevices_.clear();
137 
139 
140  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
141  ( dbParams_.usingDbCache() && !databaseCache(__func__) ) ) {
142  return tmp;
143  }
144 
145  try {
147  if ( !devs.empty() ) {
148  DeviceDescriptionsV tmp( devs.begin(), devs.end() );
149  typedDevices_ = FecFactory::getDeviceFromDeviceVector( tmp, device_type );
150  }
151  } catch (...) { handleException( __func__ ); }
152 
153  if ( device_type == APV25 ) {
154  apvDevices_.swap( typedDevices_ );
156  } else if ( device_type == APVMUX ) {
157  muxDevices_.swap( typedDevices_ );
159  } else if ( device_type == DCU ) {
160  dcuDevices_.swap( typedDevices_ );
162  } else if ( device_type == LASERDRIVER ) {
163  lldDevices_.swap( typedDevices_ );
165  } else if ( device_type == PLL ) {
166  pllDevices_.swap( typedDevices_ );
168  } else if ( device_type == DOH ) {
169  dohDevices_.swap( typedDevices_ );
171  } else {
173  }
174 
175 // stringstream sss;
176 // sss << " Number of devices:"
177 // << " TYP: " << typedDevices_.size()
178 // << " APV: " << apvDevices_.size()
179 // << " MUX: " << muxDevices_.size()
180 // << " DCU: " << dcuDevices_.size()
181 // << " LLD: " << lldDevices_.size()
182 // << " PLL: " << pllDevices_.size()
183 // << " DOH: " << dohDevices_.size()
184 // << " tmp: " << tmp.size();
185 // LogTrace(mlConfigDb_) << sss.str();
186 
187  stringstream ss;
188  ss << "[SiStripConfigDb::" << __func__ << "]"
189  << " Extracted " << tmp.size()
190  << " device descriptions (for devices of type "
191  << deviceType( device_type ) << ")";
192  LogTrace(mlConfigDb_) << ss.str();
193 
194  return tmp;
195 
196 }
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 12 of file FedConnections.cc.

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

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

12  {
13 
14  // Check
15  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
16  ( dbParams_.usingDbCache() && !databaseCache(__func__) ) ) {
17  return connections_.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  FedConnectionsRange range = connections_.find( iter->second.partitionName() );
33  if ( range == connections_.emptyRange() ) {
34 
35  FedConnectionsV tmp2;
36 
37  // Retrieve connections
38  FedConnectionsV tmp1;
39  deviceFactory(__func__)->getConnectionDescriptions( iter->second.partitionName(),
40  tmp1,
41  iter->second.cabVersion().first,
42  iter->second.cabVersion().second,
43  //#ifdef USING_DATABASE_MASKING
44  iter->second.maskVersion().first,
45  iter->second.maskVersion().second,
46  //#endif
47  false ); //@@ do not get DISABLED connections
48 
49  // Make local copy
50  ConnectionFactory::vectorCopyI( tmp2, tmp1, true );
51 
52  // Add to cache
53  connections_.loadNext( iter->second.partitionName(), tmp2 );
54 
55  // Some debug
56  FedConnectionsRange conns = connections_.find( iter->second.partitionName() );
57  std::stringstream ss;
58  ss << "[SiStripConfigDb::" << __func__ << "]"
59  << " Downloaded " << conns.size()
60  << " FED connections to local cache for partition \""
61  << iter->second.partitionName() << "\"" << std::endl;
62  ss << "[SiStripConfigDb::" << __func__ << "]"
63  << " Cache holds FED connections for "
64  << connections_.size() << " partitions.";
65  LogTrace(mlConfigDb_) << ss.str();
66 
67  }
68 
69  }
70 
71  }
72 
73  } else { // Use database cache
74 
75  FedConnectionsV* tmp1 = databaseCache(__func__)->getConnections();
76 
77  if ( tmp1 ) {
78 
79  // Make local copy
80  FedConnectionsV tmp2;
81  ConnectionFactory::vectorCopyI( tmp2, *tmp1, true );
82 
83  // Add to cache
85 
86  } else {
88  << "[SiStripConfigDb::" << __func__ << "]"
89  << " NULL pointer to FedConnections vector!";
90  }
91 
92  }
93 
94  } catch (...) { handleException( __func__ ); }
95 
96  // Create range object
97  uint16_t np = 0;
98  uint16_t nc = 0;
99  FedConnectionsRange conns;
100  if ( partition != "" ) {
101  conns = connections_.find( partition );
102  np = 1;
103  nc = conns.size();
104  } else {
105  if ( !connections_.empty() ) {
106  conns = FedConnectionsRange( connections_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(),
107  connections_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() );
108  } else { conns = connections_.emptyRange(); }
109  np = connections_.size();
110  nc = conns.size();
111  }
112 
113  stringstream ss;
114  ss << "[SiStripConfigDb::" << __func__ << "]"
115  << " Found " << nc << " FED connections";
116  if ( !dbParams_.usingDb() ) { ss << " in " << dbParams_.inputModuleXmlFiles().size() << " 'module.xml' file(s)"; }
117  else { if ( !dbParams_.usingDbCache() ) { ss << " in " << np << " database partition(s)"; }
118  else { ss << " from shared memory name '" << dbParams_.sharedMemory() << "'"; } }
119  if ( connections_.empty() ) { edm::LogWarning(mlConfigDb_) << ss.str(); }
120  else { LogTrace(mlConfigDb_) << ss.str(); }
121 
122  return conns;
123 
124 }
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:38
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:31
bool usingDbCache() const
std::vector< FedConnection * > FedConnectionsV
SiStripConfigDb::FedDescriptionsRange SiStripConfigDb::getFedDescriptions ( std::string  partition = "")
protected

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

Definition at line 13 of file FedDescriptions.cc.

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

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

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

Extracts FED ids from FED descriptions.

Definition at line 431 of file FedDescriptions.cc.

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

Referenced by SiStripFedCablingBuilderFromDb::buildFecCablingFromDevices().

431  {
432 
433  fedIds_.clear();
434 
435  if ( ( !dbParams_.usingDbCache() && !deviceFactory(__func__) ) ||
436  ( dbParams_.usingDbCache() && !databaseCache(__func__) ) ) {
437  return FedIdsRange( fedIds_.end(), fedIds_.end() );
438  }
439 
440  try {
441 
442  // Inhibit download of strip info
443  bool using_strips = usingStrips_;
444  if ( factory_ ) { factory_->setUsingStrips( false ); }
445  FedDescriptionsRange feds = getFedDescriptions( partition );
446  if ( factory_ ) { factory_->setUsingStrips( using_strips ); }
447 
448  if ( !feds.empty() ) {
449  FedDescriptionsV::const_iterator ifed = feds.begin();
450  FedDescriptionsV::const_iterator jfed = feds.end();
451  for ( ; ifed != jfed; ++ifed ) {
452  if ( *ifed ) { fedIds_.push_back( (*ifed)->getFedId() ); }
453  else {
455  << "[SiStripConfigDb::" << __func__ << "]"
456  << " NULL pointer to FedDescription!";
457  continue;
458  }
459  }
460  }
461 
462  } catch (...) { handleException( __func__ ); }
463 
464  if ( fedIds_.empty() ) {
466  << "[SiStripConfigDb::" << __func__ << "]"
467  << " No FED ids found!";
468  }
469 
470  return FedIdsRange( fedIds_.begin(), fedIds_.end() );
471 
472 }
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 740 of file SiStripConfigDb.cc.

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

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

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

Establishes connection to DeviceFactory API.

Definition at line 103 of file SiStripConfigDb.cc.

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

Referenced by SiStripConfigDb().

103  {
104 
106  << "[SiStripConfigDb::" << __func__ << "]"
107  << " Opening connection to database...";
108 
109  // Check if connection already exists
110  if ( openConnection_ ) {
112  << "[SiStripConfigDb::" << __func__ << "]"
113  << " Connection already open!";
114  return;
115  }
116  openConnection_ = true;
117 
118  // Establish database connection
119  if ( dbParams_.usingDb() ) {
121  else { usingDatabase(); }
122  } else { usingXmlFiles(); }
123 
124  std::stringstream ss;
125  ss << "[SiStripConfigDb::" << __func__ << "]"
126  << " Database connection parameters: "
127  << std::endl << dbParams_;
128  edm::LogVerbatim(mlConfigDb_) << ss.str();
129 
130  // Clear local caches
131  clearLocalCache();
132 
134  << "[SiStripConfigDb::" << __func__ << "]"
135  << " Opened connection to database!";
136 
137 }
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 1012 of file SiStripConfigDb.cc.

References deviceFactory(), and sistrip::mlConfigDb_.

Referenced by usingDatabase().

1012  {
1013 
1014  partitions.clear();
1015 
1016  // Check DF pointer
1017  DeviceFactory* const df = deviceFactory(__func__);
1018  if ( !df ) {
1020  << "[SiStripPartition::" << __func__ << "]"
1021  << " NULL pointer to DeviceFactory object!";
1022  return;
1023  }
1024 
1025  partitions = df->getAllPartitionNames();
1026 
1027 }
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 395 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_, findQualityFiles::jj, combine::key, SiStripKey::key(), SiStripConfigDb::DeviceAddress::lldChan_, LogTrace, sistrip::mlConfigDb_, python.multivaluedict::sort(), groupFilesInBlocks::temp, and tmp.

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

References LogTrace, and sistrip::mlConfigDb_.

339  {
340 
341  std::stringstream ss;
342  ss << "[SiStripConfigDb::" << __func__ << "]"
343  << " Contents of DcuDetIds container:" << std::endl;
344  ss << " Number of partitions: " << dcuDetIds_.size() << std::endl;
345 
346  // Loop through partitions
347  uint16_t cntr = 0;
350  for ( ; idcu != jdcu; ++idcu ) {
351 
352  cntr++;
353  if ( partition == "" || partition == idcu->first ) {
354 
355  ss << " Partition number : " << cntr << " (out of " << dcuDetIds_.size() << ")" << std::endl;
356  ss << " Partition name : \"" << idcu->first << "\"" << std::endl;
357  ss << " Size of DCU-DetId map : " << idcu->second.size() << std::endl;
358 
359  }
360 
361  }
362 
363  LogTrace(mlConfigDb_) << ss.str();
364 
365 }
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 412 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_, findQualityFiles::jj, combine::key, SiStripKey::key(), SiStripConfigDb::DeviceAddress::lldChan_, LogTrace, sistrip::mlConfigDb_, python.multivaluedict::sort(), groupFilesInBlocks::temp, and tmp.

412  {
413 
414  std::stringstream ss;
415  ss << "[SiStripConfigDb::" << __func__ << "]"
416  << " Contents of DeviceDescriptions container:" << std::endl;
417  ss << " Number of partitions: " << devices_.size() << std::endl;
418 
419  // Loop through partitions
420  uint16_t cntr = 0;
423  for ( ; idev != jdev; ++idev ) {
424 
425  cntr++;
426  if ( partition == "" || partition == idev->first ) {
427 
428  ss << " Partition number : " << cntr << " (out of " << devices_.size() << ")" << std::endl;
429  ss << " Partition name : \"" << idev->first << "\"" << std::endl;
430  ss << " Num of devices : " << idev->second.size() << std::endl;
431 
432  // Extract FEC crate, slot, etc
433  std::map< uint32_t, vector<std::string> > devices;
434  DeviceDescriptionsV::const_iterator iter = idev->second.begin();
435  DeviceDescriptionsV::const_iterator jter = idev->second.end();
436  for ( ; iter != jter; ++iter ) {
437  if ( *iter ) {
438  DeviceAddress addr = deviceAddress( **iter );
439  uint32_t key = SiStripFecKey( addr.fecCrate_,
440  addr.fecSlot_,
441  addr.fecRing_,
442  0,
443  0,
444  0,
445  0 ).key();
446  std::stringstream data;
447  data << (*iter)->getDeviceType()
448  << "_"
449  << SiStripFecKey( addr.fecCrate_,
450  addr.fecSlot_,
451  addr.fecRing_,
452  addr.ccuAddr_,
453  addr.ccuChan_,
454  addr.lldChan_,
455  addr.i2cAddr_ ).key();
456  if ( find( devices[key].begin(), devices[key].end(), data.str() ) == devices[key].end() ) {
457  devices[key].push_back( data.str() );
458  }
459  }
460  }
461 
462  // Sort contents
463  std::map< uint32_t, std::vector<std::string> > tmp;
464  std::map< uint32_t, std::vector<std::string> >::const_iterator ii = devices.begin();
465  std::map< uint32_t, std::vector<std::string> >::const_iterator jj = devices.end();
466  for ( ; ii != jj; ++ii ) {
467  std::vector<std::string> temp = ii->second;
468  std::sort( temp.begin(), temp.end() );
469  std::vector<std::string>::const_iterator iii = temp.begin();
470  std::vector<std::string>::const_iterator jjj = temp.end();
471  for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
472  }
473  devices.clear();
474  devices = tmp;
475 
476  // Print FEC crate, slot, etc...
477  std::map< uint32_t, std::vector<std::string> >::const_iterator idev = devices.begin();
478  std::map< uint32_t, std::vector<std::string> >::const_iterator jdev = devices.end();
479  for ( ; idev != jdev; ++idev ) {
480  SiStripFecKey key(idev->first);
481  ss << " Found " << std::setw(3) << idev->second.size()
482  << " devices for FEC crate/slot/ring "
483  << key.fecCrate() << "/"
484  << key.fecSlot() << "/"
485  << key.fecRing();
486  //<< " (ccu/module/lld/i2c): ";
487  // if ( !idev->second.empty() ) {
488  // uint16_t first = idev->second.front();
489  // uint16_t last = idev->second.front();
490  // std::vector<std::string>::const_iterator chan = idev->second.begin();
491  // for ( ; chan != idev->second.end(); chan++ ) {
492  // if ( chan != idev->second.begin() ) {
493  // if ( *chan != last+1 ) {
494  // ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
495  // if ( chan != idev->second.end() ) { first = *(chan+1); }
496  // }
497  // }
498  // last = *chan;
499  // }
500  // if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
501  ss << std::endl;
502  }
503 
504  }
505 
506  }
507 
508  LogTrace(mlConfigDb_) << ss.str();
509 
510 }
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:126
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:46
const_iterator begin() const
Definition: MapOfVectors.h:129
size_type size() const
Definition: MapOfVectors.h:104
#define end
Definition: vmac.h:38
DeviceAddress deviceAddress(const deviceDescription &)
#define LogTrace(id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
DeviceDescriptions devices_
#define begin
Definition: vmac.h:31
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 345 of file FedConnections.cc.

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

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

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

348  {
349 
350  std::stringstream ss;
351  ss << "[SiStripConfigDb::" << __func__ << "]"
352  << " Contents of FedDescriptions container:" << std::endl;
353  ss << " Number of partitions: " << feds_.size() << std::endl;
354 
355  // Loop through partitions
356  uint16_t cntr = 0;
359  for ( ; iconn != jconn; ++iconn ) {
360 
361  cntr++;
362  if ( partition == "" || partition == iconn->first ) {
363 
364  ss << " Partition number : " << cntr << " (out of " << feds_.size() << ")" << std::endl;
365  ss << " Partition name : \"" << iconn->first << "\"" << std::endl;
366  ss << " Num of FED ids : " << iconn->second.size() << std::endl;
367 
368  // Extract FED crates and ids
369  std::map< uint16_t, vector<uint16_t> > feds;
370  FedDescriptionsV::const_iterator iter = iconn->second.begin();
371  FedDescriptionsV::const_iterator jter = iconn->second.end();
372  for ( ; iter != jter; ++iter ) {
373  if ( *iter ) {
374  uint16_t key = (*iter)->getCrateNumber();
375  uint16_t data = (*iter)->getFedId();
376  if ( find( feds[key].begin(), feds[key].end(), data ) == feds[key].end() ) {
377  feds[key].push_back( data );
378  }
379  }
380  }
381 
382  // Sort contents
383  std::map< uint16_t, std::vector<uint16_t> > tmp;
384  std::map< uint16_t, std::vector<uint16_t> >::const_iterator ii = feds.begin();
385  std::map< uint16_t, std::vector<uint16_t> >::const_iterator jj = feds.end();
386  for ( ; ii != jj; ++ii ) {
387  std::vector<uint16_t> temp = ii->second;
388  std::sort( temp.begin(), temp.end() );
389  std::vector<uint16_t>::const_iterator iii = temp.begin();
390  std::vector<uint16_t>::const_iterator jjj = temp.end();
391  for ( ; iii != jjj; ++iii ) { tmp[ii->first].push_back( *iii ); }
392  }
393  feds.clear();
394  feds = tmp;
395 
396  // Print FED crates and ids
397  std::map< uint16_t, std::vector<uint16_t> >::const_iterator ifed = feds.begin();
398  std::map< uint16_t, std::vector<uint16_t> >::const_iterator jfed = feds.end();
399  for ( ; ifed != jfed; ++ifed ) {
400  ss << " Found " << std::setw(2) << ifed->second.size()
401  << " FED ids for crate number " << std::setw(2) << ifed->first << " : ";
402  if ( !ifed->second.empty() ) {
403  uint16_t first = ifed->second.front();
404  uint16_t last = ifed->second.front();
405  std::vector<uint16_t>::const_iterator icrate = ifed->second.begin();
406  std::vector<uint16_t>::const_iterator jcrate = ifed->second.end();
407  for ( ; icrate != jcrate; ++icrate ) {
408  if ( icrate != ifed->second.begin() ) {
409  if ( *icrate != last+1 ) {
410  ss << std::setw(2) << first << "->" << std::setw(2) << last << ", ";
411  if ( icrate != ifed->second.end() ) { first = *(icrate+1); }
412  }
413  }
414  last = *icrate;
415  }
416  if ( first != last ) { ss << std::setw(2) << first << "->" << std::setw(2) << last; }
417  ss << std::endl;
418  }
419  }
420 
421  }
422 
423  }
424 
425  LogTrace(mlConfigDb_) << ss.str();
426 
427 }
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:38
bool first
Definition: L1TdeRCT.cc:94
#define LogTrace(id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define begin
Definition: vmac.h:31
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 820 of file SiStripConfigDb.cc.

References cond::ecalcond::all, sistrip::APV_LATENCY, sistrip::APV_TIMING, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, sistrip::DAQ_SCOPE_MODE, deviceFactory(), sistrip::FAST_CABLING, sistrip::FED_CABLING, sistrip::FED_TIMING, sistrip::FINE_DELAY, sistrip::FINE_DELAY_PLL, sistrip::FINE_DELAY_TTC, 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().

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

References dbParams_, newFWLiteAna::found, 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().

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

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

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

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

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

Referenced by CommissioningHistosUsingDb::uploadAnalyses().

233  {
234 
235  if ( dbParams_.usingDbCache() ) {
237  << "[SiStripConfigDb::" << __func__ << "]"
238  << " Using database cache! No uploads allowed!";
239  return;
240  }
241 
242  if ( !deviceFactory(__func__) ) { return; }
243 
244  if ( analyses_.empty() ) {
246  << "[SiStripConfigDb::" << __func__ << "]"
247  << " Found no cached analysis descriptions, therefore no upload!";
248  return;
249  }
250 
251  if ( calibration_for_physics && !allowCalibUpload_ ) {
253  << "[SiStripConfigDb::" << __func__ << "]"
254  << " Attempting to upload calibration constants"
255  << " without uploading any hardware descriptions!"
256  << " Aborting upload...";
257  return;
258  } else { allowCalibUpload_ = false; }
259 
260  try {
261 
262  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
263  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
264  for ( ; iter != jter; ++iter ) {
265 
266  if ( partition == "" || partition == iter->second.partitionName() ) {
267 
268  AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() );
269  if ( range != analyses_.emptyRange() ) {
270 
271  AnalysisDescriptionsV anals( range.begin(), range.end() );
272 
273  AnalysisType analysis_type = AnalysisDescription::T_UNKNOWN;
274  if ( anals.front() ) { analysis_type = anals.front()->getType(); }
275  if ( analysis_type == AnalysisDescription::T_UNKNOWN ) {
277  << "[SiStripConfigDb::" << __func__ << "]"
278  << " Analysis type is UNKNOWN. Aborting upload!";
279  return;
280  }
281 
282  uint32_t version = deviceFactory(__func__)->uploadAnalysis( iter->second.runNumber(),
283  iter->second.partitionName(),
284  analysis_type,
285  anals,
286  calibration_for_physics );
287 
288  // Update current state with analysis descriptions
289  if ( calibration_for_physics ) { deviceFactory(__func__)->uploadAnalysisState( version ); }
290 
291  // Some debug
292  std::stringstream ss;
293  ss << "[SiStripConfigDb::" << __func__ << "]"
294  << " Uploaded " << anals.size()
295  << " device descriptions to database for partition \""
296  << iter->second.partitionName() << "\".";
297  LogTrace(mlConfigDb_) << ss.str();
298 
299  } else {
300  stringstream ss;
301  ss << "[SiStripConfigDb::" << __func__ << "]"
302  << " Vector of device descriptions is empty for partition \""
303  << iter->second.partitionName()
304  << "\", therefore aborting upload for this partition!";
305  edm::LogWarning(mlConfigDb_) << ss.str();
306  continue;
307  }
308 
309  } else {
310  // stringstream ss;
311  // ss << "[SiStripConfigDb::" << __func__ << "]"
312  // << " Cannot find partition \"" << partition
313  // << "\" in cached partitions list: \""
314  // << dbParams_.partitionNames( dbParams_.partitionNames() )
315  // << "\", therefore aborting upload for this partition!";
316  // edm::LogWarning(mlConfigDb_) << ss.str();
317  }
318 
319  }
320 
321  } catch (...) { handleException( __func__ ); }
322 
323  allowCalibUpload_ = true;
324 
325 }
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 184 of file DcuDetIds.cc.

References sistrip::mlConfigDb_.

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

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

Definition at line 269 of file DeviceDescriptions.cc.

References LogTrace, sistrip::mlConfigDb_, and funct::true.

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

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

References LogTrace, sistrip::mlConfigDb_, and funct::true.

Referenced by FastFedCablingHistosUsingDb::uploadConfigurations().

198  {
199 
200  if ( dbParams_.usingDbCache() ) {
202  << "[SiStripConfigDb::" << __func__ << "]"
203  << " Using database cache! No uploads allowed!";
204  return;
205  }
206 
207  if ( !deviceFactory(__func__) ) { return; }
208 
209  if ( connections_.empty() ) {
210  stringstream ss;
211  ss << "[SiStripConfigDb::" << __func__ << "]"
212  << " Found no cached FED connections, therefore no upload!";
213  edm::LogWarning(mlConfigDb_) << ss.str();
214  return;
215  }
216 
217  if ( dbParams_.usingDb() ) {
218 
219  try {
220 
221  SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin();
222  SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end();
223  for ( ; iter != jter; ++iter ) {
224 
225  if ( partition == "" || partition == iter->second.partitionName() ) {
226 
227  FedConnectionsRange range = connections_.find( iter->second.partitionName() );
228  if ( range != connections_.emptyRange() ) {
229 
230  FedConnectionsV conns( range.begin(), range.end() );
231 
232  SiStripPartition::Versions cabVersion = iter->second.cabVersion();
233  deviceFactory(__func__)->setConnectionDescriptions( conns,
234  iter->second.partitionName(),
235  &(cabVersion.first),
236  &(cabVersion.second),
237  true ); // new major version
238 
239  // Some debug
240  std::stringstream ss;
241  ss << "[SiStripConfigDb::" << __func__ << "]"
242  << " Uploaded " << conns.size()
243  << " FED connections to database for partition \""
244  << iter->second.partitionName() << "\".";
245  LogTrace(mlConfigDb_) << ss.str();
246 
247  } else {
248  stringstream ss;
249  ss << "[SiStripConfigDb::" << __func__ << "]"
250  << " Vector of FED connections is empty for partition \""
251  << iter->second.partitionName()
252  << "\", therefore aborting upload for this partition!";
253  edm::LogWarning(mlConfigDb_) << ss.str();
254  continue;
255  }
256 
257  } else {
258  // stringstream ss;
259  // ss << "[SiStripConfigDb::" << __func__ << "]"
260  // << " Cannot find partition \"" << partition
261  // << "\" in cached partitions list: \""
262  // << dbParams_.partitionNames( dbParams_.partitionNames() )
263  // << "\", therefore aborting upload for this partition!";
264  // edm::LogWarning(mlConfigDb_) << ss.str();
265  }
266 
267  }
268 
269  } catch (...) { handleException( __func__ ); }
270 
271  }
272 
273  allowCalibUpload_ = true;
274 
275 }
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 202 of file FedDescriptions.cc.

References LogTrace, and sistrip::mlConfigDb_.

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

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

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

Referenced by openDbConnection().

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

Definition at line 454 of file SiStripConfigDb.cc.

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

Referenced by openDbConnection().

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

References dbParams_, and SiStripDbParams::usingDb().

471 { 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 474 of file SiStripConfigDb.h.

References usingStrips_.

474 { 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 477 of file SiStripConfigDb.h.

References usingStrips_.

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

Definition at line 523 of file SiStripConfigDb.cc.

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

Referenced by openDbConnection().

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

friend class CalibrationHistosUsingDb
friend

Definition at line 98 of file SiStripConfigDb.h.

friend class CommissioningHistosUsingDb
friend

Definition at line 86 of file SiStripConfigDb.h.

friend class FastFedCablingHistosUsingDb
friend

Definition at line 87 of file SiStripConfigDb.h.

friend class FedCablingHistosUsingDb
friend

Definition at line 88 of file SiStripConfigDb.h.

friend class FineDelayHistosUsingDb
friend

Definition at line 97 of file SiStripConfigDb.h.

friend class LatencyHistosUsingDb
friend

Definition at line 96 of file SiStripConfigDb.h.

friend class NoiseHistosUsingDb
friend

Definition at line 94 of file SiStripConfigDb.h.

friend class OptoScanHistosUsingDb
friend

Definition at line 90 of file SiStripConfigDb.h.

friend class PedestalsHistosUsingDb
friend

Definition at line 91 of file SiStripConfigDb.h.

friend class PedsFullNoiseHistosUsingDb
friend

Definition at line 92 of file SiStripConfigDb.h.

friend class PedsOnlyHistosUsingDb
friend

Definition at line 93 of file SiStripConfigDb.h.

friend class SiStripCommissioningDbClient
friend

Definition at line 84 of file SiStripConfigDb.h.

Definition at line 85 of file SiStripConfigDb.h.

friend class SiStripCondObjBuilderFromDb
friend

Definition at line 79 of file SiStripConfigDb.h.

friend class SiStripFedCablingBuilderFromDb
friend

Definition at line 76 of file SiStripConfigDb.h.

friend class SiStripNoiseBuilderFromDb
friend

Definition at line 78 of file SiStripConfigDb.h.

friend class SiStripPartition
friend

Definition at line 101 of file SiStripConfigDb.h.

Referenced by usingDatabaseCache().

friend class SiStripPedestalsBuilderFromDb
friend

Definition at line 77 of file SiStripConfigDb.h.

friend class SiStripPsuDetIdMap
friend

Definition at line 80 of file SiStripConfigDb.h.

friend class testSiStripConfigDb
friend

Definition at line 102 of file SiStripConfigDb.h.

friend class VpspScanHistosUsingDb
friend

Definition at line 95 of file SiStripConfigDb.h.

Member Data Documentation

bool SiStripConfigDb::allowCalibUpload_ = false
staticprivate

Definition at line 458 of file SiStripConfigDb.h.

AnalysisDescriptions SiStripConfigDb::analyses_
private

Analysis descriptions for given commissioning run.

Definition at line 419 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::apvDevices_
private

Cache for devices of given type.

Definition at line 422 of file SiStripConfigDb.h.

uint32_t SiStripConfigDb::cntr_ = 0
staticprivate

Static counter of instances of this class.

Definition at line 456 of file SiStripConfigDb.h.

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

FedConnections SiStripConfigDb::connections_
private

FED-FEC connection descriptions.

Definition at line 407 of file SiStripConfigDb.h.

DbClient* SiStripConfigDb::dbCache_
private

Pointer to the DbClient class.

Definition at line 397 of file SiStripConfigDb.h.

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

SiStripDbParams SiStripConfigDb::dbParams_
private

Instance of struct that holds all DB connection parameters.

Definition at line 400 of file SiStripConfigDb.h.

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

DcuDetIds SiStripConfigDb::dcuDetIds_
private

DcuId-DetId map (map of TkDcuInfo objects).

Definition at line 416 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::dcuDevices_
private

Cache for devices of given type.

Definition at line 428 of file SiStripConfigDb.h.

DeviceDescriptions SiStripConfigDb::devices_
private

Device descriptions (including DCUs).

Definition at line 410 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::dohDevices_
private

Cache for devices of given type.

Definition at line 437 of file SiStripConfigDb.h.

DeviceFactory* SiStripConfigDb::factory_
private
FedIds SiStripConfigDb::fedIds_
private

FED ids.

Definition at line 443 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

FedDescriptions SiStripConfigDb::feds_
private

Fed9U descriptions.

Definition at line 413 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::lldDevices_
private

Cache for devices of given type.

Definition at line 431 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::muxDevices_
private

Cache for devices of given type.

Definition at line 425 of file SiStripConfigDb.h.

bool SiStripConfigDb::openConnection_
private

Definition at line 453 of file SiStripConfigDb.h.

Referenced by closeDbConnection(), and openDbConnection().

DeviceDescriptionsV SiStripConfigDb::pllDevices_
private

Cache for devices of given type.

Definition at line 434 of file SiStripConfigDb.h.

DeviceDescriptionsV SiStripConfigDb::typedDevices_
private

Cache for devices of given type.

Definition at line 440 of file SiStripConfigDb.h.

Referenced by clearLocalCache().

bool SiStripConfigDb::usingStrips_
private

Switch to enable/disable transfer of strip information.

Definition at line 450 of file SiStripConfigDb.h.

Referenced by usingStrips().