-
Notifications
You must be signed in to change notification settings - Fork 646
Expand file tree
/
Copy pathCFTutorialTask4.cxx
More file actions
144 lines (116 loc) · 6.38 KB
/
CFTutorialTask4.cxx
File metadata and controls
144 lines (116 loc) · 6.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// 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.
/// \author Anton Riedel
#include "PWGCF/DataModel/FemtoDerived.h"
#include <Framework/ASoA.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/AnalysisTask.h>
#include <Framework/Configurable.h>
#include <Framework/Expressions.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>
#include <Framework/InitContext.h>
#include <Framework/OutputObjHeader.h>
#include <Framework/SliceCache.h>
#include <Framework/runDataProcessing.h>
#include <cstdint>
using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
struct CFTutorialTask4 {
// Define additional analysis level cuts applied as filters
Configurable<float> ConfZvtxMin{"ConfZvtxMin", -10, "Min Z vtx cut"};
Configurable<float> ConfZvtxMax{"ConfZvtxMax", 10, "Max Z vtx cut"};
Configurable<float> ConfEtaMin{"ConfEtaMin", -0.8, "Pseudorapidity cut"};
Configurable<float> ConfEtaMax{"ConfEtaMax", 0.8, "Pseudorapidity cut"};
Configurable<float> ConfPtMin{"ConfPtMin", 0.5, "Max Pt cut"};
Configurable<float> ConfPtMax{"ConfPtMax", 4.0, "Min Pt cut"};
// Defining filters
Filter collisionFilter = (aod::collision::posZ > ConfZvtxMin) && (aod::collision::posZ < ConfZvtxMax);
Filter trackFilter = (aod::femtodreamparticle::eta > ConfEtaMin) && (aod::femtodreamparticle::eta < ConfEtaMax) && (aod::femtodreamparticle::pt > ConfPtMin) && (aod::femtodreamparticle::pt < ConfPtMax);
// Apply filters
using FilteredFDCollisions = soa::Filtered<aod::FDCollisions>;
using FilteredFDCollision = FilteredFDCollisions::iterator;
using FilteredFDParts = soa::Filtered<aod::FDParticles>;
using FilteredFDPart = FilteredFDParts::iterator;
// selections for particles
Configurable<bool> ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"};
Configurable<int> ConfPDGCodePartOne{"ConfPDGCodePartOne", 2212, "Particle 1 - PDG code"};
Configurable<uint32_t> ConfCutPartOne{"ConfCutPartOne", 3191978, "Particle 1 - Selection bit"};
Configurable<uint32_t> ConfPIDTPCPartOne{"ConfPIDTPCPartOne", 2, "Particle 1 - TPC PID Selection bit"};
Configurable<uint32_t> ConfPIDTPCTOFPartOne{"ConfPIDTPCTOFPartOne", 4, "Particle 1 - TPCTOF PID Selection bit"};
Configurable<float> ConfPIDThresholdPartOne{"ConfPIDThresholdPartOne", 0.75, "Particle 1 - Momentum threshold for TPC to TPCTOF PID"};
Configurable<int> ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 2212, "Particle 2 - PDG code"};
Configurable<uint32_t> ConfCutPartTwo{"ConfCutPartTwo", 3191978, "Particle 2 - Selection bit"};
Configurable<uint32_t> ConfPIDTPCPartTwo{"ConfPIDTPCPartTwo", 0, "Particle 2 - TPC PID Selection bit"};
Configurable<uint32_t> ConfPIDTPCTOFPartTwo{"ConfPIDTPCTOFPartTwo", 0, "Particle 2 - TPCTOF PID Selection bit"};
Configurable<float> ConfPIDThresholdPartTwo{"ConfPIDThresholdPartTwo", 0.75, "Particle 2 - Momentum threshold for TPC to TPCTOF PID"};
/// Partitions for particle 1 and particle 2
Partition<FilteredFDParts> PartsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne);
Partition<FilteredFDParts> PartsTwo = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartTwo) == ConfCutPartTwo);
HistogramRegistry HistRegistry{"FemtoTutorial", {}, OutputObjHandlingPolicy::AnalysisObject};
/// mixing
SliceCache cache;
Preslice<aod::FDParticles> perCol = aod::femtodreamparticle::fdCollisionId;
// create analysis objects like histograms
void init(o2::framework::InitContext&)
{
// Add histograms to histogram registry
HistRegistry.add("Event/hZvtx", ";Z (cm)", kTH1F, {{240, -12, 12}});
HistRegistry.add("Particle1/hPt", ";#it{p_{T}} (GeV/#it{c})", kTH1F, {{100, 0, 4}});
HistRegistry.add("Particle1/hEta", ";#eta", kTH1F, {{100, -1., 1.}});
HistRegistry.add("Particle1/hPhi", ";#phi", kTH1F, {{360, 0, 6.28}});
HistRegistry.add("Particle2/hPt", ";#it{p_{T}} (GeV/#it{c})", kTH1F, {{100, 0, 4}});
HistRegistry.add("Particle2/hEta", ";#eta", kTH1F, {{100, -1., 1.}});
HistRegistry.add("Particle2/hPhi", ";#phi", kTH1F, {{360, 0, 6.28}});
HistRegistry.add("Pair/hSE", ";k^{*} (GeV/#it{c})", kTH1F, {{1000, 0., 5.}});
HistRegistry.add("Pair/hME", ";k^{*} (GeV/#it{c})", kTH1F, {{1000, 0., 5.}});
}
// process same event
void process(FilteredFDCollision const& col, FilteredFDParts const& /*parts*/)
{
/// event QA
HistRegistry.fill(HIST("Event/hZvtx"), col.posZ());
// generate partition of particels
auto GroupPartsOne = PartsOne->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache);
auto GroupPartsTwo = PartsTwo->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache);
/// QA for particle 1
for (auto& part : GroupPartsOne) {
HistRegistry.fill(HIST("Particle1/hPt"), part.pt());
HistRegistry.fill(HIST("Particle1/hEta"), part.eta());
HistRegistry.fill(HIST("Particle1/hPhi"), part.phi());
}
/// QA for particle 2
/// skip QA if particle 1 & 2 are the same
if (ConfIsSame.value == false) {
for (auto& part : GroupPartsTwo) {
HistRegistry.fill(HIST("Particle2/hPt"), part.pt());
HistRegistry.fill(HIST("Particle2/hEta"), part.eta());
HistRegistry.fill(HIST("Particle2/hPhi"), part.phi());
}
}
// TODO:
// implement the particle mixing in the same event
// for (pair in combinations) {
// if (PID particle 1 && PID particle 2){
// kstar = ...
// HistRegistry.fill(HIST("Pair/hSE"), kstar);
// }
// }
}
};
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
// Equivalent to the AddTask in AliPhysics
WorkflowSpec workflow{adaptAnalysisTask<CFTutorialTask4>(cfgc)};
return workflow;
}