CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, isOra ); \
6  payloadPtr = payload; \
7  match = true; \
8  }
9 
11 
14 #include "CondFormats.h"
15 
16 //
17 #include <sstream>
18 
19 namespace cond {
20 
21  namespace persistency {
22 
23  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, bool isOra ){
24 
25  bool match = false;
27  FETCH_PAYLOAD_CASE( std::vector<unsigned long long> )
215  //FETCH_PAYLOAD_CASE( PerformancePayload )
271 
272  //
273  if( payloadTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
274  auto payload = deserialize<PhysicsTools::Calibration::Histogram3D<double,double,double,double> >(payloadTypeName, data, streamerInfo, isOra );
275  payloadPtr = payload;
276  match = true;
277  }
278  if( payloadTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
279  auto payload = deserialize<PhysicsTools::Calibration::Histogram2D<double,double,double> >(payloadTypeName, data, streamerInfo, isOra );
280  payloadPtr = payload;
281  match = true;
282  }
283  if( payloadTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
284  auto payload = deserialize<std::vector<unsigned long long> >( payloadTypeName, data, streamerInfo, isOra );
285  payloadPtr = payload;
286  match = true;
287  }
288 
289  if( ! match ) throwException( "Payload type \""+payloadTypeName+"\" is unknown.","fetch" );
290  return std::make_pair( payloadTypeName, payloadPtr );
291  }
292 
293  std::pair<std::string,boost::shared_ptr<void> > fetch( const cond::Hash& payloadId, Session& session ){
294  boost::shared_ptr<void> payloadPtr;
296  cond::Binary streamerInfo;
297  std::string payloadTypeName;
298  bool found = session.fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
299  if( !found ) throwException( "Payload with id "+boost::lexical_cast<std::string>(payloadId)+" has not been found in the database.","fetchAndCompare" );
300  //std::cout <<"--> payload type "<<payloadTypeName<<" has blob size "<<data.size()<<std::endl;
301  bool isOra = session.isOraSession();
302  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr, isOra);
303  }
304 
305  }
306 }
307 
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, bool is Ora)
#define FETCH_PAYLOAD_CASE(TYPENAME)
Definition: CondDBFetch.cc:3
Definition: DTT0.h:53
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
std::string Hash
Definition: Types.h:43
bool fetchPayloadData(const cond::Hash &payloadHash, std::string &payloadType, cond::Binary &payloadData, cond::Binary &streamerInfoData)
Definition: Session.cc:186
std::pair< std::string, boost::shared_ptr< void > > fetch(const cond::Hash &payloadId, Session &session)
Definition: CondDBFetch.cc:293
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
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11