Skip to content

Commit 185a470

Browse files
author
Luigi Dello Stritto
committed
2 parents 692e479 + ea70b68 commit 185a470

File tree

57 files changed

+4785
-1000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4785
-1000
lines changed

Common/Tasks/centralityStudy.cxx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ struct centralityStudy {
193193
genericProcessCollision(collision);
194194
}
195195

196-
void processCollisionsWithCentrality(soa::Join<aod::Mults, aod::MultsExtra, aod::MultSelections, aod::CentFT0Cs, aod::MultsGlobal, aod::MultNeighs>::iterator const& collision)
196+
void processCollisionsWithCentrality(soa::Join<aod::Mults, aod::MultsExtra, aod::MultSelections, aod::CentFT0Cs, aod::MultsGlobal>::iterator const& collision)
197+
{
198+
genericProcessCollision(collision);
199+
}
200+
201+
void processCollisionsWithCentralityWithNeighbours(soa::Join<aod::Mults, aod::MultsExtra, aod::MultSelections, aod::CentFT0Cs, aod::MultsGlobal, aod::MultNeighs>::iterator const& collision)
197202
{
198203
genericProcessCollision(collision);
199204
}
@@ -217,8 +222,9 @@ struct centralityStudy {
217222
histos.fill(HIST("hFT0C_BCs"), multbc.multBCFT0C());
218223
}
219224

220-
PROCESS_SWITCH(centralityStudy, processCollisions, "per-collision analysis", true);
225+
PROCESS_SWITCH(centralityStudy, processCollisions, "per-collision analysis", false);
221226
PROCESS_SWITCH(centralityStudy, processCollisionsWithCentrality, "per-collision analysis", true);
227+
PROCESS_SWITCH(centralityStudy, processCollisionsWithCentralityWithNeighbours, "per-collision analysis", false);
222228
PROCESS_SWITCH(centralityStudy, processBCs, "per-BC analysis", true);
223229
};
224230

DPG/Tasks/AOTTrack/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ o2physics_add_dpl_workflow(qa-prim-vtx-vs-time
7070
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
7171
COMPONENT_NAME Analysis)
7272

