35 cool::IDatabaseSvc& dbSvc = this->databaseService();
37 return dbSvc.openDatabase(dbStr.c_str(), readOnly);
39 catch (cool::DatabaseDoesNotExist&) {
40 std::cout <<
"Error! Database does not exist!" << std::endl;
49 cool::IFolderPtr folder =
m_coolDb->getFolder(folderStr.c_str());
53 catch (cool::FolderNotFound&) {
54 std::cout <<
"Error! Folder '" << folderStr <<
"' does not exist!" << std::endl;
73 setUntil(cool::Int64 iovmax, cool::Int64 lumi) {
74 m_until = ((iovmax << 32) + lumi);
79 setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU) {
96 cool::Int64 runS =
m_since >> 32;
97 cool::Int64 lumiS =
m_since - (runS << 32);
98 cool::Int64 runU =
m_until >> 32;
99 cool::Int64 lumiU =
m_until - (runU << 32);
100 std::cout <<
"Using IOVrange [(" << runS <<
"," << lumiS <<
"),(" << runU <<
"," << lumiU <<
")] " <<
"[" <<
106 CoolOpen(
const std::string& dbStr) {
113 std::cout <<
"Cleared!" << std::endl;
116 cool::RecordSpecification
120 cool::RecordSpecification spec;
121 spec.extend(
"recEta", cool::StorageType::String4k);
122 spec.extend(
"detEta", cool::StorageType::String4k);
123 spec.extend(
"recPhi1", cool::StorageType::String4k);
124 spec.extend(
"recPhi2", cool::StorageType::String4k);
125 spec.extend(
"detPhi1", cool::StorageType::String4k);
126 spec.extend(
"detPhi2", cool::StorageType::String4k);
129 std::cout <<
"ERROR Source and destination folder specifications differ." << std::endl;
135 cool::RecordSpecification
139 cool::RecordSpecification spec;
140 spec.extend(
"PanelRes", cool::StorageType::String255);
141 spec.extend(
"StripStatus", cool::StorageType::String4k);
144 std::cout <<
"ERROR Source and destination folder specifications differ." << std::endl;
153 const std::string& detEta,
154 const std::string& recPhi1,
155 const std::string& recPhi2,
156 const std::string& detPhi1,
157 const std::string& detPhi2,
158 const cool::RecordSpecification& spec) {
161 coral::AttributeList payload = cool::Record(spec).attributeList();
163 payload[
"recEta"].data<cool::String4k>() = recEta;
164 payload[
"detEta"].data<cool::String4k>() = detEta;
165 payload[
"recPhi1"].data<cool::String4k>() = recPhi1;
167 payload[
"recPhi2"].data<cool::String4k>() = recPhi2;
168 payload[
"detPhi1"].data<cool::String4k>() = detPhi1;
169 payload[
"detPhi2"].data<cool::String4k>() = detPhi2;
180 const cool::RecordSpecification& spec) {
183 coral::AttributeList payload = cool::Record(spec).attributeList();
185 payload[
"PanelRes"].data<cool::String255>() = PanelRes;
186 payload[
"StripStatus"].data<cool::String4k>() = StripStatus;
196 while (objects->goToNext()) {
197 const cool::IObject& element = objects->currentRef();
198 std::cout << element << std::endl;
201 catch (cool::Exception& e) {
202 std::cout <<
"Unknown exception caught!" << e.what() << std::endl;
203 std::cout <<
" Inside create payload" << std::endl;
209 dumpField(cool::ChannelId channelId,
const std::string & field) {
210 std::string result =
"";
212 cool::ChannelSelection
selection = cool::ChannelSelection(channelId);
214 while (objects->goToNext()) {
215 const cool::IObject& element = objects->currentRef();
216 result = element.payloadValue(field);
219 catch (cool::Exception& e) {
220 std::cout <<
"Unknown exception caught!" << e.what() << std::endl;
227 dumpCode(
const std::string& channelName) {
229 return atoi(result.c_str());
235 this->
dump(cool::ChannelSelection::all());
243 cool::ChannelId channelId,
244 const std::string& recEta,
245 const std::string& detEta,
246 const std::string& recPhi1,
247 const std::string& recPhi2,
248 const std::string& detPhi1,
249 const std::string& detPhi2,
250 const std::string& cool_tag) {
254 coral::AttributeList payload = this->
createPayloadData(recEta, detEta, recPhi1, recPhi2, detPhi1, detPhi2, spec);
255 cool::ValidityKey since_u = (
run << 32);
256 cool::ValidityKey until_u = (
run + 1) << 32;
257 m_coolFolder->storeObject(since_u, until_u, cool::Record(
258 m_coolFolder->payloadSpecification(), payload), channelId, cool_tag);
261 catch (cool::Exception& e) {
262 std::cout <<
" Inside create insert" << std::endl;
263 std::cout <<
"Unknown exception caught!" << e.what() << std::endl;
270 cool::ChannelId channelId,
271 const std::string& PanelRes,
272 const std::string& StripStatus,
273 const std::string& cool_tag) {
278 cool::ValidityKey since_u = (
run << 32) * 0;
279 cool::ValidityKey until_u = (
run + 1) << 32;
280 m_coolFolder->storeObject(since_u, until_u, cool::Record(
281 m_coolFolder->payloadSpecification(), payload), channelId, cool_tag);
284 catch (cool::Exception& e) {
285 std::cout <<
" Inside create insert" << std::endl;
286 std::cout <<
"Unknown exception caught!" << e.what() << std::endl;
293 cool::ChannelId channelId,
294 const std::string& recEta,
295 const std::string& detEta,
296 const std::string& recPhi1,
297 const std::string& recPhi2,
298 const std::string& detPhi1,
299 const std::string& detPhi2) {
300 std::cout <<
"Trying to store payload [channel " << std::endl;
303 coral::AttributeList payload = this->
createPayloadData(recEta, detEta, recPhi1, recPhi2, detPhi1, detPhi2, spec);
304 cool::ValidityKey since_u = (
run << 32);
305 cool::ValidityKey until_u = (
run + 1) << 32;
308 std::cout <<
"stored! without Tag" << std::endl;
310 catch (cool::Exception& e) {
311 std::cout <<
" Inside create insert" << std::endl;
312 std::cout <<
"Unknown exception caught!" << e.what() << std::endl;