Skip to content

Commit 176183c

Browse files
authored
First commit of the DQ FilterPP, CutsLibrary and HistogramsLibrary (#4902)
1 parent b182217 commit 176183c

9 files changed

Lines changed: 743 additions & 24 deletions

File tree

Analysis/Core/include/Analysis/VarManager.h

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ class VarManager : public TObject
5959
Pair = BIT(11)
6060
};
6161

62+
enum PairCandidateType {
63+
kJpsiToEE, // J/psi -> e+ e-
64+
kJpsiToMuMu, // J/psi -> mu+ mu-
65+
kNMaxCandidateTypes
66+
};
67+
6268
public:
6369
enum Variables {
6470
kNothing = -1,
@@ -209,13 +215,21 @@ class VarManager : public TObject
209215
}
210216

211217
static void SetRunNumbers(int n, int* runs);
218+
static int GetNRuns()
219+
{
220+
return fgRunMap.size();
221+
}
222+
static TString GetRunStr()
223+
{
224+
return fgRunStr;
225+
}
212226

213227
template <uint32_t fillMap, typename T>
214228
static void FillEvent(T const& event, float* values = nullptr);
215229
template <uint32_t fillMap, typename T>
216230
static void FillTrack(T const& track, float* values = nullptr);
217231
template <typename T>
218-
static void FillPair(T const& t1, T const& t2, float* values = nullptr);
232+
static void FillPair(T const& t1, T const& t2, float* values = nullptr, PairCandidateType pairType = kJpsiToEE);
219233
template <typename T1, typename T2>
220234
static void FillDileptonHadron(T1 const& dilepton, T2 const& hadron, float* values = nullptr, float hadronMass = 0.0f);
221235

@@ -231,6 +245,7 @@ class VarManager : public TObject
231245
static void SetVariableDependencies(); // toggle those variables on which other used variables might depend
232246

233247
static std::map<int, int> fgRunMap; // map of runs to be used in histogram axes
248+
static TString fgRunStr; // semi-colon separated list of runs, to be used for histogram axis labels
234249

235250
static void FillEventDerived(float* values = nullptr);
236251
static void FillTrackDerived(float* values = nullptr);
@@ -454,32 +469,21 @@ void VarManager::FillTrack(T const& track, float* values)
454469
}
455470

456471
template <typename T>
457-
void VarManager::FillPair(T const& t1, T const& t2, float* values)
472+
void VarManager::FillPair(T const& t1, T const& t2, float* values, PairCandidateType pairType)
458473
{
459474
if (!values) {
460475
values = fgValues;
461476
}
462477

463-
float mass1 = fgkElectronMass;
464-
float mass2 = fgkElectronMass;
465-
466-
bool isMuon1 = t1.filteringFlags() & (1 << 0);
467-
bool isMuon2 = t2.filteringFlags() & (1 << 0);
468-
469-
if (isMuon1) {
470-
mass1 = fgkMuonMass;
471-
} else {
472-
mass1 = fgkElectronMass;
473-
}
474-
475-
if (isMuon2) {
476-
mass2 = fgkMuonMass;
477-
} else {
478-
mass2 = fgkElectronMass;
478+
float m1 = fgkElectronMass;
479+
float m2 = fgkElectronMass;
480+
if (pairType == kJpsiToMuMu) {
481+
m1 = fgkMuonMass;
482+
m2 = fgkMuonMass;
479483
}
480484

481-
ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), mass1);
482-
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), mass2);
485+
ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), m1);
486+
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), m2);
483487
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
484488
values[kMass] = v12.M();
485489
values[kPt] = v12.Pt();

Analysis/Core/src/VarManager.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ TString VarManager::fgVariableUnits[VarManager::kNVars] = {""};
1919
bool VarManager::fgUsedVars[VarManager::kNVars] = {kFALSE};
2020
float VarManager::fgValues[VarManager::kNVars] = {0.0};
2121
std::map<int, int> VarManager::fgRunMap;
22+
TString VarManager::fgRunStr = "";
2223

2324
//__________________________________________________________________
2425
VarManager::VarManager() : TObject()
@@ -66,6 +67,7 @@ void VarManager::SetRunNumbers(int n, int* runs)
6667
//
6768
for (int i = 0; i < n; ++i) {
6869
fgRunMap[runs[i]] = i + 1;
70+
fgRunStr += Form("%d;", runs[i]);
6971
}
7072
}
7173

Analysis/DataModel/include/Analysis/ReducedInfoTables.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424