73+
o2physics_add_dpl_workflow(qa-tracksplitting
74+
SOURCES qaTrackSplitting.cxx
75+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
76+
COMPONENT_NAME Analysis)
77+
7378
o2physics_add_dpl_workflow(tag-and-probe-dmesons
7479
SOURCES tagAndProbeDmesons.cxx
7580
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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+
///
13+
/// \file qaTrackSplitting.cxx
14+
/// \author Nicolò Jacazio nicolo.jacazio@cern.ch
15+
/// \brief Task to analyse the numbers of particles reconstructed more than once
16+
///
17+
18+
#include "Framework/AnalysisTask.h"
19+
#include "Framework/runDataProcessing.h"
20+
#include "Framework/HistogramRegistry.h"
21+
#include "Common/DataModel/EventSelection.h"
22+
#include "Common/Core/TrackSelectionDefaults.h"
23+
#include "Common/DataModel/TrackSelectionTables.h"
24+
25+
using namespace o2::framework;
26+
27+
struct qaTrackSplitting {
28+
Configurable<int> pdg{"pdg", 2212, "PDG code of the particle to be analysed"};
29+
struct : ConfigurableGroup {
30+
Configurable<bool> enableTrackCuts{"enableTrackCuts", false, "Enable the custom track cuts"};
31+
Configurable<int> itsPattern{"itsPattern", 0, "0 = Run3ITSibAny, 1 = Run3ITSallAny, 2 = Run3ITSall7Layers, 3 = Run3ITSibTwo"};
32+
Configurable<bool> requireITS{"requireITS", true, "Additional cut on the ITS requirement"};
33+
Configurable<bool> requireTPC{"requireTPC", true, "Additional cut on the TPC requirement"};
34+
Configurable<bool> requireGoldenChi2{"requireGoldenChi2", true, "Additional cut on the GoldenChi2"};
35+
Configurable<int> minITScl{"minITScl", 4, "Additional cut on the ITS cluster"};
36+
Configurable<float> minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.f, "Additional cut on the minimum number of crossed rows in the TPC"};
37+
Configurable<float> minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"};
38+
Configurable<float> maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 4.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"};
39+
Configurable<float> maxChi2PerClusterITS{"maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"};
40+
Configurable<float> maxDcaXY{"maxDcaXY", 10000.f, "Additional cut on the maximum abs value of the DCA xy"};
41+
Configurable<float> maxDcaZ{"maxDcaZ", 2.f, "Additional cut on the maximum abs value of the DCA z"};
42+
Configurable<float> minTPCNClsFound{"minTPCNClsFound", 0.f, "Additional cut on the minimum value of the number of found clusters in the TPC"};
43+
} cfgCustomTrackCuts;
44+
45+
// Histograms
46+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
47+
TrackSelection customTrackCuts;
48+
49+
void init(InitContext&)
50+
{
51+
histos.add("tracks", "tracsk", kTH1D, {{10, -0.5, 9.5, "Track selection"}});
52+
histos.add("numberOfRecoed", "recoed", kTH1D, {{10, -0.5, 9.5, "Number of tracks associated to a particle"}});
53+
histos.add("map", "map", kTH3D, {{100, -1, 1, "#Delta #eta"}, {100, -1, 1, "#Delta #varphi"}, {100, -1, 1, "#Delta #it{p}_{T}"}});
54+
55+
customTrackCuts = getGlobalTrackSelectionRun3ITSMatch(cfgCustomTrackCuts.itsPattern);
56+
LOG(info) << "Customizing track cuts:";
57+
customTrackCuts.SetRequireITSRefit(cfgCustomTrackCuts.requireITS);
58+
customTrackCuts.SetRequireTPCRefit(cfgCustomTrackCuts.requireTPC);
59+
customTrackCuts.SetRequireGoldenChi2(cfgCustomTrackCuts.requireGoldenChi2);
60+
customTrackCuts.SetRequireHitsInITSLayers(cfgCustomTrackCuts.minITScl.value, {0, 1, 2, 3, 4, 5, 6});
61+
customTrackCuts.SetMaxChi2PerClusterTPC(cfgCustomTrackCuts.maxChi2PerClusterTPC);
62+
customTrackCuts.SetMaxChi2PerClusterITS(cfgCustomTrackCuts.maxChi2PerClusterITS);
63+
customTrackCuts.SetMinNCrossedRowsTPC(cfgCustomTrackCuts.minNCrossedRowsTPC);
64+
customTrackCuts.SetMinNClustersTPC(cfgCustomTrackCuts.minTPCNClsFound);
65+
customTrackCuts.SetMinNCrossedRowsOverFindableClustersTPC(cfgCustomTrackCuts.minNCrossedRowsOverFindableClustersTPC);
66+
customTrackCuts.SetMaxDcaXYPtDep([&](float /*pt*/) { return cfgCustomTrackCuts.maxDcaXY; }); // No DCAxy cut will be used, this is done via the member function of the task
67+
customTrackCuts.SetMaxDcaZ(cfgCustomTrackCuts.maxDcaZ);
68+
customTrackCuts.print();
69+
}
70+
71+
// Global process
72+
using TrackCandidates = o2::soa::Join<o2::aod::Tracks, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::McTrackLabels>;
73+
void process(o2::soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels, o2::aod::EvSels>::iterator const& collision,
74+
TrackCandidates const& tracks,
75+
o2::aod::McParticles const&)
76+
{
77+
if (!collision.sel8()) {
78+
return;
79+
}
80+
typedef std::shared_ptr<TrackCandidates::iterator> trkType;
81+
82+
std::map<int64_t, std::vector<trkType>> particleUsageCounter;
83+
for (auto track : tracks) {
84+
histos.fill(HIST("tracks"), 0);
85+
if (!track.has_mcParticle()) {
86+
continue;
87+
}
88+
histos.fill(HIST("tracks"), 1);
89+
if (track.mcParticle().pdgCode() != pdg) {
90+
continue;
91+
}
92+
histos.fill(HIST("tracks"), 2);
93+
if (!track.mcParticle().isPhysicalPrimary()) {
94+
continue;
95+
}
96+
histos.fill(HIST("tracks"), 3);
97+
if (cfgCustomTrackCuts.enableTrackCuts.value && !customTrackCuts.IsSelected(track)) {
98+
continue;
99+
}
100+
histos.fill(HIST("tracks"), 4);
101+
particleUsageCounter[track.mcParticleId()].push_back(std::make_shared<decltype(track)>(track));
102+
}
103+
for (const auto& [mcId, tracks] : particleUsageCounter) {
104+
histos.fill(HIST("numberOfRecoed"), tracks.size());
105+
if (tracks.size() > 1) {
106+
bool isFirst = true;
107+
for (const auto& track : tracks) {
108+
if (isFirst) {
109+
isFirst = false;
110+
continue;
111+
}
112+
histos.fill(HIST("map"), track->eta() - tracks[0]->eta(), track->phi() - tracks[0]->phi(), track->pt() - tracks[0]->pt());
113+
}
114+
}
115+
}
116+
}
117+
};
118+
119+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<qaTrackSplitting>(cfgc)}; }

