Skip to content

Commit a29036a

Browse files
committed
init utilsTpcSkimsTableCreator, move event selection there
1 parent cfbb038 commit a29036a

File tree

2 files changed

+64
-66
lines changed

2 files changed

+64
-66
lines changed

DPG/Tasks/TPC/tpcSkimsTableCreator.cxx

Lines changed: 7 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "tpcSkimsTableCreator.h"
2121

22+
#include "utilsTpcSkimsTableCreator.h"
23+
2224
#include "PWGDQ/DataModel/ReducedInfoTables.h"
2325
#include "PWGLF/DataModel/LFStrangenessPIDTables.h"
2426
#include "PWGLF/DataModel/LFStrangenessTables.h"
@@ -54,6 +56,7 @@ using namespace o2::framework;
5456
using namespace o2::framework::expressions;
5557
using namespace o2::track;
5658
using namespace o2::dataformats;
59+
using namespace o2::dpg_tpcskimstablecreator;
5760

5861
struct TreeWriterTpcV0 {
5962

@@ -126,21 +129,6 @@ struct TreeWriterTpcV0 {
126129
DaughterProton
127130
};
128131

129-
enum {
130-
TrackSelectionNoCut = 0,
131-
TrackSelectionGlobalTrack,
132-
TrackSelectionTrackWoPtEta,
133-
TrackSelectionGlobalTrackWoDCA,
134-
TrackSelectionQualityTracks,
135-
TrackSelectionInAcceptanceTracks
136-
};
137-
138-
enum {
139-
EventSelectionNo = 0,
140-
EventSelectionRun2,
141-
EventSelectionRun3
142-
};
143-
144132
Filter trackFilter = (trackSelection.node() == static_cast<int>(TrackSelectionNoCut)) ||
145133
((trackSelection.node() == static_cast<int>(TrackSelectionGlobalTrack)) && requireGlobalTrackInFilter()) ||
146134
((trackSelection.node() == static_cast<int>(TrackSelectionTrackWoPtEta)) && requireGlobalTrackWoPtEtaInFilter()) ||
@@ -428,22 +416,6 @@ struct TreeWriterTpcV0 {
428416
}
429417
};
430418

