12 #include "CoralBase/Attribute.h"
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 #include "CoolKernel/ConstRecordAdapter.h"
35 cool::IDatabaseSvc&
dbSvc = this->databaseService();
37 return dbSvc.openDatabase(dbStr.c_str(), readOnly);
39 catch (cool::DatabaseDoesNotExist&) {
40 std::cerr <<
"Error! Database does not exist!" << std::endl;
53 catch (cool::FolderNotFound&) {
54 std::cerr <<
"Error! Folder '" << folderStr <<
"' does not exist!" << std::endl;
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) {
117 cool::RecordSpecification
121 cool::RecordSpecification
spec;
122 spec.extend(
"Chamber_Name", cool::StorageType::String255);
123 spec.extend(
"Dead_multilayer", cool::StorageType::String255);
124 spec.extend(
"Dead_layer", cool::StorageType::String255);
125 spec.extend(
"Dead_mezz", cool::StorageType::String255);
126 spec.extend(
"Dead_asd", cool::StorageType::String255);
127 spec.extend(
"Dead_tube", cool::StorageType::String4k);
136 std::cerr <<
"ERROR Source and destination folder specifications differ." << std::endl;
145 const std::string& DeadMultilayer,
146 const std::string& DeadLayer,
147 const std::string& DeadMezz,
148 const std::string& DeadAsd,
149 const std::string& DeadTube,
150 const cool::RecordSpecification&
spec) {
155 payload[
"Chamber_Name"].data<cool::String255>() = ChamberName;
156 payload[
"Dead_multilayer"].data<cool::String255>() = DeadMultilayer;
157 payload[
"Dead_layer"].data<cool::String255>() = DeadLayer;
158 payload[
"Dead_mezz"].data<cool::String255>() = DeadMezz;
159 payload[
"Dead_asd"].data<cool::String255>() = DeadAsd;
160 payload[
"Dead_tube"].data<cool::String4k>() = DeadTube;
167 cool::RecordSpecification
171 cool::RecordSpecification
spec;
172 spec.extend(
"Chamber_Name", cool::StorageType::String255);
173 spec.extend(
"Noisy_multilayer", cool::StorageType::String255);
174 spec.extend(
"Noisy_layer", cool::StorageType::String255);
175 spec.extend(
"Noisy_mezz", cool::StorageType::String255);
176 spec.extend(
"Noisy_asd", cool::StorageType::String255);
177 spec.extend(
"Noisy_tube", cool::StorageType::String4k);
186 std::cerr <<
"ERROR Source and destination folder specifications differ." << std::endl;
195 const std::string& NoisyMultilayer,
196 const std::string& NoisyLayer,
197 const std::string& NoisyMezz,
198 const std::string& NoisyAsd,
199 const std::string& NoisyTube,
200 const cool::RecordSpecification&
spec) {
205 payload[
"Chamber_Name"].data<cool::String255>() = ChamberName;
206 payload[
"Noisy_multilayer"].data<cool::String255>() = NoisyMultilayer;
207 payload[
"Noisy_layer"].data<cool::String255>() = NoisyLayer;
208 payload[
"Noisy_mezz"].data<cool::String255>() = NoisyMezz;
209 payload[
"Noisy_asd"].data<cool::String255>() = NoisyAsd;
210 payload[
"Noisy_tube"].data<cool::String4k>() = NoisyTube;
224 const cool::IObject& element =
objects->currentRef();
225 std::cout << element << std::endl;
228 catch (cool::Exception&
e) {
229 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
230 std::cout <<
" dentro create payload" << std::endl;
242 const cool::IObject& element =
objects->currentRef();
246 catch (cool::Exception&
e) {
247 std::cout <<
"Unknown exception caught!" <<
e.what() << std::endl;
254 dumpCode(
const std::string& channelName) {
269 const std::string& ChamberName,
270 const std::string& DeadMultilayer,
271 const std::string& DeadLayer,
272 const std::string& DeadMezz,
273 const std::string& DeadAsd,
274 const std::string& DeadTube,
279 DeadAsd, DeadTube,
spec);
280 cool::ValidityKey since_u = (
run << 32);
281 cool::ValidityKey until_u = (
run + 1) << 32;
282 m_coolFolder->storeObject(since_u, until_u, cool::Record(
286 catch (cool::Exception&
e) {
287 std::cerr <<
" dentro create insert" << std::endl;
288 std::cerr <<
"Unknown exception caught!" <<
e.what() << std::endl;
296 const std::string& ChamberName,
297 const std::string& DeadMultilayer,
298 const std::string& DeadLayer,
299 const std::string& DeadMezz,
300 const std::string& DeadAsd,
301 const std::string& DeadTube) {
302 std::cout <<
"Trying to store payload [channel " << std::endl;
306 DeadAsd, DeadTube,
spec);
307 cool::ValidityKey since_u = (
run << 32);
308 cool::ValidityKey until_u = (
run + 1) << 32;
313 catch (cool::Exception&
e) {
314 std::cerr <<
" dentro create insert" << std::endl;
315 std::cerr <<
"Unknown exception caught!" <<
e.what() << std::endl;
327 const std::string& ChamberName,
328 const std::string& NoisyMultilayer,
329 const std::string& NoisyLayer,
330 const std::string& NoisyMezz,
331 const std::string& NoisyAsd,
332 const std::string& NoisyTube,
337 NoisyAsd, NoisyTube,
spec);
338 cool::ValidityKey since_u = (
run << 32);
339 cool::ValidityKey until_u = (
run + 1) << 32;
340 m_coolFolder->storeObject(since_u, until_u, cool::Record(
344 catch (cool::Exception&
e) {
345 std::cerr <<
" dentro create insert" << std::endl;
346 std::cerr <<
"Unknown exception caught!" <<
e.what() << std::endl;
354 const std::string& ChamberName,
355 const std::string& NoisyMultilayer,
356 const std::string& NoisyLayer,
357 const std::string& NoisyMezz,
358 const std::string& NoisyAsd,
359 const std::string& NoisyTube) {
360 std::cout <<
"Trying to store payload [channel " << std::endl;
364 NoisyAsd, NoisyTube,
spec);
365 cool::ValidityKey since_u = (
run << 32);
366 cool::ValidityKey until_u = (
run + 1) << 32;
371 catch (cool::Exception&
e) {
372 std::cerr <<
" dentro create insert" << std::endl;
373 std::cerr <<
"Unknown exception caught!" <<
e.what() << std::endl;