EventFiltering/PWGHF/HFFilter.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ struct HfFilter { // Main struct for HF triggers
418418

419419
if (!keepEvent[kBeauty3P] && isBeautyTagged) {
420420
auto isTrackSelected = helper.isSelectedTrackForSoftPionOrBeauty(track, trackParThird, dcaThird, kBeauty3P);
421-
if (isTrackSelected && ((TESTBIT(selD0, 0) && track.sign() < 0) || (TESTBIT(selD0, 1) && track.sign() > 0))) {
421+
if (isTrackSelected && ((TESTBIT(selD0, 0) && track.sign() > 0) || (TESTBIT(selD0, 1) && track.sign() < 0))) {
422422
auto massCand = RecoDecay::m(std::array{pVec2Prong, pVecThird}, std::array{massD0, massPi});
423423
auto pVecBeauty3Prong = RecoDecay::pVec(pVec2Prong, pVecThird);
424424
auto ptCand = RecoDecay::pt(pVecBeauty3Prong);
@@ -588,7 +588,7 @@ struct HfFilter { // Main struct for HF triggers
588588
}
589589

590590
int isTrackSelected = helper.isSelectedTrackForSoftPionOrBeauty(trackBachelor, trackParBachelor, dcaBachelor, -1);
591-
if (TESTBIT(isTrackSelected, kSoftPion) && ((TESTBIT(selD0, 0) && trackBachelor.sign() < 0) || (TESTBIT(selD0, 1) && trackBachelor.sign() > 0))) {
591+
if (TESTBIT(isTrackSelected, kSoftPion) && ((TESTBIT(selD0, 0) && trackBachelor.sign() > 0) || (TESTBIT(selD0, 1) && trackBachelor.sign() < 0))) {
592592
std::array<float, 2> massDausD0{massPi, massKa};
593593
auto massD0dau = massD0Cand;
594594
if (trackBachelor.sign() < 0) {

EventFiltering/macros/checkSkimming.C

Lines changed: 74 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,51 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
// O2 includes// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
12-
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
13-
// All rights not expressly granted are reserved.
14-
//
15-
// This software is distributed under the terms of the GNU General Public
16-
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
17-
//
18-
// In applying this license CERN does not waive the privileges and immunities
19-
// granted to it by virtue of its status as an Intergovernmental Organization
20-
// or submit itself to any jurisdiction.
21-
// O2 includes
2211

2312
#include <TCanvas.h>
2413
#include <TH1.h>
2514
#include <TFile.h>
15+
#include <TStyle.h>
2616

17+
#include <fstream>
2718
#include <iostream>
2819
#include <vector>
2920
#include <string>
21+
#include <regex>
3022

31-
void checkSkimming(std::string original_path = "AnalysisResults.root", std::string skimmed_path = "AnalysisResults_skimmed.root")
23+
void checkSkimming(std::string original_path = "AnalysisResults.root", std::string skimmed_path = "AnalysisResults_skimmed.root", TFile* outputFile = nullptr, bool skipDownscaled = true)
3224
{
33-
// Define the labels to be compared (only triggers not downscaled)
25+
gStyle->SetOptStat(0);
26+
std::string runNumber = "";
27+
std::regex re("/5[0-9]*");
28+
std::smatch match;
29+
if (std::regex_search(original_path, match, re)) {
30+
// Remove the leading '/'
31+
runNumber = match.str().substr(1);
32+
}
3433

3534
// Load the root files
3635
TFile file1(original_path.c_str());
3736
TFile file2(skimmed_path.c_str());
3837

3938
// Extract the histograms
40-
TH1* hist1 = dynamic_cast<TH1*>(file1.Get("central-event-filter-task/scalers/mFiltered;1")); // Replace with the correct path
41-
TH1* hist2 = dynamic_cast<TH1*>(file2.Get("central-event-filter-task/scalers/mScalers;1")); // Replace with the correct path
39+
TH1* hist0 = dynamic_cast<TH1*>(file1.Get("central-event-filter-task/scalers/mScalers;1"));
40+
TH1* hist1 = dynamic_cast<TH1*>(file1.Get("central-event-filter-task/scalers/mFiltered;1"));
41+
TH1* hist2 = dynamic_cast<TH1*>(file2.Get("central-event-filter-task/scalers/mScalers;1"));
42+
43+
if (!hist0 || !hist1 || !hist2) {
44+
std::cerr << "Error: Failed to extract histograms from the root files." << std::endl;
45+
return;
46+
}
4247

4348
std::vector<std::string> labels;
4449
for (int i = 1; i <= hist1->GetNbinsX(); i++) {
4550
std::string label = hist1->GetXaxis()->GetBinLabel(i);
46-
if (label != "Total number of events" && label != "Filtered events") {
51+
if (label != "Total number of events" && label != "Filtered events" && (!skipDownscaled || hist0->GetBinContent(i) == hist1->GetBinContent(i)) && hist0->GetBinContent(i) > 0) {
4752
labels.push_back(label);
4853
}
4954
}
5055

51-
if (!hist1 || !hist2) {
52-
std::cerr << "Error: Failed to extract histograms from the root files." << std::endl;
53-
return;
54-
}
55-
5656
// Find the bins corresponding to the desired labels
5757
std::vector<double> selected_bins1, selected_bins2;
5858
for (auto lab : labels) {
@@ -71,26 +71,62 @@ void checkSkimming(std::string original_path = "AnalysisResults.root", std::stri
7171
selected_bins2.push_back(hist2->GetBinContent(bin2));
7272
}
7373

74-
TFile output("output.root", "RECREATE");
75-
TH1D* hOriginal = new TH1D("hOriginal", "Original AO2D;;Number of events", labels.size(), 0, labels.size()); // Histogram for the original values
76-
TH1D* hSkimmed = new TH1D("hSkimmed", "AO2D from skimmed CTF;;Number of events", labels.size(), 0, labels.size()); // Histogram for the skimmed values
77-
TH1D* hRatio = new TH1D("hRatio", ";;Skimmed / Original", labels.size(), 0, labels.size()); // Histogram for the ratio of the two
74+
bool localFile = !outputFile;
75+
if (!outputFile) {
76+
outputFile = new TFile("output.root", "RECREATE");
77+
}
78+
if (!runNumber.empty()) {
79+
outputFile->mkdir(runNumber.data());
80+
}
81+
outputFile->cd(runNumber.data());
82+
83+
TH1D hOriginal("hOriginal", "Original AO2D;;Number of events", labels.size(), 0, labels.size()); // Histogram for the original values
84+
TH1D hSkimmed("hSkimmed", "AO2D from skimmed CTF;;Number of events", labels.size(), 0, labels.size()); // Histogram for the skimmed values
85+
TH1D hRatio("hRatio", (runNumber + ";;Skimmed / Original").data(), labels.size(), 0, labels.size()); // Histogram for the ratio of the two
7886

7987
// Fill the histograms
8088
for (int i = 0; i < labels.size(); i++) {
81-
hOriginal->SetBinContent(i + 1, selected_bins1[i]);
82-
hSkimmed->SetBinContent(i + 1, selected_bins2[i]);
83-
hOriginal->GetXaxis()->SetBinLabel(i + 1, labels[i].c_str());
84-
hSkimmed->GetXaxis()->SetBinLabel(i + 1, labels[i].c_str());
89+
hOriginal.SetBinContent(i + 1, selected_bins1[i]);
90+
hSkimmed.SetBinContent(i + 1, selected_bins2[i]);
91+
hOriginal.GetXaxis()->SetBinLabel(i + 1, labels[i].c_str());
92+
hSkimmed.GetXaxis()->SetBinLabel(i + 1, labels[i].c_str());
93+
hRatio.GetXaxis()->SetBinLabel(i + 1, labels[i].c_str());
94+
hRatio.SetBinContent(i + 1, selected_bins2[i] / selected_bins1[i]);
95+
}
96+
hOriginal.Write();
97+
hSkimmed.Write();
98+
hRatio.Write();
8599

86-
if (selected_bins1[i] < 1. || labels[i].find("Single") != std::string::npos || labels[i].find("Low") != std::string::npos || labels[i].find("Pt3P") != std::string::npos) {
87-
hRatio->GetXaxis()->SetBinLabel(i + 1, "Disabled");
88-
continue;
89-
}
90-
hRatio->GetXaxis()->SetBinLabel(i + 1, labels[i].c_str());
91-
hRatio->SetBinContent(i + 1, selected_bins2[i] / selected_bins1[i]);
100+
if (localFile) {
101+
outputFile->Close();
92102
}
93-
hOriginal->Write();
94-
hSkimmed->Write();
95-
hRatio->Write();
96103
}
104+
105+
void checkSkimming(std::string listName = "period.txt", bool skipDownscaled = true)
106+
{
107+
std::string periodName = listName.substr(0, listName.find_last_of('.'));
108+
std::ifstream file(listName);
109+
std::string line;
110+
TFile* outputFile = new TFile((periodName + ".root").data(), "RECREATE");
111+
TCanvas c1("c1", "c1", 800, 600);
112+
c1.SetGridy();
113+
int lineCounter = 0;
114+
while (std::getline(file, line)) {
115+
lineCounter++;
116+
}
117+
file.clear();
118+
file.seekg(0, std::ios::beg);
119+
int counter = 0;
120+
while (std::getline(file, line)) {
121+
size_t pos = line.find(",");
122+
std::string original_path = line.substr(0, pos);
123+
std::string skimmed_path = line.substr(pos + 1);
124+
checkSkimming(original_path, skimmed_path, outputFile, skipDownscaled);
125+
TH1* hRatio = (TH1*)gDirectory->Get("hRatio");
126+
hRatio->Draw();
127+
std::string suffix = counter == 0 ? "(" : (counter == lineCounter - 1 ? ")" : "");
128+
c1.Print((periodName + ".pdf" + suffix).data());
129+
counter++;
130+
}
131+
outputFile->Close();
132+
}

0 commit comments

Comments
 (0)