CMS 3D CMS Logo

CondDBFetch.cc
Go to the documentation of this file.
1 //
2 
3 #define FETCH_PAYLOAD_CASE( TYPENAME ) \
4  if( payloadTypeName == #TYPENAME ){ \
5  auto payload = deserialize<TYPENAME>( payloadTypeName, data, streamerInfo ); \
6  payloadPtr = payload; \
7  match = true; \
8  }
9 
11 
14 #include "CondFormats.h"
15 
16 //
17 #include <memory>
18 #include <sstream>
19 
20 namespace cond {
21 
22  namespace persistency {
23 
24  std::pair<std::string, std::shared_ptr<void> > fetchOne( const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, std::shared_ptr<void> payloadPtr ){
25 
26  bool match = false;
28  FETCH_PAYLOAD_CASE( std::vector<unsigned long long> )
244  //FETCH_PAYLOAD_CASE( PerformancePayload )
305 
306  //
307  if( payloadTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
308  auto payload = deserialize<PhysicsTools::Calibration::Histogram3D<double,double,double,double> >(payloadTypeName, data, streamerInfo );
309  payloadPtr = payload;
310  match = true;
311  }
312  if( payloadTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
313  auto payload = deserialize<PhysicsTools::Calibration::Histogram2D<double,double,double> >(payloadTypeName, data, streamerInfo );
314  payloadPtr = payload;
315  match = true;
316  }
317  if( payloadTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
318  auto payload = deserialize<std::vector<unsigned long long> >( payloadTypeName, data, streamerInfo );
319  payloadPtr = payload;
320  match = true;
321  }
322 
323  if( ! match ) throwException( "Payload type \""+payloadTypeName+"\" is unknown.","fetch" );
324  return std::make_pair( payloadTypeName, payloadPtr );
325  }
326 
327  std::pair<std::string,std::shared_ptr<void> > fetch( const cond::Hash& payloadId, Session& session ){
328  std::shared_ptr<void> payloadPtr;
330  cond::Binary streamerInfo;
331  std::string payloadTypeName;
332  bool found = session.fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
333  if( !found ) throwException( "Payload with id "+boost::lexical_cast<std::string>(payloadId)+" has not been found in the database.","fetch" );
334  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr );
335  }
336 
337  }
338 }
339 
std::pair< std::string, std::shared_ptr< void > > fetchOne(const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, std::shared_ptr< void > payloadPtr)
Definition: CondDBFetch.cc:24
Definition: ESGain.h:7
#define FETCH_PAYLOAD_CASE(TYPENAME)
Definition: CondDBFetch.cc:3
Definition: DTT0.h:53
payload
payload postfix for testing
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
Channel-mask mapping.
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:202
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
Definition: plugin.cc:24
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
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
std::pair< std::string, std::shared_ptr< void > > fetch(const cond::Hash &payloadId, Session &session)
Definition: CondDBFetch.cc:327
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
The mapping between FramePosition and ROCInfo.