ATLAS Offline Software
Loading...
Searching...
No Matches
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/*************************************************************************
11SelectedParticlesUtil.h: template functions for conversions SelectedParticles<->ParticleLinks
12
13 S. Protopopescu 15-Dec-2008
14
15***********************************************************************/
16
19
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,
30
31 template<class Container>
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>
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>
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
storage of the time histories of all the cells
void SetMaxBits(unsigned maxbits)
void SetBit(unsigned i, bool good=true)
bool isGood(unsigned i) const
unsigned numGood() const
void getParticleLinks(const SelectedParticles *selparts, const Container *particles, ParticleLinks< Container > &links)
void getSelectedParticles(const ParticleLinks< Container > *links, SelectedParticles &selparts)
void getContainerInfo(const SelectedParticles *sel, const Container *coll, std::vector< const Contained * > &objs, std::vector< int > &indices)