CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CondDBImport.cc
Go to the documentation of this file.
1 //
2 
3 //TO DO: add the comparison between stored object and input object - bool cond::serialization::equal( obj,read_back_copy )
4 #define IMPORT_PAYLOAD_CASE( TYPENAME ) \
5  if( inputTypeName == #TYPENAME ){ \
6  match = true; \
7  const TYPENAME& obj = *static_cast<const TYPENAME*>( inputPtr ); \
8  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() ); \
9  }
10 
12 
15 #include "CondFormats.h"
16 
17 //
18 #include <sstream>
19 
20 namespace cond {
21 
22  namespace persistency {
23 
24  std::pair<std::string,boost::shared_ptr<void> > fetchIfExists( const cond::Hash& payloadId, Session& session, bool& exists ){
25  boost::shared_ptr<void> payloadPtr;
27  cond::Binary streamerInfo;
28  std::string payloadTypeName;
29  exists = session.fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
30  if( exists ) {
31  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr );
32  } else return std::make_pair( std::string(""), boost::shared_ptr<void>() );
33  }
34 
35  cond::Hash import( Session& source, const cond::Hash& sourcePayloadId, const std::string& inputTypeName, const void* inputPtr, Session& destination ){
36  cond::Hash payloadId("");
37  bool newInsert = false;
38  bool match = false;
39  if( inputPtr ){
41  IMPORT_PAYLOAD_CASE( std::vector<unsigned long long> )
230  if( inputTypeName == "L1TriggerKeyList" ){
231  match = true;
232  throwException( "Import of \"L1TriggerKeyList\" type payloads is not supported.","import" );
233  }
234  //IMPORT_PAYLOAD_CASE( L1TriggerKeyList )
249  //IMPORT_PAYLOAD_CASE( PerformancePayload )
307  if( inputTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
308  match = true;
310  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
311  }
312  if( inputTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
313  match = true;
315  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
316  }
317  if( inputTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
318  match = true;
319  const std::vector<unsigned long long>& obj = *static_cast<const std::vector<unsigned long long>*>( inputPtr );
320  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
321  }
322 
323  if( ! match ) throwException( "Payload type \""+inputTypeName+"\" is unknown.","import" );
324  }
325  return payloadId;
326  }
327 
328  }
329 }
330 
Definition: ESGain.h:7
std::pair< std::string, boost::shared_ptr< void > > fetchOne(const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr)
Definition: CondDBFetch.cc:23
Definition: DTT0.h:53
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
#define IMPORT_PAYLOAD_CASE(TYPENAME)
Definition: CondDBImport.cc:4
std::string Hash
Definition: Types.h:45
bool fetchPayloadData(const cond::Hash &payloadHash, std::string &payloadType, cond::Binary &payloadData, cond::Binary &streamerInfoData)
Definition: Session.cc:195
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::pair< std::string, boost::shared_ptr< void > > fetchIfExists(const cond::Hash &payloadId, Session &session, bool &exists)
Definition: CondDBImport.cc:24
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
session
Definition: models.py:201
static std::string const source
Definition: EdmProvDump.cc:43
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14