ATLAS Offline Software
StatusFlagCommentCOOL.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 // **********************************************************************
6 // $Id: StatusFlagCommentCOOL.cxx,v 1.6 2009-02-13 12:32:11 ponyisi Exp $
7 // **********************************************************************
8 
10 
11 //CORAL API include files
12 #include "CoralBase/Attribute.h"
13 
14 //COOL API include files (CoolKernel)
15 #include "CoolKernel/IDatabase.h"
16 #include "CoolKernel/IFolder.h"
17 #include "CoolKernel/IObjectIterator.h"
18 #include "CoolKernel/IObject.h"
19 #include "CoolKernel/Record.h"
20 #include "CoolKernel/Exception.h"
21 #include "CoolKernel/IDatabaseSvc.h"
22 #include "CoolKernel/StorageType.h"
23 
25 
26 namespace dqutils {
28  StatusFlagCommentCOOL(const std::string& dbStr, const std::string& folderStr, int runS, int lumiS, int runU,
29  int lumiU)
30  : StatusFlagCOOLBase(dbStr, folderStr, runS, lumiS, runU, lumiU) {
31  }
32 
34  StatusFlagCommentCOOL(int runS, int lumiS, int runU, int lumiU)
35  : StatusFlagCOOLBase(runS, lumiS, runU, lumiU) {
36  }
37 
40  : StatusFlagCOOLBase() {
41  }
42 
43  cool::RecordSpecification
45  createSpec() {
46  //std::cout << "Preparing RecordSpecification" << std::endl;
47  cool::RecordSpecification spec;
48  spec.extend("Code", cool::StorageType::Int32);
49  spec.extend("deadFrac", cool::StorageType::Float);
50  spec.extend("Thrust", cool::StorageType::Float);
51  spec.extend("Comment", cool::StorageType::String255);
52  if (!(spec == m_coolFolder->payloadSpecification())) {
53  std::cout << "ERROR Source and destination folder specifications differ." << std::endl;
54  }
55  return spec;
56  }
57 
60  createPayload(int colourCode, float dfrac, float thrust, std::string& comment,
61  const cool::RecordSpecification& spec) {
62  coral::AttributeList payload = cool::Record(spec).attributeList();
63  payload["Code"].data<cool::Int32>() = colourCode;
64  payload["deadFrac"].data<cool::Float>() = dfrac;
65  payload["Thrust"].data<cool::Float>() = thrust;
66  payload["Comment"].data<cool::String255>() = comment;
67  return payload;
68  }
69 
70  void
72  insert(cool::ChannelId channelId, int code, float dfrac, float thrust, std::string comment,
73  const std::string& tag_name) {
74  try {
75  cool::RecordSpecification spec = this->createSpec();
77  insert_helper(channelId, payload, tag_name);
78  }
79  catch (cool::Exception& e) {
80  std::cout << "Unknown exception caught!" << e.what() << std::endl;
81  }
82  }
83 
84  void
86  insert(const std::string& channelName, int code, float dfrac, float thrust, const std::string& comment,
87  const std::string& tag_name) {
88  try {
89  this->insert(this->getCoolFolder()->channelId(channelName), code, dfrac, thrust, comment, tag_name);
90  }
91  catch (cool::Exception& e) {
92  std::cout << "Unknown exception caught!" << e.what() << std::endl;
93  }
94  }
95 } //namespace dqutils
dqutils::StatusFlagCOOLBase::m_coolFolder
cool::IFolderPtr m_coolFolder
Definition: StatusFlagCOOLBase.h:59
dqutils::StatusFlagCommentCOOL::createSpec
cool::RecordSpecification createSpec()
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
dqutils::StatusFlagCommentCOOL::StatusFlagCommentCOOL
StatusFlagCommentCOOL()
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
dqutils::StatusFlagCommentCOOL
Definition: StatusFlagCommentCOOL.h:52
dqutils::StatusFlagCOOLBase::getCoolFolder
cool::IFolderPtr getCoolFolder()
FourMomUtils::thrust
CLHEP::Hep3Vector thrust(const I4MomIter_t &iBeg, const I4MomIter_t &iEnd, double &thrust_major, double &thrust_minor, bool useThreeD=false)
Definition: Event/FourMomUtils/src/Thrust.cxx:19
dqutils::StatusFlagCommentCOOL::createPayload
coral::AttributeList createPayload(int colourCode, float dfrac, float thrust, std::string &comment, const cool::RecordSpecification &spec)
dqutils
Definition: CoolMdt.h:76
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
dqutils::StatusFlagCOOLBase::insert_helper
void insert_helper(cool::ChannelId channelId, coral::AttributeList &payload, const std::string &tag_name)
dqutils::StatusFlagCommentCOOL::insert
void insert(cool::ChannelId channelId, int code, float dfrac, float thrust, std::string comment, const std::string &tag_name)
CaloCondBlobAlgs_fillNoiseFromASCII.comment
string comment
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:27
ClassImp
ClassImp(dqutils::StatusFlagCommentCOOL) namespace dqutils
Definition: StatusFlagCommentCOOL.cxx:24
pmontree.code
code
Definition: pmontree.py:443
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
StatusFlagCommentCOOL.h