431-
/// Event selection
432-
template <typename CollisionType, typename TrackType>
433-
bool isEventSelected(const CollisionType& collision, const TrackType& /*tracks*/)
434-
{
435-
if (applyEvSel == EventSelectionRun2) {
436-
if (!collision.sel7()) {
437-
return false;
438-
}
439-
} else if (applyEvSel == EventSelectionRun3) {
440-
if (!collision.sel8()) {
441-
return false;
442-
}
443-
}
444-
return true;
445-
};
446-
447419
void init(o2::framework::InitContext&)
448420
{
449421
const std::array<bool, 7> doprocess{doprocessStandard, doprocessStandardWithCorrecteddEdx, doprocessWithdEdxTrQA, doprocessWithdEdxTrQAWithCorrecteddEdx, doprocessWithTrQA, doprocessWithTrQAWithCorrecteddEdx, doprocessDummy};
@@ -497,7 +469,7 @@ struct TreeWriterTpcV0 {
497469
void runStandard(Colls::iterator const& collision, soa::Filtered<TrksType> const& tracks, V0sWithID const& v0s, CascsWithID const& cascs)
498470
{
499471
/// Check event slection
500-
if (!isEventSelected(collision, tracks)) {
472+
if (!isEventSelected(collision, applyEvSel)) {
501473
return;
502474
}
503475
const auto& bc = collision.bc_as<aod::BCsWithTimestamps>();
@@ -574,7 +546,7 @@ struct TreeWriterTpcV0 {
574546
for (const auto& collision : collisions) {
575547
/// Check event slection
576548
const auto& tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex());
577-
if (!isEventSelected(collision, tracks)) {
549+
if (!isEventSelected(collision, applyEvSel)) {
578550
continue;
579551
}
580552
const auto& v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex());
@@ -757,21 +729,6 @@ struct TreeWriterTPCTOF {
757729
Configurable<float> downsamplingTsalisKaons{"downsamplingTsalisKaons", -1., "Downsampling factor to reduce the number of kaons"};
758730
Configurable<float> downsamplingTsalisPions{"downsamplingTsalisPions", -1., "Downsampling factor to reduce the number of pions"};
759731

760-
enum {
761-
TrackSelectionNoCut = 0,
762-
TrackSelectionGlobalTrack,
763-
TrackSelectionTrackWoPtEta,
764-
TrackSelectionGlobalTrackWoDCA,
765-
TrackSelectionQualityTracks,
766-
TrackSelectionInAcceptanceTracks
767-
};
768-
769-
enum {
770-
EventSelectionNo = 0,
771-
EventSelectionRun2,
772-
EventSelectionRun3
773-
};
774-
775732
Filter trackFilter = (trackSelection.node() == static_cast<int>(TrackSelectionNoCut)) ||
776733
((trackSelection.node() == static_cast<int>(TrackSelectionGlobalTrack)) && requireGlobalTrackInFilter()) ||
777734
((trackSelection.node() == static_cast<int>(TrackSelectionTrackWoPtEta)) && requireGlobalTrackWoPtEtaInFilter()) ||
@@ -955,22 +912,6 @@ struct TreeWriterTPCTOF {
955912
}
956913
}
957914

958-
/// Event selection
959-
template <typename CollisionType, typename TrackType>
960-
bool isEventSelected(const CollisionType& collision, const TrackType& /*tracks*/)
961-
{
962-
if (applyEvSel == EventSelectionRun2) {
963-
if (!collision.sel7()) {
964-
return false;
965-
}
966-
} else if (applyEvSel == EventSelectionRun3) {
967-
if (!collision.sel8()) {
968-
return false;
969-
}
970-
}
971-
return true;
972-
};
973-
974915
void init(o2::framework::InitContext&)
975916
{
976917
const std::array<bool, 7> doprocess{doprocessStandard, doprocessStandardWithCorrecteddEdx, doprocessWithdEdxTrQA, doprocessWithdEdxTrQAWithCorrecteddEdx, doprocessWithTrQA, doprocessWithTrQAWithCorrecteddEdx, doprocessDummy};
@@ -998,7 +939,7 @@ struct TreeWriterTPCTOF {
998939
void runStandard(Colls::iterator const& collision, soa::Filtered<TrksType> const& tracks)
999940
{
1000941
/// Check event selection
1001-
if (!isEventSelected(collision, tracks)) {
942+
if (!isEventSelected(collision, applyEvSel)) {
1002943
return;
1003944
}
1004945
const auto& bc = collision.bc_as<aod::BCsWithTimestamps>();
@@ -1055,7 +996,7 @@ struct TreeWriterTPCTOF {
1055996
for (const auto& collision : collisions) {
1056997
/// Check event selection
1057998
const auto& tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex());
1058-
if (!isEventSelected(collision, tracks)) {
999+
if (!isEventSelected(collision, applyEvSel)) {
10591000
continue;
10601001
}
10611002
const auto& tracksWithITSPid = soa::Attach<TrksType,
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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 utilsTpcSkimsTableCreator.h
13+
/// \author Annalena Kalteyer <annalena.sophie.kalteyer@cern.ch>
14+
/// \author Christian Sonnabend <christian.sonnabend@cern.ch>
15+
/// \author Jeremy Wilkinson <jeremy.wilkinson@cern.ch>
16+
/// \author Ana Marin <ana.marin@cern.ch>
17+
/// \author Oleksii Lubynets <oleksii.lubynets@cern.ch>
18+
/// \brief Helper functions used both in V0 and TOF structs of tpcSkimsTableCreator.cxx
19+
20+
#ifndef DPG_TASKS_TPC_UTILSTPCSKIMSTABLECREATOR_H_
21+
#define DPG_TASKS_TPC_UTILSTPCSKIMSTABLECREATOR_H_
22+
23+
namespace o2::dpg_tpcskimstablecreator
24+
{
25+
enum {
26+
TrackSelectionNoCut = 0,
27+
TrackSelectionGlobalTrack,
28+
TrackSelectionTrackWoPtEta,
29+
TrackSelectionGlobalTrackWoDCA,
30+
TrackSelectionQualityTracks,
31+
TrackSelectionInAcceptanceTracks
32+
};
33+
34+
enum {
35+
EventSelectionNo = 0,
36+
EventSelectionRun2,
37+
EventSelectionRun3
38+
};
39+
40+
/// Event selection
41+
template <typename CollisionType>
42+
bool isEventSelected(const CollisionType& collision, const int applyEvSel)
43+
{
44+
if (applyEvSel == EventSelectionRun2) {
45+
if (!collision.sel7()) {
46+
return false;
47+
}
48+
} else if (applyEvSel == EventSelectionRun3) {
49+
if (!collision.sel8()) {
50+
return false;
51+
}
52+
}
53+
return true;
54+
};
55+
56+
} // namespace o2::dpg_tpcskimstablecreator
57+
#endif // DPG_TASKS_TPC_UTILSTPCSKIMSTABLECREATOR_H_

0 commit comments

Comments
 (0)