ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolTestDataWriter Class Reference

Test Algorithm POOL I/O tests, writes AthenaPoolData objects to the transient store. More...

#include <AthenaPoolTestDataWriter.h>

Inheritance diagram for AthenaPoolTestDataWriter:
Collaboration diagram for AthenaPoolTestDataWriter:

Public Member Functions

 AthenaPoolTestDataWriter (const std::string &name, ISvcLocator *pSvcLocator)
 Algorithm constructor.
 ~AthenaPoolTestDataWriter ()
 Algorithm destructor.
virtual StatusCode execute () override
 Algorithm execute once per event.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< bool > m_partialCreate {this, "PartialCreate", false}
 Create only part of the collections.
Gaudi::Property< bool > m_readOtherHalf {this, "ReadOtherHalf", false}
 For partial create read second half of collections.
Gaudi::Property< bool > m_readFirstHalf {this, "ReadFirstHalf", false}
 For partial create read first half of collections.
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Test Algorithm POOL I/O tests, writes AthenaPoolData objects to the transient store.

Definition at line 32 of file AthenaPoolTestDataWriter.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ AthenaPoolTestDataWriter()

AthenaPoolTestDataWriter::AthenaPoolTestDataWriter ( const std::string & name,
ISvcLocator * pSvcLocator )

Algorithm constructor.

Definition at line 38 of file AthenaPoolTestDataWriter.cxx.

39 :
40 AthAlgorithm(name, pSvcLocator)
41{
42}
AthAlgorithm()
Default constructor:

◆ ~AthenaPoolTestDataWriter()

AthenaPoolTestDataWriter::~AthenaPoolTestDataWriter ( )

Algorithm destructor.

Definition at line 44 of file AthenaPoolTestDataWriter.cxx.

45{}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode AthenaPoolTestDataWriter::execute ( )
overridevirtual

Algorithm execute once per event.

Definition at line 47 of file AthenaPoolTestDataWriter.cxx.

