ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleEvent
ParticleEvent
SelectedParticles.h
Go to the documentation of this file.
1
// dear emacs, this is -*- C++ -*-
2
3
/*
4
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#ifndef PARTICLEEVENT_SELECTEDPARTICLES_H
8
#define PARTICLEEVENT_SELECTEDPARTICLES_H 1
9
11
// //
12
// SelectedParticles //
13
// //
14
// Store on/off bits for selected particles
15
// S. Protopopescu 9 Sep. 2008
16
// //
18
20
//
21
// SelectedBranches is a container mirroring a parent branch with particles
22
// there should be only one instance in a branch, one can have multiple branches per parent branch
23
//
24
// For each particle i a bit is stored indicating whether selected or rejected)
25
// User can supply own vector of unsigned integers with bits set (1=selected, 0=rejected)
26
// or create an empty instance with default constructor and set bits with
27
// SetBit(i, true or false)
28
//
29
// If less than 32 particles then it is sufficient to call SetBit(i) for selected particles only
30
//
31
// If more than 32 particles one should either call SetBit(i, true or false) for every particle
32
// or call SetMaxBits(num of particles) and SetBit(i) for selected particles only
33
//
34
// Note that once a bit is set to true there is no mechanism for resetting it to false.
35
//
36
//
38
//
39
// isGood(i) will return true if ith particle was selected
40
//
41
// goodParticles(std::vector<unsigned>& goodparts ) will return list of selected particle numbers
42
//
43
// displayBits() will print out the stored bits
44
// Note that because SelectedParticles stores a vector of unsigned integers it does not know the
45
// number of particles in parent branch
46
// Selected Particles is useless if parent branch is discarded or trimmed
47
//
49
#include <vector>
50
#include<string>
51
#include "
AthenaKernel/CLASS_DEF.h
"
52
#include "
ParticleEvent/ParticleLinks.h
"
53
54
class
SelectedParticles
{
55
56
public
:
57
58
SelectedParticles
():
m_bits
(){;}
59
SelectedParticles
(
const
std::vector<unsigned>& indices);
60
void
Set
(
const
std::vector<unsigned>& onoffBits){
m_bits
=onoffBits;}
61
// supply max number of bits
62
void
SetMaxBits
(
unsigned
maxbits);
63
// set specific bit
64
void
SetBit
(
unsigned
i,
bool
good=
true
);
65
~SelectedParticles
(){;}
66
67
// display the bits
68
std::string
displayBits
()
const
;
69
// find if ith particle was selected
70
bool
isGood
(
unsigned
i)
const
;
71
// how many good particles
72
unsigned
numGood
()
const
;
73
// list of good particles
74
void
goodParticles
(std::vector<unsigned>& goodparts )
const
;
75
// return all bits
76
const
std::vector<unsigned>&
AllBits
()
const
{
return
m_bits
;}
77
private
:
78
std::vector<unsigned>
m_bits
;
79
80
};
81
CLASS_DEF
(
SelectedParticles
, 162859305, 1 )
82
83
84
#endif
// !PARTICLEEVENT_SELECTEDPARTICLES_H
85
CLASS_DEF.h
macros to associate a CLID to a type
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition
Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
ParticleLinks.h
SelectedParticles
Definition
SelectedParticles.h:54
SelectedParticles::SetMaxBits
void SetMaxBits(unsigned maxbits)
Definition
SelectedParticles.cxx:39
SelectedParticles::Set
void Set(const std::vector< unsigned > &onoffBits)
Definition
SelectedParticles.h:60
SelectedParticles::SetBit
void SetBit(unsigned i, bool good=true)
Definition
SelectedParticles.cxx:19
SelectedParticles::AllBits
const std::vector< unsigned > & AllBits() const
Definition
SelectedParticles.h:76
SelectedParticles::~SelectedParticles
~SelectedParticles()
Definition
SelectedParticles.h:65
SelectedParticles::m_bits
std::vector< unsigned > m_bits
Definition
SelectedParticles.h:78
SelectedParticles::displayBits
std::string displayBits() const
Definition
SelectedParticles.cxx:49
SelectedParticles::SelectedParticles
SelectedParticles()
Definition
SelectedParticles.h:58
SelectedParticles::isGood
bool isGood(unsigned i) const
Definition
SelectedParticles.cxx:84
SelectedParticles::goodParticles
void goodParticles(std::vector< unsigned > &goodparts) const
Definition
SelectedParticles.cxx:121
SelectedParticles::numGood
unsigned numGood() const
Definition
SelectedParticles.cxx:112
Generated on
for ATLAS Offline Software by
1.17.0