2525
namespace o2::aod
2626
{
27+
28+
namespace dqppfilter
29+
{
30+
DECLARE_SOA_COLUMN(EventFilter, eventFilter, uint64_t);
31+
}
32+
// Table to be used for storing event-level decisions (DQ high level triggers)
33+
DECLARE_SOA_TABLE(DQEventFilter, "AOD", "EVENTFILTER", dqppfilter::EventFilter);
34+
2735
namespace reducedevent
2836
{
2937

Analysis/Tasks/PWGDQ/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
o2_add_library(PWGDQCore
2+
SOURCES
3+
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisCore)
4+
5+
o2_target_root_dictionary(PWGDQCore
6+
HEADERS CutsLibrary.h HistogramsLibrary.h
7+
LINKDEF PWGDQCoreLinkDef.h)
8+
19
o2_add_dpl_workflow(table-maker
210
SOURCES tableMaker.cxx
311
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::DetectorsBase O2::AnalysisCore
@@ -22,7 +30,12 @@ o2_add_dpl_workflow(table-maker-pp
2230
SOURCES tableMaker_pp.cxx
2331
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::DetectorsBase O2::AnalysisCore
2432
COMPONENT_NAME Analysis)
25-
33+
34+
o2_add_dpl_workflow(dq-filter-pp
35+
SOURCES filterPP.cxx
36+
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::DetectorsBase O2::AnalysisCore
37+
COMPONENT_NAME Analysis)
38+
2639
o2_add_dpl_workflow(table-maker-muon-pp
2740
SOURCES tableMakerMuon_pp.cxx
2841
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::DetectorsBase O2::AnalysisCore

Analysis/Tasks/PWGDQ/CutsLibrary.h

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
//
11+
// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no
12+
//
13+
#include "Analysis/AnalysisCut.h"
14+
#include "Analysis/AnalysisCompositeCut.h"
15+
#include "Analysis/VarManager.h"
16+
17+
namespace o2::aod
18+
{
19+
namespace dqcuts
20+
{
21+
AnalysisCompositeCut* GetCompositeCut(const char* cutName);
22+
AnalysisCut* GetAnalysisCut(const char* cutName);
23+
} // namespace dqcuts
24+
} // namespace o2::aod
25+
26+
AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName)
27+
{
28+
//
29+
// define composie cuts, typically combinations of all the ingredients needed for a full cut
30+
//
31+
// TODO: Agree on some conventions for the naming
32+
// Possibly think of possible customization of the predefined cuts
33+
34+
AnalysisCompositeCut* cut = new AnalysisCompositeCut(cutName, cutName);
35+
std::string nameStr = cutName;
36+
37+
if (!nameStr.compare("jpsiKineAndQuality")) {
38+
cut->AddCut(GetAnalysisCut("jpsiStandardKine"));
39+
cut->AddCut(GetAnalysisCut("electronStandardQuality"));
40+
cut->AddCut(GetAnalysisCut("standardPrimaryTrack"));
41+
return cut;
42+
}
43+
44+
if (!nameStr.compare("jpsiPID1")) {
45+
cut->AddCut(GetAnalysisCut("jpsiStandardKine"));
46+
cut->AddCut(GetAnalysisCut("electronStandardQuality"));
47+
cut->AddCut(GetAnalysisCut("standardPrimaryTrack"));
48+
cut->AddCut(GetAnalysisCut("electronPID1"));
49+
return cut;
50+
}
51+
52+
if (!nameStr.compare("jpsiPID2")) {
53+
cut->AddCut(GetAnalysisCut("jpsiStandardKine"));
54+
cut->AddCut(GetAnalysisCut("electronStandardQuality"));
55+
cut->AddCut(GetAnalysisCut("standardPrimaryTrack"));
56+
cut->AddCut(GetAnalysisCut("electronPID2"));
57+
return cut;
58+
}
59+
60+
if (!nameStr.compare("pairNoCut")) {
61+
cut->AddCut(GetAnalysisCut("pairNoCut"));
62+
return cut;
63+
}
64+
65+
if (!nameStr.compare("pairMassLow")) {
66+
cut->AddCut(GetAnalysisCut("pairMassLow"));
67+
return cut;
68+
}
69+
70+
if (!nameStr.compare("pairJpsi")) {
71+
cut->AddCut(GetAnalysisCut("pairJpsi"));
72+
return cut;
73+
}
74+
75+
if (!nameStr.compare("pairPsi2S")) {
76+
cut->AddCut(GetAnalysisCut("pairPsi2S"));
77+
return cut;
78+
}
79+
80+
if (!nameStr.compare("pairUpsilon")) {
81+
cut->AddCut(GetAnalysisCut("pairUpsilon"));
82+
return cut;
83+
}
84+
85+
if (!nameStr.compare("pairJpsiLowPt1")) {
86+
cut->AddCut(GetAnalysisCut("pairJpsi"));
87+
cut->AddCut(GetAnalysisCut("pairPtLow1"));
88+
return cut;
89+
}
90+
91+
if (!nameStr.compare("pairJpsiLowPt2")) {
92+
cut->AddCut(GetAnalysisCut("pairJpsi"));
93+
cut->AddCut(GetAnalysisCut("pairPtLow2"));
94+
return cut;
95+
}
96+
97+
delete cut;
98+
return nullptr;
99+
}
100+
101+
AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName)
102+
{
103+
//
104+
// define here cuts which are likely to be used often
105+
//
106+
AnalysisCut* cut = new AnalysisCut(cutName, cutName);
107+
std::string nameStr = cutName;
108+
109+
if (!nameStr.compare("eventStandard")) {
110+
cut->AddCut(VarManager::kVtxZ, -10.0, 10.0);
111+
cut->AddCut(VarManager::kIsINT7, 0.5, 1.5);
112+
return cut;
113+
}
114+
115+
if (!nameStr.compare("int7vtxZ5")) {
116+
cut->AddCut(VarManager::kVtxZ, -5.0, 5.0);
117+
cut->AddCut(VarManager::kIsINT7, 0.5, 1.5);
118+
return cut;
119+
}
120+
121+
if (!nameStr.compare("jpsiStandardKine")) {
122+
cut->AddCut(VarManager::kPt, 1.0, 1000.0);
123+
cut->AddCut(VarManager::kEta, -0.9, 0.9);
124+
return cut;
125+
}
126+
127+
if (!nameStr.compare("electronStandardQuality")) {
128+
cut->AddCut(VarManager::kIsSPDany, 0.5, 1.5);
129+
cut->AddCut(VarManager::kIsITSrefit, 0.5, 1.5);
130+
cut->AddCut(VarManager::kIsTPCrefit, 0.5, 1.5);
131+
cut->AddCut(VarManager::kTPCchi2, 0.0, 4.0);
132+
cut->AddCut(VarManager::kITSchi2, 0.1, 36.0);
133+
cut->AddCut(VarManager::kTPCncls, 100.0, 161.);
134+
return cut;
135+
}
136+
137+
if (!nameStr.compare("standardPrimaryTrack")) {
138+
cut->AddCut(VarManager::kTrackDCAxy, -1.0, 1.0);
139+
cut->AddCut(VarManager::kTrackDCAz, -3.0, 3.0);
140+
return cut;
141+
}
142+
143+
TF1* cutLow1 = new TF1("cutLow1", "pol1", 0., 10.);
144+
cutLow1->SetParameters(130., -40.0);
145+
if (!nameStr.compare("electronPID1")) {
146+
cut->AddCut(VarManager::kTPCsignal, 70., 100.);
147+
cut->AddCut(VarManager::kTPCsignal, cutLow1, 100.0, false, VarManager::kPin, 0.5, 3.0);
148+
return cut;
149+
}
150+
151+
if (!nameStr.compare("electronPID2")) {
152+
cut->AddCut(VarManager::kTPCsignal, 73., 100.);
153+
cut->AddCut(VarManager::kTPCsignal, cutLow1, 100.0, false, VarManager::kPin, 0.5, 3.0);
154+
return cut;
155+
}
156+
157+
if (!nameStr.compare("pairNoCut")) {
158+
cut->AddCut(VarManager::kMass, 0.0, 1000.0);
159+
return cut;
160+
}
161+
162+
if (!nameStr.compare("pairMassLow")) {
163+
cut->AddCut(VarManager::kMass, 2.5, 1000.0);
164+
return cut;
165+
}
166+
167+
if (!nameStr.compare("pairJpsi")) {
168+
cut->AddCut(VarManager::kMass, 2.8, 3.3);
169+
return cut;
170+
}
171+
172+
if (!nameStr.compare("pairPsi2S")) {
173+
cut->AddCut(VarManager::kMass, 3.4, 3.9);
174+
return cut;
175+
}
176+
177+
if (!nameStr.compare("pairUpsilon")) {
178+
cut->AddCut(VarManager::kMass, 8.0, 11.0);
179+
return cut;
180+
}
181+
182+
if (!nameStr.compare("pairPtLow1")) {
183+
cut->AddCut(VarManager::kPt, 2.0, 1000.0);
184+
return cut;
185+
}
186+
187+
if (!nameStr.compare("pairPtLow2")) {
188+
cut->AddCut(VarManager::kPt, 5.0, 1000.0);
189+
return cut;
190+
}
191+
192+
delete cut;
193+
return nullptr;
194+
}

0 commit comments

Comments
 (0)