ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleEvent
ParticleEvent
SelectedParticlesUtil.h
Go to the documentation of this file.
1
// dear emacs, this is -*- C++ -*-
2
3
/*
4
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#ifndef PARTICLEEVENT_SELECTEDPARTICLESUTIL_H
8
#define PARTICLEEVENT_SELECTEDPARTICLESUTIL_H 1
9
10
/*************************************************************************
11
SelectedParticlesUtil.h: template functions for conversions SelectedParticles<->ParticleLinks
12
13
S. Protopopescu 15-Dec-2008
14
15
***********************************************************************/
16
17
#include "
ParticleEvent/SelectedParticles.h
"
18
#include "
ParticleEvent/ParticleLinks.h
"
19
20
namespace
SelectedParticlesUtil
21
{
22
23
template
<
class
Container,
class
Contained>
24
void
getContainerInfo
(
const
SelectedParticles
*
sel
,
const
Container
* coll, std::vector<const Contained*>& objs,
25
std::vector<int>& indices);
26
27
template
<
class
Container>
28
void
getParticleLinks
(
const
SelectedParticles
* selparts,
const
Container
* particles,
29
ParticleLinks<Container>
& links);
30
31
template
<
class
Container>
32
void
getSelectedParticles
(
const
ParticleLinks<Container>
* links,
SelectedParticles
& selparts);
33
}
34
35
template
<
class
Container,
class
Contained>
36
void
SelectedParticlesUtil::getContainerInfo
(
const
SelectedParticles
* selparts,
const
Container
* particles,
37
std::vector<const Contained*>& objs, std::vector<unsigned>& indices){
38
typename
Container::const_iterator ipItr = particles->begin();
39
typename
Container::const_iterator ipEnd = particles->end();
40
unsigned
ipart=0;
41
for
(; ipItr != ipEnd; ++ipItr) {
42
if
(selparts->
isGood
(ipart)){
43
objs.push_back(*ipItr);
44
indices.push_back(ipart);
45
}
46
ipart++;
47
}
48
}
49
50
template
<
class
Container>
51
void
SelectedParticlesUtil::getParticleLinks
(
const
SelectedParticles
* selparts,
const
Container
* particles,
52
ParticleLinks<Container>
& links){
53
typename
Container::const_iterator ipItr = particles->begin();
54
typename
Container::const_iterator ipEnd = particles->end();
55
links.reserve(selparts->
numGood
());
56
unsigned
ipart=0;
57
for
(; ipItr != ipEnd; ++ipItr) {
58
if
(selparts->
isGood
(ipart++)){
59
ElementLink<Container>
el(*particles,ipart);
60
links.push_back(el);
61
}
62
}
63
}
64
65
template
<
class
Container>
66
void
SelectedParticlesUtil::getSelectedParticles
(
const
ParticleLinks<Container>
* links,
SelectedParticles
& selparts){
67
typedef
ParticleLinks<Container>
Links;
68
selparts.
SetMaxBits
(links->size());
69
typename
Links::const_iterator ilItr = links->begin();
70
typename
Links::const_iterator ilEnd = links->end();
71
for
(; ilItr != ilEnd; ++ilItr) {
72
selparts.
SetBit
((*ilItr).index());
73
}
74
75
}
76
77
#endif
// !PARTICLEEVENT_SELECTEDPARTICLESUTIL_H
78
ParticleLinks.h
sel
sel
Definition
SUSYToolsTester.cxx:92
SelectedParticles.h
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
Container
storage of the time histories of all the cells
ParticleLinks
Definition
ParticleLinks.h:43
SelectedParticles
Definition
SelectedParticles.h:54
SelectedParticles::SetMaxBits
void SetMaxBits(unsigned maxbits)
Definition
SelectedParticles.cxx:39
SelectedParticles::SetBit
void SetBit(unsigned i, bool good=true)
Definition
SelectedParticles.cxx:19
SelectedParticles::isGood
bool isGood(unsigned i) const
Definition
SelectedParticles.cxx:84
SelectedParticles::numGood
unsigned numGood() const
Definition
SelectedParticles.cxx:112
SelectedParticlesUtil
Definition
SelectedParticlesUtil.h:21
SelectedParticlesUtil::getParticleLinks
void getParticleLinks(const SelectedParticles *selparts, const Container *particles, ParticleLinks< Container > &links)
Definition
SelectedParticlesUtil.h:51
SelectedParticlesUtil::getSelectedParticles
void getSelectedParticles(const ParticleLinks< Container > *links, SelectedParticles &selparts)
Definition
SelectedParticlesUtil.h:66
SelectedParticlesUtil::getContainerInfo
void getContainerInfo(const SelectedParticles *sel, const Container *coll, std::vector< const Contained * > &objs, std::vector< int > &indices)
Generated on
for ATLAS Offline Software by
1.17.0