ATLAS Offline Software
Loading...
Searching...
No Matches
IOVDbTestAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "IOVDbTestAlg.h"
6
7// IOVDbTest includes
12
13// Athena includes
15
16// AttributeList
17#include "CoralBase/Attribute.h"
18#include "CoralBase/Blob.h"
19#include "CoralBase/AttributeListSpecification.h"
22
23// for online testing
24#include <sys/ipc.h>
25#include <sys/msg.h>
26
27
29
30IOVDbTestAlg::IOVDbTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
31 AthReentrantAlgorithm(name, pSvcLocator),
32 m_regSvc("IOVRegistrationSvc", name),
33 m_streamer ("CondStream1")
34{
35}
36
37// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
38
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
44 struct mymsgbuf {
45 long mtype;
46 char mtext[80];
47 };
48
49 key_t key;
50 int msgqueue_id;
51 struct mymsgbuf qbuf;
52
53 /* Create unique key via call to ftok() */
54 key = ftok(".", 'm');
55
56 /* Open the queue */
57 while((msgqueue_id = msgget(key, 0660)) == -1) {
58 printf("waiting for message here.\n");
59 sleep(3);
60 }
61 printf("Recieving a message ...\n");
62
63 qbuf.mtype = 123;
64 msgrcv(msgqueue_id, reinterpret_cast< msgbuf *>(&qbuf), 80, 123, 0);
65
66 printf("Type: %ld Text: %s\n", qbuf.mtype, qbuf.mtext);
67
68 msgctl(msgqueue_id, IPC_RMID, 0); // clearing the message
69
70}
71
72// Not thread-safe due to binding DataHandle.
74 ATH_MSG_DEBUG( "in initialize()" );
75
76 // Get Output Stream tool for writing
77 if (m_writeCondObjs) {
78 m_streamer = "AthenaOutputStreamTool/" + m_streamName;
79 ATH_CHECK( m_streamer.retrieve() );
80 }
81
82 // Get the IOVRegistrationSvc when needed
83 if (m_regIOV) {
84 ATH_CHECK( m_regSvc.retrieve() );
85 ATH_MSG_DEBUG( "Found IOVRegistrationSvc " );
86 ATH_MSG_INFO( "Tag to be used: " << m_tagID.value() );
87 }
88
89 return StatusCode::SUCCESS;
90}
91
92// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
93
94StatusCode IOVDbTestAlg::createCondObjects(const EventContext& ctx) const
95{
96 ATH_MSG_INFO ("in createCondObjects()");
97
98 // Create IOVDbTestMDTEleMap
100 unsigned long long timestamp = ctx.eventID().time_stamp();
101 if (timestamp)
102 elemMap->set(ctx.eventID().time_stamp(),"mdt element map");
103 else
104 elemMap->set(ctx.eventID().run_number(), ctx.eventID().event_number(), "mdt element map");
105
106
107 // Must provide a key which is used as the name to create the folder
108 ATH_CHECK( detStore()->record(elemMap, "/IOVDbTest/IOVDbTestMDTEleMap") );
109
110 // Create IOVDbTestMDTEleMapColl
112
113 // Add in 10 maps, set indices
114 unsigned int offset = 0;
115 if (m_createExtraChans) offset = 100;
116 for (unsigned int i = 0; i < 10; ++i) {
118
119 unsigned long long timestamp = ctx.eventID().time_stamp();
120 if (timestamp)
121 elemMap->set(ctx.eventID().time_stamp() + 10*i, "mdt element map");
122 else
123 elemMap->set(ctx.eventID().run_number() + i, ctx.eventID().event_number(), "mdt element map");
124
125 elemMapColl->push_back(elemMap);
126 elemMapColl->add(2*i+1+i + offset);
127 }
128
129 // Must provide a key which is used as the name to create the folder
130 ATH_CHECK( detStore()->record(elemMapColl, "/IOVDbTest/IOVDbTestMDTEleMapColl") );
131
132 // Create IOVDbTestAmdbCorrection
134 HepGeom::Point3D<double> x(1.0, 2.0, 3.0);
135 HepGeom::Point3D<double> y(4.0, 5.0, 6.0);
136 if (m_writeNewTag) {
137 // writing with new tag, set to different values
138 x = HepGeom::Point3D<double>(11.0, 22.0, 33.0);
139 y = HepGeom::Point3D<double>(44.0, 55.0, 66.0);
140 }
141 amdbCorr->set(x, y, "amdb correction");
142
143 ATH_CHECK( detStore()->record(amdbCorr, "/IOVDbTest/IOVDbTestAMDBCorrection") );
144
145 // Create an attribute list
146
147 // Create spec
148 coral::AttributeListSpecification* attrSpec = new coral::AttributeListSpecification();
149 attrSpec->extend("xPosition", "float");
150 attrSpec->extend("id", "int");
151 attrSpec->extend("name", "string");
152
153 if (!attrSpec->size()) {
154 ATH_MSG_ERROR (" Attribute list specification is empty");
155 return(StatusCode::FAILURE);
156 }
157
158 // FIX this
159 //std::ostringstream attrStr;
160 //attrSpec->print( attrStr );
161 //log << MSG::DEBUG << "Attribute spec " << attrStr.str() << endmsg;
162
163 AthenaAttributeList* attrList = new AthenaAttributeList(*attrSpec);
164 (*attrList)["xPosition"].setValue((float)m_run);
165 (*attrList)["id"].setValue((int)7);
166 (*attrList)["name"].setValue(std::string("TestAttrList"));
167 if (m_writeNewTag) {
168 // writing with new tag, set to different values
169 (*attrList)["xPosition"].setValue((float)125.0);
170 (*attrList)["id"].setValue((int)27);
171 (*attrList)["name"].setValue(std::string("TestAttrListNEWTAG"));
172 }
173 std::ostringstream attrStr1;
174 // FIXME
175 attrList->toOutputStream( attrStr1 );
176 // attrList->print(std::cout);
177 ATH_MSG_DEBUG( "Attribute list " << attrStr1.str() );
178
179 ATH_CHECK( detStore()->record(attrList, "/IOVDbTest/IOVDbTestAttrList") );
180
181 // optionally create a second 'fancy' attributelist testing more datatypes
182 // including bool, CLOB and BLOB types
183 if (m_fancylist) {
184 coral::AttributeListSpecification* fanSpec = new coral::AttributeListSpecification();
185 fanSpec->extend("FanBool","bool");
186 fanSpec->extend("FanInt","int");
187 fanSpec->extend("FanUInt","unsigned int");
188 fanSpec->extend("FanI64","long long");
189 fanSpec->extend("FanU64","unsigned long long");
190 fanSpec->extend("FanFloat","float");
191 fanSpec->extend("FanDouble","double");
192 fanSpec->extend("FanSmallString","string");
193 fanSpec->extend("FanBigString","string");
194 fanSpec->extend("FanBlob","blob");
195 AthenaAttributeList* fanList=new AthenaAttributeList(*fanSpec);
196 // set values, note new style access methods
197 (*fanList)["FanBool"].data<bool>()=true;
198 (*fanList)["FanInt"].data<int>()=-12345;
199 (*fanList)["FanUInt"].data<unsigned int>()=12345;
200 (*fanList)["FanI64"].data<long long>()=-98765432100LL;
201 (*fanList)["FanU64"].data<unsigned long long>()=98765432100LL;
202 (*fanList)["FanFloat"].data<float>()=1.2345;
203 (*fanList)["FanDouble"].data<double>()=1.23456789;
204 (*fanList)["FanSmallString"].data<std::string>()="small string";
205 (*fanList)["FanBigString"].data<std::string>()="potentially long string";
206 // special construction to set blob type
207 coral::Blob& blob=(*fanList)["FanBlob"].data<coral::Blob>();
208 unsigned int blobsize=2000;
209 blob.resize(blobsize);
210 unsigned char* p=static_cast<unsigned char*>(blob.startingAddress());
211 for (unsigned int i=0;i<blobsize;++i,++p) *p=(i % 256);
212 // print out attributelist
213 std::ostringstream fanstr;
214 fanList->toOutputStream(fanstr);
215 ATH_MSG_DEBUG( "Fancy Attribute list " << fanstr.str() );
216 ATH_CHECK( detStore()->record(fanList, "/IOVDbTest/IOVDbTestFancyList") );
217 }
218
219 // Create an attribute list collection
220
221 // Use existing spec
222 CondAttrListCollection* attrListColl = new CondAttrListCollection(true);
223
224 // Add three attr lists
225 coral::AttributeList attrList0(*attrSpec);
226 attrList0["xPosition"].setValue((float)35.0);
227 attrList0["id"].setValue((int)17);
228 attrList0["name"].setValue(std::string("TestAttrList"));
230
231 std::ostringstream attrStr2;
232 attrList0.toOutputStream( attrStr2 );
233 ATH_MSG_DEBUG( "ChanNum " << chanNum << " Attribute list " << attrStr2.str() );
234 attrListColl->add(chanNum, attrList0);
235
236 coral::AttributeList attrList1(*attrSpec);
237 attrList1["xPosition"].setValue((float)45.0);
238 attrList1["id"].setValue((int)27);
239 attrList1["name"].setValue(std::string("TestAttrList"));
240 chanNum = 26;
241
242 std::ostringstream attrStr3;
243 attrList1.toOutputStream( attrStr3 );
244 ATH_MSG_DEBUG( "ChanNum " << chanNum << " Attribute list " << attrStr3.str() );
245 attrListColl->add(chanNum, attrList1);
246
247 coral::AttributeList attrList2(*attrSpec);
248 attrList2["xPosition"].setValue((float)55.0);
249 attrList2["id"].setValue((int)37);
250 attrList2["name"].setValue(std::string("TestAttrList"));
251 chanNum = 36;
252
253 std::ostringstream attrStr4;
254 attrList2.toOutputStream( attrStr4 );
255 ATH_MSG_DEBUG( "ChanNum " << chanNum << " Attribute list " << attrStr4.str() );
256 attrListColl->add(chanNum, attrList2);
257
259 // Two more channels
260 coral::AttributeList attrList3(*attrSpec);
261 attrList3["xPosition"].setValue((float)65.0);
262 attrList3["id"].setValue((int)47);
263 attrList3["name"].setValue(std::string("TestAttrList"));
264 chanNum = 46;
265
266 std::ostringstream attrStr5;
267 attrList3.toOutputStream( attrStr5 );
268 ATH_MSG_DEBUG( "ChanNum " << chanNum << " Attribute list " << attrStr5.str() );
269 attrListColl->add(chanNum, attrList3);
270
271 // Add in new IOV with min run == 4
273 attrListColl->add(chanNum, range);
274 ATH_MSG_DEBUG( "Add min : since " << range.start().run() << " " << range.start().event()
275 << " till " << range.stop().run() << " " << range.stop().event() );
276
277 coral::AttributeList attrList4(*attrSpec);
278 attrList4["xPosition"].setValue((float)75.0);
279 attrList4["id"].setValue((int)57);
280 attrList4["name"].setValue(std::string("TestAttrList"));
281 chanNum = 56;
282
283 std::ostringstream attrStr6;
284 attrList4.toOutputStream( attrStr6 );
285 ATH_MSG_DEBUG( "ChanNum " << chanNum << " Attribute list " << attrStr6.str() );
286 attrListColl->add(chanNum, attrList4);
287
288 // Add in new IOV with min run == 5
290 attrListColl->add(chanNum, range1);
291 ATH_MSG_DEBUG( "Add min : since " << range1.start().run() << " " << range1.start().event() << " till " << range1.stop().run() << " " << range1.stop().event() );
292 }
293 // add names to the channels if needed
294 if (m_nameChans) {
295 ATH_MSG_DEBUG( "Name channels in CondAttrListCollection" );
296 for (CondAttrListCollection::const_iterator citr=attrListColl->begin();
297 citr!=attrListColl->end();++citr) {
298 CondAttrListCollection::ChanNum chan=citr->first;
299 std::ostringstream name;
300 name << "Name_" << chan;
301 attrListColl->add(chan,name.str());
302 }
303 }
304
305 ATH_CHECK( detStore()->record(attrListColl, "/IOVDbTest/IOVDbTestAttrListColl") );
306
307 return StatusCode::SUCCESS;
308}
309// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
310
311
313 ATH_MSG_INFO( "in printCondObjects()" );
314
315 // IOVDbTestMDTEleMap
316 const IOVDbTestMDTEleMap* elemMap = nullptr;
317 ATH_CHECK( detStore()->retrieve(elemMap, "/IOVDbTest/IOVDbTestMDTEleMap") );
318 ATH_MSG_INFO( "Retrieved IOVDbTestMDTEleMap " );
319
320 ATH_MSG_INFO( "Found " << elemMap->name()
321 << " run " << elemMap->runNumber()
322 << " event " << elemMap->eventNumber()
323 << " time " << elemMap->timeStamp() );
324
325
326
327 // IOVDbTestAmdbCorrection
328 const IOVDbTestAmdbCorrection* amdbCorr = nullptr;
329 ATH_CHECK( detStore()->retrieve(amdbCorr, "/IOVDbTest/IOVDbTestAMDBCorrection") );
330 ATH_MSG_INFO ("Retrieved /IOVDbTest/IOVDbTestAMDBCorrection" );
331
332 HepGeom::Point3D<double> trans = amdbCorr->getTranslation();
333 HepGeom::Point3D<double> rot = amdbCorr->getRotation();
334
335 ATH_MSG_INFO( "Found " << amdbCorr->name()
336 << " trans " << trans.x() << " " << trans.y() << " " << trans.z()
337 << " rot " << rot.x() << " " << rot.y() << " " << rot.z() );
338
339
340 if (m_readNewTag) {
341 // IOVDbTestAmdbCorrection
342 const IOVDbTestAmdbCorrection* amdbCorr = nullptr;
343 ATH_CHECK( detStore()->retrieve(amdbCorr, "/IOVDbTest/IOVDbTestAMDBCorrection-NEWTAG") );
344 ATH_MSG_INFO( "Retrieved /IOVDbTest/IOVDbTestAMDBCorrection-NEWTAG" );
345
346 HepGeom::Point3D<double> trans = amdbCorr->getTranslation();
347 HepGeom::Point3D<double> rot = amdbCorr->getRotation();
348
349 ATH_MSG_INFO( "Found " << amdbCorr->name()
350 << " trans " << trans.x() << " " << trans.y() << " " << trans.z()
351 << " rot " << rot.x() << " " << rot.y() << " " << rot.z() );
352 }
353
354
355 const AthenaAttributeList* attrList = nullptr;
356 const CondAttrListCollection* attrListColl = nullptr;
357
359 // AttrList
360 ATH_CHECK( detStore()->retrieve(attrList, "/IOVDbTest/IOVDbTestAttrList") );
361 ATH_MSG_DEBUG( "Retrieved IOVDbTestAttrList" );
362
363 std::ostringstream attrStr1;
364 attrList->print( attrStr1 );
365 ATH_MSG_DEBUG( "Attribute list " << attrStr1.str() );
366
367 if (m_readNewTag) {
368 // AttrList
369 ATH_CHECK( detStore()->retrieve(attrList, "/IOVDbTest/IOVDbTestAttrList-NEWTAG") );
370 ATH_MSG_DEBUG( "Retrieved IOVDbTestAttrList-NEWTAG" );
371
372 std::ostringstream attrStr1;
373 attrList->print( attrStr1 );
374 ATH_MSG_DEBUG( "Attribute list NEWTAG: " << attrStr1.str() );
375 }
376
377 // fancy attributelist
378 if (m_fancylist) {
379 ATH_MSG_DEBUG( detStore()->retrieve(attrList, "/IOVDbTest/IOVDbTestFancyList") );
380 ATH_MSG_DEBUG( "Retrieved IOVDbTestFancyList" );
381 std::ostringstream fanstr;
382 attrList->print( fanstr );
383 ATH_MSG_DEBUG( "Fancy Attribute list " << fanstr.str() );
384 // for the blob type, check the actual data is correct
385 const coral::Blob& blob=(*attrList)["FanBlob"].data<coral::Blob>();
386 const unsigned char* p=static_cast<const unsigned char*>
387 (blob.startingAddress());
388 int nerr=0;
389 for (int i=0;i<blob.size();++i,++p) if (*p!=(i % 256)) ++nerr;
390 if (nerr>0) ATH_MSG_ERROR( "Blob has " << nerr <<
391 " data mismatches!" );
392 }
393
394 // AttrListColl
395 ATH_CHECK( detStore()->retrieve(attrListColl, "/IOVDbTest/IOVDbTestAttrListColl") );
396 ATH_MSG_DEBUG( "Retrieved IOVDbTestAttrListColl" );
397
398
399 std::ostringstream attrStr2;
400
401 // Loop over collection
402 CondAttrListCollection::const_iterator first = attrListColl->begin();
403 CondAttrListCollection::const_iterator last = attrListColl->end();
404 for (; first != last; ++first) {
405
406 if (msgLvl (MSG::DEBUG)) {
407 std::ostringstream attrStr1;
408 (*first).second.toOutputStream( attrStr1 );
409 msg() << MSG::DEBUG << "ChanNum " << (*first).first;
410 // print out the name if present
411 if (attrListColl->name_size()>0) {
413 nitr=attrListColl->chanNamePair((*first).first);
414 if (nitr!=attrListColl->name_end())
415 msg() << MSG::DEBUG << " name " << nitr->second;
416 }
417 msg() << MSG::DEBUG <<
418 " Attribute list " << attrStr1.str() << endmsg;
419 }
420
421 // Print out range if it exits
422 CondAttrListCollection::ChanNum chanNum = (*first).first;
423 CondAttrListCollection::iov_const_iterator iovIt = attrListColl->chanIOVPair(chanNum);
424 if (iovIt != attrListColl->iov_end()) {
425 const IOVRange& range = (*iovIt).second;
426 if(range.start().isTimestamp()) {
427 ATH_MSG_DEBUG( "Range timestamp : since " << range.start().timestamp()
428 << " till " << range.stop().timestamp() );
429 }
430 else {
431 ATH_MSG_DEBUG( "Range R/E : since " << range.start().run() << " "
432 << range.start().event()
433 << " till " << range.stop().run() << " "
434 << range.stop().event() );
435 }
436 }
437 else {
438 ATH_MSG_DEBUG( "No range found " );
439 }
440 }
441
442 // Simulation and digitization parameters:
443
444 if ( detStore()->retrieve(attrList, "/Simulation/Parameters").isFailure() ) {
445 // May not have been added - just a warning
446 ATH_MSG_WARNING( "Could not retrieve Simulation parameters" );
447 }
448 else {
449 ATH_MSG_DEBUG( "Retrieved Simulation parameters" );
450 std::ostringstream attrStr;
451 attrList->print( attrStr );
452 ATH_MSG_DEBUG( "Attribute list " << attrStr.str() );
453 }
454
455 if (detStore()->retrieve(attrList, "/Digitization/Parameters").isFailure()) {
456 // May not have been added - just a warning
457 ATH_MSG_WARNING( "Could not retrieve Digitization parameters" );
458 }
459 else {
460 ATH_MSG_DEBUG( "Retrieved Digitization parameters" );
461 std::ostringstream attrStr;
462 attrList->print( attrStr );
463 ATH_MSG_DEBUG( "Attribute list " << attrStr.str() );
464 }
465 }
466
467
468 // IOVDbTestMDTEleMapColl
469
470// if (m_readWriteCool) {
471
472 const IOVDbTestMDTEleMapColl* elemMapColl = nullptr;
473 ATH_CHECK( detStore()->retrieve(elemMapColl, "/IOVDbTest/IOVDbTestMDTEleMapColl") );
474 ATH_MSG_INFO( "Retrieved IOVDbTestMDTEleMapColl " );
475
476 // Make sure the channel vector is filled
477 if (elemMapColl->size() != elemMapColl->chan_size()) {
478 ATH_MSG_ERROR( "Must fill in channel numbers! Number of objects: " << elemMapColl->size()
479 << " Number of channels: " << elemMapColl->chan_size() );
480 return(StatusCode::FAILURE);
481 }
482 // Print out IOVs if they are there
483 bool hasIOVs = (elemMapColl->iov_size() == elemMapColl->size());
486 for (unsigned int i = 0; i < elemMapColl->size(); ++i, ++itChan) {
487 const IOVDbTestMDTEleMap* elemMap = (*elemMapColl)[i];
488 msg() << MSG::INFO << "Found " << elemMap->name()
489 << " run " << elemMap->runNumber()
490 << " event " << elemMap->eventNumber()
491 << " time " << elemMap->timeStamp()
492 << " channel " << (*itChan);
493 if(hasIOVs) {
494 msg() << MSG::INFO << " iov " << (*itIOV);
495 ++itIOV;
496 }
497 msg() << MSG::INFO << endmsg;
498 }
499// }
500 return StatusCode::SUCCESS;
501}
502
503// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
504
505StatusCode IOVDbTestAlg::execute (const EventContext& ctx) const {
506
507 // There are different scenario for conditions data:
508 //
509 // A) Calculating and writing conditions
510 //
511 // 1) Loop over events and accumulate "averages"
512 //
513 // 2) At the desired moment, e.g. after N events or at the end
514 // of the job, calculate the conditions data to be written
515 // out by creating the corresponding objects and store in the
516 // DetectorStore
517 //
518 // 3) Write out objects with the IAthenaOutputStreamTool - done
519 // in finalize.
520 //
521 // 4) Finally, one must "register" the objects written out in
522 // the IOV DB. This writes and IOV and a ref to each object,
523 // and is done in the finalize method.
524 //
525 // B) Reading back in conditions data to analyse it
526 //
527 // 1) Aside from specifying the correct jobOptions, this is
528 // simply done by doing a standard StoreGate retrieve from
529 // the DetectorStore.
530
531 if (msgLvl (MSG::DEBUG)) {
532 msg() << MSG::DEBUG << "Event (run,ev,lb:time): [" << ctx.eventID().run_number() << "," << ctx.eventID().event_number();
533 if (m_printLB) msg() << "," << ctx.eventID().lumi_block();
534 msg() << ":" << ctx.eventID().time_stamp() << "]" << endmsg;
535 }
536
538
539 // We create the conditions objects only at run == 2, event == 5
540 if (2 != ctx.eventID().run_number() || 5 != ctx.eventID().event_number()) {
541 ATH_MSG_DEBUG( "Event NOT selected for creating conditions objects " );
542 return StatusCode::SUCCESS;
543 }
544
545 ATH_MSG_DEBUG( "Creating condtions objects " );
547
548 // Read objects from DetectorStore
549 if(!m_noStream){
551 }
552 }
553 else {
554
555 ATH_MSG_DEBUG( "Calling printCondObjects" <<m_online<< "\t"<<ctx.eventID().run_number()<<"\t"<<ctx.eventID().event_number() );
556
557 // Read objects from DetectorStore
558 if (m_online && 2 == ctx.eventID().run_number() && 9 == ctx.eventID().event_number())
561 }
562
563 return StatusCode::SUCCESS;
564}
565
566// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
567
569 ATH_MSG_INFO( "in finalize()" );
570
571 if (m_writeCondObjs) {
572 // Stream out and register objects here
573 ATH_MSG_DEBUG( "Stream out objects directly " );
575 ATH_MSG_DEBUG( "Streamed out OK " );
576 }
577 if(m_regIOV) {
579 ATH_MSG_DEBUG( "Register OK " );
580 }
581
582 return StatusCode::SUCCESS;
583}
584
585
586
587// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
588
589StatusCode
591 ATH_MSG_DEBUG( "entering streamOutCondObjects " );
592 ATH_CHECK( m_streamer->connectOutput() );
593
595 if (!m_writeOnlyCool) {
596 typeKeys.emplace_back("IOVDbTestMDTEleMap", "");
597 typeKeys.emplace_back("IOVDbTestAmdbCorrection", "");
598 typeKeys.emplace_back("IOVDbTestMDTEleMapColl", "");
599 }
600 typeKeys.resize(3);
601
602 ATH_MSG_DEBUG( "Stream out for pairs:" );
603 for (unsigned int i = 0; i < typeKeys.size(); ++i) {
604 ATH_MSG_DEBUG( typeKeys[i].first << " " << typeKeys[i].second << " " );
605 }
606
607 ATH_CHECK( m_streamer->streamObjects(typeKeys) );
608 ATH_CHECK( m_streamer->commitOutput() );
609
610 return StatusCode::SUCCESS;
611}
612
613
614// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
615
616StatusCode
618 ATH_MSG_DEBUG( "entering registerCondObject " );
619
620 // Register the IOV DB with the conditions data written out
621 std::string tag = "no tag";
622 if (m_tagID!="") {
623 tag = "tag MDTEleMap_" + m_tagID;
624 ATH_CHECK( m_regSvc->registerIOV("IOVDbTestMDTEleMap", "MDTEleMap_"+m_tagID,m_run,IOVTime::MAXRUN,IOVTime::MINEVENT,IOVTime::MAXEVENT) );
625 } else {
626 ATH_CHECK( m_regSvc->registerIOV("IOVDbTestMDTEleMap", "") );
627 }
628 ATH_MSG_DEBUG( "registered IOVDbTestMDTEleMap with " << tag );
629
630 // For IOVDbTestAmdbCorrection use time (in sec)
631 uint64_t start=static_cast<long long>(m_regTime)*1000000000LL;
632 uint64_t stop = IOVTime::MAXTIMESTAMP;
633 tag = "no tag";
634 if (m_tagID!="") {
635 tag = "tag AmdbCorrection_" + m_tagID;
636 ATH_CHECK( m_regSvc->registerIOV("IOVDbTestAmdbCorrection", "AmdbCorrection_"+m_tagID, start, stop) );
637 } else {
638 ATH_CHECK( m_regSvc->registerIOV("IOVDbTestAmdbCorrection", "", start, stop) );
639 }
640 ATH_MSG_DEBUG( "registered IOVDbTestAmdbCorrection with " << tag );
641 if (m_readWriteCool) {
642
643 // Can only write out AttrList's if this is NOT write and reg in two steps
644 if (!m_twoStepWriteReg) {
645
646 // Using COOL, write out attrlist and collection of attrlists
647 tag = "no tag";
648 if (m_tagID!="") {
649 tag = "tag AttrList_" + m_tagID;
650 ATH_CHECK( m_regSvc->registerIOV("AthenaAttributeList","/IOVDbTest/IOVDbTestAttrList","AttrList_"+m_tagID,m_run,IOVTime::MAXRUN,IOVTime::MINEVENT,IOVTime::MAXEVENT) );
651 } else {
652 ATH_CHECK( m_regSvc->registerIOV("AthenaAttributeList","/IOVDbTest/IOVDbTestAttrList","") );
653 }
654 ATH_MSG_DEBUG( "registered AthenaAttributeList with " << tag );
655 if (m_fancylist) {
656 // register Fancy AttributeList
657 tag = "no tag";
658 if (m_tagID!="") {
659 tag = "tag FancyList_" + m_tagID;
660 ATH_CHECK( m_regSvc->registerIOV("AthenaAttributeList","/IOVDbTest/IOVDbTestFancyList","FancyList_"+m_tagID,m_run,IOVTime::MAXRUN,IOVTime::MINEVENT,IOVTime::MAXEVENT) );
661 } else {
662 ATH_CHECK( m_regSvc->registerIOV("AthenaAttributeList", "/IOVDbTest/IOVDbTestFancyList","") );
663 }
664 ATH_MSG_DEBUG ( "registered Fancy AthenaAttributeList with " << tag );
665 }
666 // attrlist collection
667 tag = "no tag";
668 if (m_tagID!="") {
669 tag = "tag AttrListColl_" + m_tagID;
670 ATH_CHECK( m_regSvc->registerIOV("CondAttrListCollection","AttrListColl_"+m_tagID,m_run,IOVTime::MAXRUN,IOVTime::MINEVENT,IOVTime::MAXEVENT) );
671 } else {
672 ATH_CHECK( m_regSvc->registerIOV("CondAttrListCollection", "") );
673 }
674 ATH_MSG_DEBUG( "registered CondAttrListCollection with " << tag );
675 }
676
677 // mdtMapColl
678 tag = "no tag";
679 if (m_tagID!="") {
680 tag = "tag MDTEleMapColl_" + m_tagID;
681 ATH_CHECK( m_regSvc->registerIOV("IOVDbTestMDTEleMapColl","MDTEleMapColl_"+m_tagID,m_run,IOVTime::MAXRUN,IOVTime::MINEVENT,IOVTime::MAXEVENT) );
682 } else {
683 ATH_CHECK( m_regSvc->registerIOV("IOVDbTestMDTEleMapColl","") );
684 }
685 ATH_MSG_DEBUG( "registered IOVDbTestMDTEleMapColl with " << tag );
686 }
687
688 return StatusCode::SUCCESS;
689
690}
691
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
Interface to an output stream tool.
This is an interface to a tool used to register conditions objects in the Interval of Validity (IOV) ...
CondMultChanCollection< IOVDbTestMDTEleMap > IOVDbTestMDTEleMapColl
This typedef represents a collection of IOVDbTestMDTEleMap objects.
#define y
#define x
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
An algorithm that can be simultaneously executed in multiple threads.
An AttributeList represents a logical row of attributes in a metadata table.
void print(std::ostream &os) const
print to simulate function provided by old POOL AttributeList
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
name_size_type name_size() const
number of Chan/Name pairs
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
iov_const_iterator iov_end() const
name_const_iterator name_end() const
name_const_iterator chanNamePair(ChanNum chanNum) const
Access to Chan/Name pairs via channel number: returns map iterator.
iov_const_iterator chanIOVPair(ChanNum chanNum) const
Access to Chan/IOV pairs via channel number: returns map iterator.
ChanAttrListMap::const_iterator const_iterator
ChanNameMap::const_iterator name_const_iterator
ChanIOVMap::const_iterator iov_const_iterator
chan_size_type chan_size() const
number of channels
iov_size_type iov_size() const
number of IOVs
void add(ChanNum chanNum)
Adding in channel numbers.
chan_const_iterator chan_begin() const
Access to Channel numbers via iterators.
iov_const_iterator iov_begin() const
Access to IOVs via iterators.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
std::vector< TypeKeyPair > TypeKeyPairs
BooleanProperty m_writeNewTag
BooleanProperty m_regIOV
virtual StatusCode finalize() override
StatusCode streamOutCondObjects()
IntegerProperty m_run
void waitForSecond() const
BooleanProperty m_twoStepWriteReg
StringProperty m_tagID
virtual StatusCode initialize() override
BooleanProperty m_online
BooleanProperty m_fancylist
BooleanProperty m_noStream
BooleanProperty m_createExtraChans
BooleanProperty m_writeCondObjs
virtual StatusCode execute(const EventContext &ctx) const override
BooleanProperty m_readWriteCool
IOVDbTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual ~IOVDbTestAlg()
BooleanProperty m_printLB
ToolHandle< IAthenaOutputStreamTool > m_streamer
IntegerProperty m_regTime
BooleanProperty m_readNewTag
ServiceHandle< IIOVRegistrationSvc > m_regSvc
StatusCode registerCondObjects()
BooleanProperty m_nameChans
StatusCode printCondObjects() const
StringProperty m_streamName
BooleanProperty m_writeOnlyCool
StatusCode createCondObjects(const EventContext &ctx) const
HepGeom::Point3D< double > getTranslation() const
void set(const HepGeom::Point3D< double > &trans, const HepGeom::Point3D< double > &rot, const std::string &name)
HepGeom::Point3D< double > getRotation() const
const std::string & name() const
void set(int runNumber, int eventNumber, const std::string &name)
const std::string & name() const
Validity Range object.
Definition IOVRange.h:30
const IOVTime & stop() const
Definition IOVRange.h:39
const IOVTime & start() const
Definition IOVRange.h:38
Basic time unit for IOVSvc.
Definition IOVTime.h:33
static constexpr uint64_t MAXTIMESTAMP
Definition IOVTime.h:58
static constexpr uint32_t MAXRUN
Definition IOVTime.h:48
uint32_t event() const noexcept
Definition IOVTime.h:106
static constexpr uint32_t MINEVENT
Definition IOVTime.h:50
uint32_t run() const noexcept
Definition IOVTime.h:105
static constexpr uint32_t MAXEVENT
Definition IOVTime.h:51