forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutilsRedDataFormat.h
More file actions
86 lines (75 loc) · 3.38 KB
/
utilsRedDataFormat.h
File metadata and controls
86 lines (75 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file utilsRedDataFormat.h
/// \brief Utilities for reduced data format analyses
/// \author Luca Aglietta <luca.aglietta@cern.ch>, UniTO Turin
#ifndef PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_
#define PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_
#include <cmath>
#include <Rtypes.h>
#include "CCDB/BasicCCDBManager.h"
#include "Framework/AnalysisHelpers.h"
#include "Framework/HistogramRegistry.h"
#include "PWGHF/Core/CentralityEstimation.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
namespace o2::hf_evsel
{
/// Helper function to count collisions at different event selection stages
/// \tparam useEvSel use information from the EvSel table
/// \tparam centEstimator centrality estimator
/// \param collision collision to test against the selection criteria
template <bool useEvSel, o2::hf_centrality::CentralityEstimator centEstimator, typename BCs, typename Coll>
void checkEvSel(Coll const& collision, o2::hf_evsel::HfEventSelection& hfEvSel, int& zvtxColl, int& sel8Coll, int& zvtxAndSel8Coll, int& zvtxAndSel8CollAndSoftTrig, int& allSelColl, o2::framework::Service<o2::ccdb::BasicCCDBManager> const& ccdb, o2::framework::HistogramRegistry& registry)
{
float centrality{-1.f};
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<useEvSel, o2::hf_centrality::CentralityEstimator::None, BCs>(collision, centrality, ccdb, registry);
if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) {
sel8Coll++;
}
if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::PositionZ)) {
zvtxColl++;
}
if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::PositionZ) && !TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) {
zvtxAndSel8Coll++;
}
if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::PositionZ) && !TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger) && !TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::SoftwareTrigger)) {
zvtxAndSel8CollAndSoftTrig++;
}
if (rejectionMask == 0) {
allSelColl++;
}
}
} // namespace o2::hf_evsel
namespace o2::pid_tpc_tof_utils
{
/// Helper function to retrive PID information of bachelor pion from b-hadron decay
/// \param prong1 pion track from reduced data format, soa::Join<HfRedTracks, HfRedTracksPid>
template <typename T1>
float getTpcTofNSigmaPi1(const T1& prong1)
{
float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h
bool hasTpc = prong1.hasTPC();
bool hasTof = prong1.hasTOF();
if (hasTpc && hasTof) {
float tpcNSigma = prong1.tpcNSigmaPi();
float tofNSigma = prong1.tofNSigmaPi();
return std::sqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma);
}
if (hasTpc) {
return std::abs(prong1.tpcNSigmaPi());
}
if (hasTof) {
return std::abs(prong1.tofNSigmaPi());
}
return defaultNSigma;
}
} // namespace o2::pid_tpc_tof_utils
#endif // PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_