48{
49 ATH_MSG_DEBUG("Executing AthenaPoolTestDataWriter" );
50
51
52 // Tests:
53 //
54
55 // collections 1-3: test of storing abstract base collections
56 // and data objects
57 // collections 4,5: test of transient base class attributes
58 // collection 6: test of storing DataVector<const obj>*
59
63 IAthenaPoolTestCollection* col4 = nullptr;
64 IAthenaPoolTestCollection* col5 = nullptr;
65 if (!m_partialCreate) {
66 col4 = new IAthenaPoolTestCollection();
67 col5 = new IAthenaPoolTestCollection();
68 }
69
70
71 IAthenaPoolTestData* data;
72
73 // Create AthenaPoolTestA's only
74 for (int i = 0; i < 5; ++i) {
75 data = new AthenaPoolTestA(i+1, i+2);
76 col1->push_back(data);
77 }
78
79
80 // Create AthenaPoolTestB's only
81 for (int i = 10; i < 15; ++i) {
82 data = new AthenaPoolTestB(i+1, i+2);
83 col2->push_back(data);
84 }
85
86 // Create AthenaPoolTestA's and B's
87 for (int i = 20; i < 26; ++i) {
88 if (i < 23) {
89 data = new AthenaPoolTestA(i+1, i+2);
90 }
91 else {
92 data = new AthenaPoolTestB(i+1, i+2);
93 }
94 col3->push_back(data);
95 }
96
97 ATH_MSG_DEBUG("Collection of A's" );
98
101 for (; it != last; ++it) {
102 ATH_MSG_DEBUG((*it)->printWhoYouAre() );
103 }
104
105 ATH_MSG_DEBUG("Collection of B's" );
106 it = col2->begin();
107 last = col2->end();
108 for (; it != last; ++it) {
109 ATH_MSG_DEBUG((*it)->printWhoYouAre() );
110 }
111
112 ATH_MSG_DEBUG("Collection of A's and B's" );
113 it = col3->begin();
114 last = col3->end();
115 for (; it != last; ++it) {
116 ATH_MSG_DEBUG((*it)->printWhoYouAre() );
117 }
118
119 if (!m_partialCreate) {
120 // Create AthenaPoolTestC's
121 for (int i = 0; i < 5; ++i) {
122 data = new AthenaPoolTestC(i+1, i+2, i+3, i+4);
123 col4->push_back(data);
124 }
125
126
127 // Create AthenaPoolTestD's only
128 for (int i = 10; i < 15; ++i) {
129 data = new AthenaPoolTestD(i+1, i+2, i+3, i+4, i+5, i+6);
130 col5->push_back(data);
131 }
132
133 ATH_MSG_DEBUG("Collection of C's" );
134 it = col4->begin();
135 last = col4->end();
136 for (; it != last; ++it) {
137 ATH_MSG_DEBUG((*it)->printWhoYouAre() );
138 }
139
140 ATH_MSG_DEBUG("Collection of D's" );
141 it = col5->begin();
142 last = col5->end();
143 for (; it != last; ++it) {
144 ATH_MSG_DEBUG((*it)->printWhoYouAre() );
145 }
146 }
147
148
149
151 const IAthenaPoolTestCollection* col = nullptr;
152 ATH_CHECK( evtStore()->retrieve(col, "AthenaPoolTestCollection_4") );
153
154 ATH_MSG_DEBUG("Collection of C's" );
155 it = col->begin();
156 last = col->end();
157 for (; it != last; ++it) {
158 ATH_MSG_DEBUG((*it)->printWhoYouAre() );
159 }
160
161 ATH_CHECK( evtStore()->retrieve(col, "AthenaPoolTestCollection_5") );
162
163 ATH_MSG_DEBUG("Collection of D's" );
164 it = col->begin();
165 last = col->end();
166 for (; it != last; ++it) {
167 ATH_MSG_DEBUG((*it)->printWhoYouAre() );
168 }
169 }
170
172 // Try to first read the collections that we want to write
173 // again => this should give and error!!
174 const IAthenaPoolTestCollection* col = nullptr;
175 ATH_CHECK( evtStore()->retrieve(col, "AthenaPoolTestCollection_1") );
176 ATH_CHECK( evtStore()->retrieve(col, "AthenaPoolTestCollection_2") );
177 ATH_CHECK( evtStore()->retrieve(col, "AthenaPoolTestCollection_3") );
178 }
179
180
181 // Register collections in the Gaudi Transient Store:
182
183 ATH_CHECK( evtStore()->record(col1, "AthenaPoolTestCollection_1") );
184 ATH_CHECK( evtStore()->record(col2, "AthenaPoolTestCollection_2") );
185 ATH_CHECK( evtStore()->record(col3, "AthenaPoolTestCollection_3") );
186 if (!m_partialCreate) {
187 ATH_CHECK( evtStore()->record(col4, "AthenaPoolTestCollection_4") );
188 ATH_CHECK( evtStore()->record(col5, "AthenaPoolTestCollection_5") );
189 }
190
191
192 // Test for CLHEP matrix
193
194 // Now create a write 10 Hit objects
195 int nd = 0;
196 double k = 7.;
197 for ( int i = 0; i < 3; ++i ) {
198
199 AthenaPoolTestMatrix* matrix = new AthenaPoolTestMatrix;
200 for ( int j = 0; j < 2; ++j ) {
201 CLHEP::HepMatrix* mat = new CLHEP::HepMatrix( 4 + j, 2 + 2*i );
202 CLHEP::HepMatrix& matrx = *mat;
203 for (int i = 0; i < matrx.num_row(); ++i) {
204 for (int j = 0; j < matrx.num_col(); ++j) {
205 matrx[i][j] = k;
206 k *= 5.0;
207 }
208 }
209 matrix->addMatrix( mat );
210 }
211
212 // set transform
213 HepGeom::Transform3D trans1(HepGeom::Point3D<double>( i, 0, 0),
214 HepGeom::Point3D<double>( 0, 1, 0),
215 HepGeom::Point3D<double>( 0, 0, 1),
216 HepGeom::Point3D<double>(-i, 0, 0),
217 HepGeom::Point3D<double>( 0, 1, 0),
218 HepGeom::Point3D<double>( 0, 0, 1));
219 matrix->setTransform(trans1);
220
221 std::stringstream stream;
222 stream << "AthenaPoolTestMatrix_" << i;
223 std::string key(stream.str());
224 ATH_CHECK( evtStore()->record(matrix, key) );
225 ATH_MSG_DEBUG("Registering matrix " << i + 1 << " " << key );
226
227 const HepGeom::Point3D<double>& point = matrix->point();
228 const HepGeom::Point3D<double>& point1 = matrix->point1();
229 ATH_MSG_DEBUG(" Points (by value,by ptr) x,y,z : "
230 << point.x() << " "
231 << point.y() << " "
232 << point.z() << " "
233 << ", x,y,z "
234 << point1.x() << " "
235 << point1.y() << " "
236 << point1.z() << " ");
237 const CLHEP::HepMatrix& smallMatrix = matrix->smallMatrix();
238 ATH_MSG_DEBUG(" Small matrix : ( " << smallMatrix.num_row() << ", " << smallMatrix.num_col() << " ) " );
239
240 stream.clear();
241 for (int i = 0; i < smallMatrix.num_row(); ++i) {
242 for (int j = 0; j < smallMatrix.num_col(); ++ j) {
243 stream << smallMatrix[i][j] << ", ";
244 }
245 }
246 ATH_MSG_VERBOSE(" values: " << stream.str());
247 nd += smallMatrix.num_row()*smallMatrix.num_col();
248
249 const CLHEP::HepMatrix& bigMatrix = matrix->bigMatrix();
250 ATH_MSG_DEBUG(" Big matrix : ( " << bigMatrix.num_row() << ", " << bigMatrix.num_col() << " ) " );
251
252 stream.clear();
253 for (int i = 0; i < bigMatrix.num_row(); ++i) {
254 for (int j = 0; j < bigMatrix.num_col(); ++ j) {
255 stream << bigMatrix[i][j] << ", ";
256 }
257 }
258 ATH_MSG_VERBOSE(" values: " << stream.str());
259 nd += bigMatrix.num_row()*bigMatrix.num_col();
260
261 ATH_MSG_DEBUG(" Other matrices : " );
262 for ( int i = 0; i < matrix->numberOfMatrices(); ++i ) {
263 const CLHEP::HepMatrix& matrx = matrix->matrix( i );
264 ATH_MSG_DEBUG(" ( " << matrx.num_row() << ", " << matrx.num_col() << " ) " );
265 stream.clear();
266 for (int i = 0; i < matrx.num_row(); ++i) {
267 for (int j = 0; j < matrx.num_col(); ++ j) {
268 stream << matrx[i][j] << ", ";
269 }
270 }
271 ATH_MSG_VERBOSE(" values: " << stream.str());
272
273 nd += matrx.num_row()*matrx.num_col();
274
275 }
276
277 nd += 3;
278
279 ATH_MSG_DEBUG(" N doubles : " << nd );
280
281
282 // print out matrix maps
283 AthenaPoolTestMatrix::matrixMaps_t mats = matrix->matrixMaps();
284
285 ATH_MSG_DEBUG(" Matrix maps : " << mats.size() );
286 std::map<unsigned int, CLHEP::HepMatrix>& mp0 = mats[0];
287 std::map<unsigned int, CLHEP::HepMatrix>& mp1 = mats[1];
288 std::map<unsigned int, CLHEP::HepMatrix>::const_iterator itmp = mp0.begin();
289 ATH_MSG_DEBUG(" Key, row, column " << (*itmp).first << " "
290 << (*itmp).second.num_row() << ", " << (*itmp).second.num_col() );
291 ++itmp;
292 ATH_MSG_DEBUG(" Key, row, column " << (*itmp).first << " "
293 << (*itmp).second.num_row() << ", " << (*itmp).second.num_col() );
294 itmp = mp1.begin();
295 ATH_MSG_DEBUG(" Key, row, column " << (*itmp).first << " "
296 << (*itmp).second.num_row() << ", " << (*itmp).second.num_col() );
297 ++itmp;
298 ATH_MSG_DEBUG(" Key, row, column " << (*itmp).first << " "
299 << (*itmp).second.num_row() << ", " << (*itmp).second.num_col() );
300
301 // Print out the transform:
302 ATH_MSG_DEBUG(" Matrix transform: " );
303 const HepGeom::Transform3D& trans = matrix->trans();
304 ATH_MSG_DEBUG(" Matrix transform: " );
305 ATH_MSG_DEBUG(" xx " << trans(0,0) );
306 ATH_MSG_DEBUG(" xy " << trans(0,1) );
307 ATH_MSG_DEBUG(" xz " << trans(0,2) );
308 ATH_MSG_DEBUG(" yx " << trans(1,0) );
309 ATH_MSG_DEBUG(" yy " << trans(1,1) );
310 ATH_MSG_DEBUG(" yz " << trans(1,2) );
311 ATH_MSG_DEBUG(" zx " << trans(2,0) );
312 ATH_MSG_DEBUG(" zy " << trans(2,1) );
313 ATH_MSG_DEBUG(" zz " << trans(2,2) );
314 ATH_MSG_DEBUG(" dx " << trans(3,0) );
315 ATH_MSG_DEBUG(" dy " << trans(3,1) );
316 ATH_MSG_DEBUG(" dz " << trans(3,2) );
317
318 }
319
320 // Fill and write out nested collections
321
322 AthenaPoolTestMap* tmapPtr = new AthenaPoolTestMap();
323 AthenaPoolTestMap& tmap = *tmapPtr;
324
325 typedef AthenaPoolTestMapData::Deposit deposit_t;
326 typedef std::vector<AthenaPoolTestMapData::Deposit> deposit_vec;
327
328 deposit_vec deposits;
329
330 deposit_t deposit;
331
332 for (unsigned int j = 0; j < 10; ++j) {
333 for (unsigned int i = 0; i < 10; ++i) {
334
335 deposit.first = AthenaPoolTestMapDataLink(i, i + 10);
336 deposit.second = i + 20;
337 deposits.push_back(deposit);
338 }
339
340 tmap[j*5] = AthenaPoolTestMapData(deposits, j);
341 deposits.clear();
342 }
343
344 // Printout data
345 AthenaPoolTestMap::const_iterator itm = tmap.begin();
346 AthenaPoolTestMap::const_iterator endm = tmap.end();
347 for (; itm != endm; ++itm) {
348
349 deposits.clear();
350 (*itm).second.deposits(deposits);
351 std::stringstream stream;
352 for (unsigned int i = 0; i < deposits.size(); ++i) {
353 AthenaPoolTestMapDataLink& link = deposits[i].first;
354 stream << link.barcode() << " "
355 << link.eventIndex() << " "
356 << deposits[i].second << " ";
357 }
358 ATH_MSG_DEBUG("AthenaPoolTestMap: key " << (*itm).first
359 << " word " << (*itm).second.word()
360 << " Deposits: (barCode, evtIndx, wgt) " << stream.str());
361 }
362
363 ATH_CHECK( evtStore()->record(tmapPtr, "AthenaPoolMap") );
364
365
366 // Fill and write out dummy classes
367 dummy_A* dummyA = new dummy_A();
368 const std::vector<dummy_B>& b = dummyA->dummy();
369 ATH_MSG_DEBUG("Dummy A: size B " << b.size() );
370 for (unsigned int i = 0; i < b.size(); ++i) {
371 const std::vector<dummy_C>& c = b[i].dummy();
372 ATH_MSG_DEBUG("Dummy B: size C " << c.size() );
373 for (unsigned int j = 0; j < c.size(); ++j) {
374 ATH_MSG_DEBUG("i,c: " << j << " " << c[j].value() );
375 }
376 }
377 ATH_CHECK( evtStore()->record(dummyA, "Dummy_A") );
378
379
380 // Fill and write out dummy E classes
381 dummy_E* dummyE = new dummy_E();
382 dummyE->setData();
383 const std::vector<const dummy_D*>& d = dummyE->dummy();
384 ATH_MSG_DEBUG("Dummy E: size D " << d.size() );
385 for (unsigned int i = 0; i < d.size(); ++i) {
386 ATH_MSG_DEBUG("Dummy D: value " << d[i]->value() );
387 }
388 ATH_CHECK( evtStore()->record(dummyE, "Dummy_E") );
389
390
391 // Write a PileupEventInfo
392
393 // Old-style code munging EventInfo in place --- not thread-safe.
394 const EventInfo * evt = nullptr;
395 ATH_CHECK( evtStore()->retrieve( evt, "McEventInfo" ) );
396 // Add in weight
397 EventType* eventType = const_cast<EventType*>(evt->event_type());
398 eventType->set_mc_event_weight(0.9876, 0, 3);
399 eventType->set_mc_event_weight(1.9876, 1);
400 eventType->set_mc_event_weight(2.9876, 2);
401 ATH_MSG_DEBUG( "Event ID: ["
402 << evt->event_ID()->run_number() << ","
403 << evt->event_ID()->event_number() << ":"
404 << evt->event_ID()->time_stamp() << "] " );
405 ATH_MSG_DEBUG( "Event type: user type "
406 << evt->event_type()->user_type() << " weight 0: "
407 << eventType->mc_event_weight() << " weight 1: "
408 << eventType->mc_event_weight(1) << " weight 2: "
409 << eventType->mc_event_weight(2) );
410 // Set lumi interactions
411 EventInfo * evt1 = const_cast<EventInfo*>(evt);
414 ATH_MSG_DEBUG( "Setting actual interatctions per crossing: "
415 << evt1->actualInteractionsPerCrossing() << " and ave: "
417 // Add in subdet flags
418 unsigned int flags = 0;
419 // We only loop up to Lumi and not nDets since Lumi is set separately
420 for (unsigned int i = 0; i < EventInfo::Lumi; ++i) {
421 flags = 3*i + 0xFFFFFF00;
422 if (!evt1->setEventFlags(EventInfo::EventFlagSubDet(i), flags)) {
423 ATH_MSG_ERROR( "Error setting flag: i, flags " << i << " " << MSG::hex << flags << MSG::dec );
424 }
425 else {
426 ATH_MSG_DEBUG( "Setting flag: i, flags " << i << " " << MSG::hex << flags << " "
427 << " flags " << evt1->eventFlags(EventInfo::EventFlagSubDet(i))
428 << MSG::dec );
429 }
430 if (!evt1->setEventFlagBit(EventInfo::EventFlagSubDet(i), 6)) {
431 ATH_MSG_ERROR( "Error setting bit 6 for subDet " << i );
432 }
433 else {
434 ATH_MSG_DEBUG( "Setting bit 6: i, isSet " << i << " "
435 << evt1->isEventFlagBitSet(EventInfo::EventFlagSubDet(i), 6)
436 << MSG::hex << " flags " << evt1->eventFlags(EventInfo::EventFlagSubDet(i))
437 << MSG::dec );
438 }
439 if (!evt1->setEventFlagBit(EventInfo::EventFlagSubDet(i), 10, false)) {
440 ATH_MSG_ERROR( "Error unsetting bit 10 for subDet " << i );
441 }
442 else {
443 ATH_MSG_DEBUG( "Unsetting bit 10: i, isSet " << i << " "
444 << evt1->isEventFlagBitSet(EventInfo::EventFlagSubDet(i), 10)
445 << MSG::hex << " flags " << evt1->eventFlags(EventInfo::EventFlagSubDet(i))
446 << MSG::dec );
447 }
448 if (evt1->setEventFlagBit(EventInfo::EventFlagSubDet(i), 29)) {
449 ATH_MSG_ERROR( "Error trying to set bit 29 for subDet " << i );
450 }
451 else {
452 ATH_MSG_DEBUG( "Returned false for trying to set bit 29 for subDet " << i << " "
453 );
454 }
455
457 if (i%3 == 1) state = EventInfo::Warning;
458 else if (i%3 == 2) state = EventInfo::Error;
459 if (!evt1->setErrorState(EventInfo::EventFlagSubDet(i), state)) {
460 ATH_MSG_ERROR( "Error setting error state: i, state " << i << " " << state );
461 }
462 else {
463 ATH_MSG_DEBUG( "Setting error state: i, state " << i << " " << state );
464 }
465 EventInfo::EventFlagErrorState error = evt1->errorState(EventInfo::EventFlagSubDet(i));
466 if (error == EventInfo::NotSet)
467 ATH_MSG_DEBUG( "Subdet: " << i << " error state: NotSet " << error );
468 else if (error == EventInfo::Warning)
469 ATH_MSG_DEBUG( "Subdet: " << i << " error state: Warning " << error );
470 else if (error == EventInfo::Error)
471 ATH_MSG_DEBUG( "Subdet: " << i << " error state: Error " << error );
472 }
473
474
475 EventID* pOvrID = new EventID(evt->event_ID()->run_number(),
476 evt->event_ID()->event_number(),
477 12, // time_stamp,
478 13, // time_stamp_ns_offset,
479 14, // lumi_block,
480 15, // bunch_crossing_id,
481 16, // detector_mask0
482 17, // detector_mask1
483 18, // detector_mask2
484 19); // detector_mask3
485 EventType* pOvrEt = new EventType(); //FIXME
486 pOvrEt->set_user_type("Overlaid"); //FIXME
487
488
489 // Add in trigger info to the existing event info
490 std::vector<unsigned int> level1TriggerInfo;
491 level1TriggerInfo.push_back(14);
492 level1TriggerInfo.push_back(15);
493 std::vector<unsigned int> level2TriggerInfo;
494 level2TriggerInfo.push_back(10);
495 level2TriggerInfo.push_back(11);
496 std::vector<unsigned int> eventFilterInfo;
497 eventFilterInfo.push_back(12);
498 eventFilterInfo.push_back(13);
499 std::vector<TriggerInfo::StreamTag> streamTags;
500 streamTags.push_back(TriggerInfo::StreamTag("StreamA", "TypeA", true));
501 streamTags.push_back(TriggerInfo::StreamTag("StreamB", "TypeB", false));
502
503 TriggerInfo* triggerInfo = new TriggerInfo(7, 8, 9,
504 level1TriggerInfo,
505 level2TriggerInfo,
506 eventFilterInfo,
507 streamTags);
508
509 PileUpEventInfo* pOverEvent = new PileUpEventInfo(pOvrID, pOvrEt, triggerInfo);
510 // register as sub event of the overlaid
511 auto newEvt = std::make_unique<EventInfo>(*evt);
512
513 // pOverEvent->addSubEvt(25, PileUpTimeEventIndex::MinimumBias, newEvt, storeGate);
514 pOverEvent->addSubEvt(25, PileUpTimeEventIndex::MinimumBias, std::move(newEvt), nullptr);
515 ATH_CHECK( evtStore()->record(pOverEvent, "OverlayEvent") );
516
517 // Printout
518 PileUpEventInfo* pevt = pOverEvent;
519
520 ATH_MSG_DEBUG("PileUpEventInfo");
521 ATH_MSG_DEBUG("Event ID: ["
522 << pevt->event_ID()->run_number() << ","
523 << pevt->event_ID()->event_number() << ":"
524 << pevt->event_ID()->time_stamp() << "] ");
525 ATH_MSG_DEBUG(*(pevt->event_ID()));
526 ATH_MSG_DEBUG("Event type: user type "
527 << pevt->event_type()->user_type());
528
529 std::stringstream stream;
530 stream << "Trigger info: status " << pevt->trigger_info()->statusElement()
531 << " extLvl1ID " << pevt->trigger_info()->extendedLevel1ID()
532 << " lvl1Type " << pevt->trigger_info()->level1TriggerType()
533 << " lvl1Info ";
534 for (unsigned int i = 0; i < pevt->trigger_info()->level1TriggerInfo().size(); ++i) {
535 stream << pevt->trigger_info()->level1TriggerInfo()[i] << " ";
536 }
537 stream << "lvl2Info ";
538 for (unsigned int i = 0; i < pevt->trigger_info()->level2TriggerInfo().size(); ++i) {
539 stream << pevt->trigger_info()->level2TriggerInfo()[i] << " ";
540 }
541 stream << "EventFilterInfo ";
542 for (unsigned int i = 0; i < pevt->trigger_info()->eventFilterInfo().size(); ++i) {
543 stream << pevt->trigger_info()->eventFilterInfo()[i] << " ";
544 }
545 stream << "EventFilterInfo ";
546 for (unsigned int i = 0; i < pevt->trigger_info()->streamTags().size(); ++i) {
547 stream << " i " << i << " name " << pevt->trigger_info()->streamTags()[i].name()
548 << " type " << pevt->trigger_info()->streamTags()[i].type()
549 << " ObeyLumi " << pevt->trigger_info()->streamTags()[i].obeysLumiblock();
550 }
551 ATH_MSG_DEBUG(stream.str());
552
553 // Get normal event info as a sub-event info
554 ATH_MSG_DEBUG("SubEventInfos");
557 if (it1 == end1) {
558 ATH_MSG_DEBUG("None found" );
559 }
560 for (; it1 != end1; ++it1) {
561 const EventInfo* sevt = (*it1).pSubEvt;
562 ATH_MSG_DEBUG("Time, index "
563 << (*it1).time() << " " << (*it1).index()
564 );
565 if (sevt) {
566 ATH_MSG_DEBUG("Event ID: ["
567 << sevt->event_ID()->run_number() << ","
568 << sevt->event_ID()->event_number() << ":"
569 << sevt->event_ID()->time_stamp() << "] ");
570 ATH_MSG_DEBUG("Event type: user type "
571 << sevt->event_type()->user_type());
572 ATH_MSG_DEBUG("Pileup time, index type "
573 << it1->time() << " " << it1->index());
574 }
575 else {
576 ATH_MSG_DEBUG("Subevent is null ptr ");
577 }
578 }
579 return StatusCode::SUCCESS;
580}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old PileUpEventInfo
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
DataVector< IAthenaPoolTestData > IAthenaPoolTestCollection
Gaudi::Property< bool > m_partialCreate
Create only part of the collections.
Gaudi::Property< bool > m_readOtherHalf
For partial create read second half of collections.
Gaudi::Property< bool > m_readFirstHalf
For partial create read first half of collections.
std::pair< AthenaPoolTestMapDataLink, float > Deposit
std::vector< std::map< unsigned int, CLHEP::HepMatrix > > matrixMaps_t
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
bool setEventFlagBit(EventFlagSubDet subDet, unsigned char bit, bool set=true)
Set a bit for an event flag of a particular sub detector.
float actualInteractionsPerCrossing() const
Access to number of interactions per crossing:
EventID * event_ID()
the unique identification of the event.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
return error state for a particular sub-detector
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
bool isEventFlagBitSet(EventFlagSubDet subDet, unsigned char bit) const
check for a event flag bit for a particular sub-detector
bool setEventFlags(EventFlagSubDet subDet, unsigned int flags)
Set event flag for a particular sub detector - maximun size is 28 bits.
bool setErrorState(EventFlagSubDet subDet, EventFlagErrorState errorState)
Set error state flag for a particular sub detector.
float averageInteractionsPerCrossing() const
average interactions per crossing for all BCIDs - for out-of-time pile-up
void setActualInteractionsPerCrossing(float interactions)
Setting the number of interactions per crossing:
unsigned int eventFlags(EventFlagSubDet subDet) const
event flags for a particular sub-detector
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
void setAverageInteractionsPerCrossing(float interactions)
average interactions per crossing for all BCIDs - for out-of-time pile-up
float mc_event_weight(unsigned int iweight=0) const
Access to MC weight.
void set_mc_event_weight(float weight, unsigned int iweight=0, unsigned int nWeightsMax=0)
Add in MC weight. For more than 1 weight, add with iweight > 0.
void set_user_type(const std::string &user_type)
Add user (string) type.
Definition EventType.cxx:57
std::string user_type(void) const
Access to user type.
Definition EventType.cxx:94
void addSubEvt(time_type t, PileUpTimeEventIndex::PileUpType puType, const EventInfo *pse, StoreGateSvc *psg)
setter for the subEvt collection t=0(ns) for the original event
SubEvent::iterator endSubEvt()
SubEvent::iterator beginSubEvt()
number_type level1TriggerType() const
get level1 trigger type
const std::vector< number_type > & eventFilterInfo() const
get event filter trigger info
number_type extendedLevel1ID() const
get extended level1 ID
number_type statusElement() const
get status element
const std::vector< number_type > & level1TriggerInfo() const
get level1 trigger info
const std::vector< StreamTag > & streamTags() const
get stream tags
const std::vector< number_type > & level2TriggerInfo() const
get level2 trigger info
const std::vector< dummy_B > & dummy() const
Definition dummy_A.h:55
void setData()
Definition dummy_E.h:45
const std::vector< const dummy_D * > & dummy() const
Definition dummy_E.h:47
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
EventInfo_v1 EventInfo
Definition of the latest event info version.
std::list< SubEvent >::const_iterator const_iterator

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_partialCreate

Gaudi::Property<bool> AthenaPoolTestDataWriter::m_partialCreate {this, "PartialCreate", false}
private

Create only part of the collections.

Definition at line 49 of file AthenaPoolTestDataWriter.h.

49{this, "PartialCreate", false};

◆ m_readFirstHalf

Gaudi::Property<bool> AthenaPoolTestDataWriter::m_readFirstHalf {this, "ReadFirstHalf", false}
private

For partial create read first half of collections.

Definition at line 55 of file AthenaPoolTestDataWriter.h.

55{this, "ReadFirstHalf", false};

◆ m_readOtherHalf

Gaudi::Property<bool> AthenaPoolTestDataWriter::m_readOtherHalf {this, "ReadOtherHalf", false}
private

For partial create read second half of collections.

Definition at line 52 of file AthenaPoolTestDataWriter.h.

52{this, "ReadOtherHalf", false};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: