ATLAS Offline Software
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 
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>
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++)){
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 
SelectedParticles::SetBit
void SetBit(unsigned i, bool good=true)
Definition: SelectedParticles.cxx:19
SelectedParticlesUtil
Definition: SelectedParticlesUtil.h:21
SelectedParticles::SetMaxBits
void SetMaxBits(unsigned maxbits)
Definition: SelectedParticles.cxx:39
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
SelectedParticles.h
SelectedParticles::isGood
bool isGood(unsigned i) const
Definition: SelectedParticles.cxx:84
Container
storage of the time histories of all the cells
DMTest::links
links
Definition: CLinks_v1.cxx:22
sel
sel
Definition: SUSYToolsTester.cxx:92
checkFileSG.objs
list objs
Definition: checkFileSG.py:93
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
SelectedParticlesUtil::getParticleLinks
void getParticleLinks(const SelectedParticles *selparts, const Container *particles, ParticleLinks< Container > &links)
Definition: SelectedParticlesUtil.h:51
SelectedParticlesUtil::getContainerInfo
void getContainerInfo(const SelectedParticles *sel, const Container *coll, std::vector< const Contained * > &objs, std::vector< int > &indices)
SelectedParticles
Definition: SelectedParticles.h:54
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
SelectedParticles::numGood
unsigned numGood() const
Definition: SelectedParticles.cxx:112
SelectedParticlesUtil::getSelectedParticles
void getSelectedParticles(const ParticleLinks< Container > *links, SelectedParticles &selparts)
Definition: SelectedParticlesUtil.h:66