Skip to content

Commit 3256259

Browse files
authored
Some reworks (#968)
* Some reworks * clang-format
1 parent 47202f2 commit 3256259

8 files changed

Lines changed: 156 additions & 106 deletions

File tree

EventFiltering/PWGUD/DGHelpers.h

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,30 @@ struct DGSelector {
103103

104104
// no global tracks which are not vtx tracks
105105
// no vtx tracks which are not global tracks
106+
auto rgtrwTOF = 0.;
106107
for (auto& track : tracks) {
107108
if (track.isGlobalTrack() && !track.isPVContributor()) {
108109
return 3;
109110
}
110111
if (diffCuts.globalTracksOnly() && !track.isGlobalTrack() && track.isPVContributor()) {
111112
return 4;
112113
}
114+
115+
// update fraction of PV tracks with TOF hit
116+
if (track.isPVContributor() && track.hasTOF()) {
117+
rgtrwTOF += 1.;
118+
}
119+
}
120+
if (collision.numContrib() > 0) {
121+
rgtrwTOF /= collision.numContrib();
122+
}
123+
if (rgtrwTOF < diffCuts.minRgtrwTOF()) {
124+
return 5;
113125
}
114126

115127
// number of vertex tracks
116128
if (collision.numContrib() < diffCuts.minNTracks() || collision.numContrib() > diffCuts.maxNTracks()) {
117-
return 5;
129+
return 6;
118130
}
119131

120132
// PID, pt, and eta of tracks, invariant mass, and net charge
@@ -135,18 +147,18 @@ struct DGSelector {
135147

136148
// PID
137149
if (!hasGoodPID(diffCuts, track)) {
138-
return 6;
150+
return 7;
139151
}
140152

141153
// pt
142154
lvtmp.SetXYZM(track.px(), track.py(), track.pz(), mass2Use);
143155
if (lvtmp.Perp() < diffCuts.minPt() || lvtmp.Perp() > diffCuts.maxPt()) {
144-
return 7;
156+
return 8;
145157
}
146158

147159
// eta
148160
if (lvtmp.Eta() < diffCuts.minEta() || lvtmp.Eta() > diffCuts.maxEta()) {
149-
return 8;
161+
return 9;
150162
}
151163
netCharge += track.sign();
152164
ivm += lvtmp;
@@ -155,11 +167,11 @@ struct DGSelector {
155167

156168
// net charge
157169
if (netCharge < diffCuts.minNetCharge() || netCharge > diffCuts.maxNetCharge()) {
158-
return 9;
170+
return 10;
159171
}
160172
// invariant mass
161173
if (ivm.M() < diffCuts.minIVM() || ivm.M() > diffCuts.maxIVM()) {
162-
return 10;
174+
return 11;
163175
}
164176

165177
// if we arrive here then the event is good!

EventFiltering/PWGUD/diffractionFilter.cxx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,21 @@ struct DGFilterRun3 {
8484
// 4: number of FwdTracks > 0
8585
// 5: not all global tracks are vtx tracks
8686
// 6: not all vtx tracks are global tracks
87-
// 7: number of vtx tracks out of range
88-
// 8: has not good PID information
89-
// 9: track pt out of range
90-
// 10: track eta out of range
91-
// 11: net charge out of range
92-
// 12: IVM out of range
87+
// 7: fraction of tracks with TOF hit too low
88+
// 8: number of vtx tracks out of range
89+
// 9: has not good PID information
90+
// 10: track pt out of range
91+
// 11: track eta out of range
92+
// 12: net charge out of range
93+
// 13: IVM out of range
9394
static constexpr std::string_view histNames[4] = {"aftercut2pi", "aftercut4pi", "aftercut2K", "aftercut4K"};
9495
HistogramRegistry registry{
9596
"registry",
9697
{
97-
{histNames[0].data(), "#aftercut2pi", {HistType::kTH1F, {{12, -0.5, 11.5}}}},
98-
{histNames[1].data(), "#aftercut4pi", {HistType::kTH1F, {{12, -0.5, 11.5}}}},
99-
{histNames[2].data(), "#aftercut2K", {HistType::kTH1F, {{12, -0.5, 11.5}}}},
100-
{histNames[3].data(), "#aftercut4K", {HistType::kTH1F, {{12, -0.5, 11.5}}}},
98+
{histNames[0].data(), "#aftercut2pi", {HistType::kTH1F, {{13, -0.5, 12.5}}}},
99+
{histNames[1].data(), "#aftercut4pi", {HistType::kTH1F, {{13, -0.5, 12.5}}}},
100+
{histNames[2].data(), "#aftercut2K", {HistType::kTH1F, {{13, -0.5, 12.5}}}},
101+
{histNames[3].data(), "#aftercut4K", {HistType::kTH1F, {{13, -0.5, 12.5}}}},
101102
}};
102103

103104
void init(InitContext&)

PWGUD/Core/UDHelperFunctions.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
/// \brief
13+
/// \author Paul Buehler, paul.buehler@oeaw.ac.at
14+
/// \since 01.10.2021
15+
16+
#ifndef O2_ANALYSISUDHEPLER_H_
17+
#define O2_ANALYSISUDHEPLER_H_
18+
19+
#include "Framework/Logger.h"
20+
#include "CommonConstants/LHCConstants.h"
21+
#include "Common/DataModel/EventSelection.h"
22+
23+
using namespace o2;
24+
using namespace o2::framework;
25+
26+
// .............................................................................
27+
// return net charge of PV tracks
28+
template <typename TCs>
29+
int8_t netCharge(TCs tracks)
30+
{
31+
int8_t nch = 0;
32+
for (auto track : tracks) {
33+
if (track.isPVContributor()) {
34+
nch += track.sign();
35+
}
36+
}
37+
return nch;
38+
}
39+
40+
// .............................................................................
41+
// return fraction of PV tracks with a TOF hit
42+
template <typename TCs>
43+
float rPVtrwTOF(TCs tracks, int nPVTracks)
44+
{
45+
float rpvrwTOF = 0.;
46+
for (auto& track : tracks) {
47+
if (track.isPVContributor() && track.hasTOF()) {
48+
rpvrwTOF += 1.;
49+
}
50+
}
51+
if (nPVTracks > 0) {
52+
rpvrwTOF /= nPVTracks;
53+
}
54+
return rpvrwTOF;
55+
}
56+
57+
// -----------------------------------------------------------------------------
58+
#endif // O2_ANALYSISUDHEPLER_H_

PWGUD/DataModel/DGCandidates.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ namespace o2::aod
2323
namespace dgcand
2424
{
2525
DECLARE_SOA_COLUMN(NetCharge, netCharge, int8_t); //! Sum of track signs
26+
DECLARE_SOA_COLUMN(RgtrwTOF, rgtrwTOF, float); //! Fraction of global tracks with TOF hit
27+
2628
} // namespace dgcand
2729
DECLARE_SOA_TABLE(DGCandidates, "AOD", "DGCANDIDATES", //! Table with DG candidates
2830
o2::soa::Index<>, bc::RunNumber, timestamp::Timestamp,
2931
collision::PosX, collision::PosY, collision::PosZ,
30-
collision::NumContrib, dgcand::NetCharge);
32+
collision::NumContrib, dgcand::NetCharge, dgcand::RgtrwTOF);
3133
using DGCandidate = DGCandidates::iterator;
3234

3335
namespace dgtrack

PWGUD/TableProducer/DGCandProducer.cxx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,13 @@
5252
#include "Framework/AnalysisTask.h"
5353

5454
#include "EventFiltering/PWGUD/DGHelpers.h"
55+
#include "PWGUD/Core/UDHelperFunctions.h"
5556
#include "PWGUD/DataModel/DGCandidates.h"
5657

5758
using namespace o2;
5859
using namespace o2::framework;
5960
using namespace o2::framework::expressions;
6061

61-
template <typename TCs>
62-
int8_t netCharge(TCs tracks)
63-
{
64-
int8_t nch = 0;
65-
for (auto track : tracks) {
66-
if (track.isPVContributor()) {
67-
nch += track.sign();
68-
}
69-
}
70-
return nch;
71-
}
72-
7362
struct DGCandProducer {
7463

7564
// get a DGCutparHolder
@@ -120,7 +109,7 @@ struct DGCandProducer {
120109
// update DGCandidates tables
121110
outputCollisions(bc.runNumber(), bc.timestamp(),
122111
collision.posX(), collision.posY(), collision.posZ(),
123-
collision.numContrib(), netCharge(tracks));
112+
collision.numContrib(), netCharge(tracks), rPVtrwTOF(tracks, collision.numContrib()));
124113

125114
// update DGTracks tables
126115
for (auto& track : tracks) {

PWGUD/Tasks/DGCandAnalyzer.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ struct DGCandAnalyzer {
8585
return;
8686
}
8787

88+
// skip events with out-of-range rgtrwTOF
89+
if (dgcand.rgtrwTOF() < diffCuts.minRgtrwTOF()) {
90+
return;
91+
}
92+
8893
// find track combinations which are compatible with anaPars.TPCnSigmas()
8994
auto nIVMs = pidsel.computeIVMs(anaPars.nCombine(), dgtracks);
9095

0 commit comments

Comments
 (0)