ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
EventBookkeeperMetaData
src
EventBookkeeperCollection.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// Implementation file for class EventBookkeeperCollection
7
// Author: David Cote, September 2008. <david.cote@cern.ch>
9
#include "
EventBookkeeperMetaData/EventBookkeeperCollection.h
"
10
14
15
EventBookkeeperCollection::EventBookkeeperCollection
():
DataVector
<
EventBookkeeper
> (
SG
::OWN_ELEMENTS) {}
16
17
EventBookkeeperCollection::EventBookkeeperCollection
(
const
EventBookkeeperCollection
& rhs ) :
18
DataVector
<
EventBookkeeper
> (rhs) {}
19
20
EventBookkeeperCollection
&
EventBookkeeperCollection::operator=
(
const
EventBookkeeperCollection
& rhs )
21
{
22
if
(
this
!= &rhs ) {
23
DataVector<EventBookkeeper>::operator=
(rhs);
24
}
25
return
*
this
;
26
}
27
28
EventBookkeeperCollection::EventBookkeeperCollection
(
const
SG::OwnershipPolicy
own ) :
29
DataVector
<
EventBookkeeper
>(own)
30
{}
31
32
EventBookkeeper
*
EventBookkeeperCollection::GetElement
(
const
EventBookkeeper
* book ){
33
for
(
unsigned
int
i=0; i<this->
size
(); i++){
34
if
( this->
at
(i)->isEqualTo( book ) ){
return
this->
at
(i); }
35
}
36
//if book not found, return null pointer (0x0)
37
EventBookkeeper
* nullElement=0;
38
return
nullElement;
39
}
40
41
void
EventBookkeeperCollection::UpdateFromColl
(
const
EventBookkeeperCollection
* coll ){
42
//Loop through coll, if element already in self update event count, otherwise create new element
43
for
(
unsigned
int
i=0; i<coll->
size
(); i++){
44
const
EventBookkeeper
* book_i=coll->
at
(i);
45
EventBookkeeper
* tmpBook = this->
GetElement
( book_i );
46
if
( tmpBook ){
47
tmpBook->
updateAcceptedEventsIncludingFamily
(book_i);
48
}
49
else
{
50
EventBookkeeper
* newBook =
new
EventBookkeeper
( *book_i );
51
this->
push_back
( newBook );
52
}
53
}
54
return
;
55
}
56
57
EventBookkeeperCollection
*
EventBookkeeperCollection::GetCopyWithFlatStructure
(){
58
//Just a simple vector of pointers, nothing new is constructed, but now with a flat structure
59
EventBookkeeperCollection
PtrFLAT (
SG::VIEW_ELEMENTS
);
60
for
(
EventBookkeeper
* bk : *
this
) {
61
PtrFLAT.
push_back
(bk);
62
bk->
fillWithWholeFamily
( &PtrFLAT );
//family does not include topParent
63
}
64
65
//Now a make a flat-structure collection with new objects
66
auto
CopyFLAT = std::make_unique<EventBookkeeperCollection>();
67
for
(
EventBookkeeper
* bk : PtrFLAT) {
68
EventBookkeeper
* tmp = bk->
DeepCopyForFlatStructure
( &PtrFLAT );
69
CopyFLAT->push_back( tmp );
70
}
71
72
//Set parentIndex of the CopyFLAT elements
73
for
(
unsigned
int
i=0; i<CopyFLAT->size(); i++){
74
if
(CopyFLAT->at(i)->m_childrenIndices->size()>0){
75
//parentIndex=i for children of element i
76
std::vector<unsigned int>* childrenIndices=CopyFLAT->at(i)->m_childrenIndices;
77
for
(
unsigned
int
j=0; j<childrenIndices->size(); j++){
78
CopyFLAT->at(childrenIndices->at(j))->m_parentIndex=i;
79
}
80
}
81
}
82
//The caller now owns CopyFLAT and its content
83
return
CopyFLAT.release();
84
}
85
EventBookkeeperCollection.h
DataVector< EventBookkeeper >::at
const EventBookkeeper * at(size_type n) const
DataVector< EventBookkeeper >::push_back
value_type push_back(value_type pElem)
DataVector< EventBookkeeper >::DataVector
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
DataVector::operator=
DataVector & operator=(DataVector &&rhs)
Assignment operator.
DataVector< EventBookkeeper >::size
size_type size() const noexcept
EventBookkeeperCollection::UpdateFromColl
void UpdateFromColl(const EventBookkeeperCollection *coll)
Definition
EventBookkeeperCollection.cxx:41
EventBookkeeperCollection::GetElement
EventBookkeeper * GetElement(const EventBookkeeper *book)
Definition
EventBookkeeperCollection.cxx:32
EventBookkeeperCollection::operator=
EventBookkeeperCollection & operator=(const EventBookkeeperCollection &rhs)
Definition
EventBookkeeperCollection.cxx:20
EventBookkeeperCollection::EventBookkeeperCollection
EventBookkeeperCollection()
Constructors.
Definition
EventBookkeeperCollection.cxx:15
EventBookkeeperCollection::GetCopyWithFlatStructure
EventBookkeeperCollection * GetCopyWithFlatStructure()
Definition
EventBookkeeperCollection.cxx:57
EventBookkeeper
Definition
EventBookkeeper.h:24
EventBookkeeper::fillWithWholeFamily
void fillWithWholeFamily(EventBookkeeperCollection *family)
Definition
EventBookkeeper.cxx:317
EventBookkeeper::DeepCopyForFlatStructure
EventBookkeeper * DeepCopyForFlatStructure(EventBookkeeperCollection *collFLAT)
Definition
EventBookkeeper.cxx:115
EventBookkeeper::updateAcceptedEventsIncludingFamily
void updateAcceptedEventsIncludingFamily(const EventBookkeeper *eb)
Definition
EventBookkeeper.cxx:223
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
SG::OwnershipPolicy
OwnershipPolicy
Definition
OwnershipPolicy.h:16
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
Generated on
for ATLAS Offline Software by
1.17.0