Skip to content

Commit efeabcb

Browse files
committed
[PWGEM,PWGEM-36] Seperate flow resolution and QA from Pi0FlowEMC task
- Add own `taskFlowReso` for flow resolution and QA of QVectors - Remove corresponding process function from `taskPi0FlowEMC` - Remove calibration process function from `taskPi0FlowEMC` since this also has its own task since some time. - Add `EMBitFlags` for better cut selections
1 parent a6b0b63 commit efeabcb

File tree

9 files changed

+1277
-500
lines changed

9 files changed

+1277
-500
lines changed

PWGEM/PhotonMeson/Core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ o2physics_add_library(PWGEMPhotonMesonCore
1818
EMPhotonEventCut.cxx
1919
CutsLibrary.cxx
2020
HistogramsLibrary.cxx
21+
EMBitFlags.cxx
2122
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::MLCore O2Physics::PWGEMDileptonCore)
2223

2324
o2physics_target_root_dictionary(PWGEMPhotonMesonCore
@@ -29,4 +30,5 @@ o2physics_target_root_dictionary(PWGEMPhotonMesonCore
2930
EMPhotonEventCut.h
3031
CutsLibrary.h
3132
HistogramsLibrary.h
33+
EMBitFlags.h
3234
LINKDEF PWGEMPhotonMesonCoreLinkDef.h)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file EMBitFlags.cxx
13+
/// \brief Source of bit flag class for particle selection.
14+
/// \author M. Hemmer, marvin.hemmer@cern.ch
15+
16+
#include "EMBitFlags.h"
17+
18+
#include <algorithm> // fill
19+
#include <cassert> // assert
20+
#include <cstddef> // size_t
21+
22+
EMBitFlags::EMBitFlags(std::size_t nBits)
23+
: mBits((nBits + 63) / 64, ~0ULL),
24+
mSize(nBits)
25+
{
26+
}
27+
28+
std::size_t EMBitFlags::size() const
29+
{
30+
return mSize;
31+
}
32+
33+
bool EMBitFlags::test(std::size_t i) const
34+
{
35+
assert(i < mSize);
36+
return mBits[word(i)] & mask(i);
37+
}
38+
39+
void EMBitFlags::set(std::size_t i)
40+
{
41+
ensureSize(i + 1);
42+
mBits[word(i)] &= ~mask(i);
43+
}
44+
45+
void EMBitFlags::reset(std::size_t i)
46+
{
47+
assert(i < mSize);
48+
mBits[word(i)] |= mask(i);
49+
}
50+
51+
void EMBitFlags::clear()
52+
{
53+
std::fill(mBits.begin(), mBits.end(), ~0ULL);
54+
}
55+
56+
void EMBitFlags::reserve(std::size_t nBits)
57+
{
58+
mBits.reserve((nBits + 63) / 64);
59+
}
60+
61+
void EMBitFlags::resize(std::size_t nBits)
62+
{
63+
mBits.resize((nBits + 63) / 64, ~0ULL);
64+
mSize = nBits;
65+
}
66+
67+
void EMBitFlags::ensureSize(std::size_t nBits)
68+
{
69+
if (nBits > mSize) {
70+
resize(nBits);
71+
}
72+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file EMBitFlags.h
13+
/// \brief Header of bit flag class for particle selection.
14+
/// \author M. Hemmer, marvin.hemmer@cern.ch
15+
16+
#ifndef PWGEM_PHOTONMESON_CORE_EMBITFLAGS_H_
17+
#define PWGEM_PHOTONMESON_CORE_EMBITFLAGS_H_
18+
19+
#include <cstddef> // size_t
20+
#include <cstdint> // uint64_t
21+
#include <vector> // vector
22+
23+
/// \class EMBitFlags
24+
/// \brief Dynamically-sized bit container with bit-level storage.
25+
///
26+
/// Bits can be set beyond the current size, in which case the container
27+
/// grows automatically. Access via test() and reset() requires the index
28+
/// to be within the current size. Bits are all on by default and will be
29+
/// switched off if particle fails a cut
30+
class EMBitFlags
31+
{
32+
public:
33+
explicit EMBitFlags(std::size_t nBits = 0);
34+
35+
/// \brief get number of stored bits
36+
std::size_t size() const;
37+
38+
/// \brief check bit i
39+
/// \param i index of bit that should be checked
40+
bool test(std::size_t i) const;
41+
42+
/// \brief set bit i
43+
/// \param i index of bit which value should be set
44+
void set(std::size_t i);
45+
46+
/// \brief reset bit i
47+
/// \param i index of bit which value should be reset
48+
void reset(std::size_t i);
49+
50+
/// \brief resetting all flags to false
51+
void clear();
52+
53+
/// \brief reserve space in the underlying storage for nBits bits
54+
/// \param nBits number of bits to reserve capacity for
55+
void reserve(std::size_t nBits);
56+
57+
/// \brief resize the container to hold nBits bits
58+
/// \param nBits new number of bits (new bits are initialized to false)
59+
void resize(std::size_t nBits);
60+
61+
private:
62+
/// \brief ensure that the container can hold at least nBits bits
63+
/// \param nBits required number of bits
64+
void ensureSize(std::size_t nBits);
65+
66+
static constexpr std::size_t word(std::size_t i) { return i >> 6; }
67+
static constexpr std::uint64_t mask(std::size_t i) { return 1ULL << (i & 63); }
68+
69+
std::vector<std::uint64_t> mBits;
70+
std::size_t mSize = 0;
71+
};
72+
73+
#endif // PWGEM_PHOTONMESON_CORE_EMBITFLAGS_H_

0 commit comments

Comments
 (0)