From ee0a0e0627d66cd0ec53c9cd48113fbe740f3f12 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 24 Apr 2024 17:47:06 +0200 Subject: [PATCH 1/5] Common: add run 3 centrality study task --- Common/Tasks/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Common/Tasks/CMakeLists.txt b/Common/Tasks/CMakeLists.txt index 6c15bf176fa..2884d3b8b31 100644 --- a/Common/Tasks/CMakeLists.txt +++ b/Common/Tasks/CMakeLists.txt @@ -78,3 +78,8 @@ o2physics_add_dpl_workflow(qvectors-correction SOURCES qVectorsCorrection.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(centrality-study + SOURCES centralityStudy.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) \ No newline at end of file From 5efa58c66b7ab490aebbc5cc2e976dadff0036eb Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 24 Apr 2024 17:54:07 +0200 Subject: [PATCH 2/5] forgot git add... --- Common/Tasks/centralityStudy.cxx | 154 +++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 Common/Tasks/centralityStudy.cxx diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx new file mode 100644 index 00000000000..74cec18ff25 --- /dev/null +++ b/Common/Tasks/centralityStudy.cxx @@ -0,0 +1,154 @@ +// 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. +// +// This task does dedicated centrality studies for understanding the +// Run 3 Pb-Pb centrality selections in 2023 data. It is compatible with +// derived data. + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/McCollisionExtra.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "TH1F.h" +#include "TH2F.h" + +using namespace o2; +using namespace o2::framework; + +using BCsWithRun3Matchings = soa::Join; + +struct centralityStudy { + // Raw multiplicities + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Configurables + Configurable applySel8{"applySel8", true, "0 - no, 1 - yes"}; + Configurable applyVtxZ{"applyVtxZ", true, "0 - no, 1 - yes"}; + + // Apply extra event selections + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; + Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", true, "require events with at least one ITS-TPC track"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", true, "require events with at least one of vertex contributors matched to TOF"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", true, "require events with at least one of vertex contributors matched to TRD"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; + + // Configurable Axes + ConfigurableAxis axisMultFT0C{"axisMultFT0C", {2000, 0, 100000}, "FT0C amplitude"}; + + void init(InitContext&) + { + if(doprocessCollisions){ + const AxisSpec axisCollisions{100, -0.5f, 99.5f, "Number of collisions"}; + histos.add("hCollisionSelection", "hCollisionSelection", kTH1D, {{10,-0.5f, +9.5f}}); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); + histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + + histos.add("hFT0C_Collisions", "hFT0C_Collisions", kTH1D, {axisMultFT0C}); + } + + if(doprocessBCs){ + histos.add("hBCSelection", "hBCSelection", kTH1D, {{10,-0.5,9.5f}}); + histos.add("hFT0C_BCs", "hFT0C_BCs", kTH1D, {axisMultFT0C}); + } + } + + void processCollisions(soa::Join::iterator const& collision) + { + histos.fill(HIST("hCollisionSelection"), 0); // all collisions + if( applySel8 && !collision.multSel8() ) + return; + histos.fill(HIST("hCollisionSelection"), 1); + if( applyVtxZ && TMath::Abs(collision.multPVz()) > 10 ) + return; + histos.fill(HIST("hCollisionSelection"),2); + + // _______________________________________________________ + // Extra event selections start here + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 3 /* Not at ITS ROF border */); + + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 4 /* Not at TF border */); + + if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 5 /* Contains at least one ITS-TPC track */); + + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 6 /* PV position consistency check */); + + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 7 /* PV with at least one contributor matched with TOF */); + + if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 8 /* PV with at least one contributor matched with TRD */); + + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return; + } + histos.fill(HIST("hCollisionSelection"), 9 /* Not at same bunch pile-up */); + + // if we got here, we also finally fill the FT0C histogram, please + histos.fill(HIST("hFT0C_Collisions"), collision.multFT0C() /* Not at same bunch pile-up */); + } + + void processBCs(aod::MultsBC::iterator const& multbc) + { + // process BCs, calculate FT0C distribution + // conditionals suggested by FIT team (Jacek O. et al) + histos.fill(HIST("hBCSelection"), 0); // all BCs + if(!multbc.multBCColliding()) + return; + histos.fill(HIST("hBCSelection"), 1); // colliding + if(!multbc.multBCTVX()) + return; + histos.fill(HIST("hBCSelection"), 2); // TVX + if(!multbc.multBCFV0OrA()) + return; + histos.fill(HIST("hBCSelection"), 3); // FV0OrA + + // if we got here, we also finally fill the FT0C histogram, please + histos.fill(HIST("hFT0C_BCs"), multbc.multBCFT0C()); + } + + PROCESS_SWITCH(centralityStudy, processCollisions, "per-collision analysis", true); + PROCESS_SWITCH(centralityStudy, processBCs, "per-BC analysis", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 677b03202b97ad9533fb2c7cac560b3ce9f7d28f Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Wed, 24 Apr 2024 17:55:37 +0200 Subject: [PATCH 3/5] Please consider the following formatting changes (#280) --- Common/Tasks/centralityStudy.cxx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 74cec18ff25..83398d99044 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -9,9 +9,9 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// This task does dedicated centrality studies for understanding the -// Run 3 Pb-Pb centrality selections in 2023 data. It is compatible with -// derived data. +// This task does dedicated centrality studies for understanding the +// Run 3 Pb-Pb centrality selections in 2023 data. It is compatible with +// derived data. #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -50,9 +50,9 @@ struct centralityStudy { void init(InitContext&) { - if(doprocessCollisions){ + if (doprocessCollisions) { const AxisSpec axisCollisions{100, -0.5f, 99.5f, "Number of collisions"}; - histos.add("hCollisionSelection", "hCollisionSelection", kTH1D, {{10,-0.5f, +9.5f}}); + histos.add("hCollisionSelection", "hCollisionSelection", kTH1D, {{10, -0.5f, +9.5f}}); histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); histos.get(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(3, "posZ cut"); @@ -67,8 +67,8 @@ struct centralityStudy { histos.add("hFT0C_Collisions", "hFT0C_Collisions", kTH1D, {axisMultFT0C}); } - if(doprocessBCs){ - histos.add("hBCSelection", "hBCSelection", kTH1D, {{10,-0.5,9.5f}}); + if (doprocessBCs) { + histos.add("hBCSelection", "hBCSelection", kTH1D, {{10, -0.5, 9.5f}}); histos.add("hFT0C_BCs", "hFT0C_BCs", kTH1D, {axisMultFT0C}); } } @@ -76,12 +76,12 @@ struct centralityStudy { void processCollisions(soa::Join::iterator const& collision) { histos.fill(HIST("hCollisionSelection"), 0); // all collisions - if( applySel8 && !collision.multSel8() ) + if (applySel8 && !collision.multSel8()) return; histos.fill(HIST("hCollisionSelection"), 1); - if( applyVtxZ && TMath::Abs(collision.multPVz()) > 10 ) + if (applyVtxZ && TMath::Abs(collision.multPVz()) > 10) return; - histos.fill(HIST("hCollisionSelection"),2); + histos.fill(HIST("hCollisionSelection"), 2); // _______________________________________________________ // Extra event selections start here @@ -129,14 +129,14 @@ struct centralityStudy { // process BCs, calculate FT0C distribution // conditionals suggested by FIT team (Jacek O. et al) histos.fill(HIST("hBCSelection"), 0); // all BCs - if(!multbc.multBCColliding()) - return; + if (!multbc.multBCColliding()) + return; histos.fill(HIST("hBCSelection"), 1); // colliding - if(!multbc.multBCTVX()) - return; + if (!multbc.multBCTVX()) + return; histos.fill(HIST("hBCSelection"), 2); // TVX - if(!multbc.multBCFV0OrA()) - return; + if (!multbc.multBCFV0OrA()) + return; histos.fill(HIST("hBCSelection"), 3); // FV0OrA // if we got here, we also finally fill the FT0C histogram, please From 4169465391779bcd0a566fd6a861ee11d490daeb Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 24 Apr 2024 21:29:48 +0200 Subject: [PATCH 4/5] Add basic 2d qa --- Common/Tasks/centralityStudy.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 83398d99044..014a10d1800 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -33,6 +33,7 @@ struct centralityStudy { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Configurables + Configurable do2DPlots{"do2DPlots", true, "0 - no, 1 - yes"}; Configurable applySel8{"applySel8", true, "0 - no, 1 - yes"}; Configurable applyVtxZ{"applyVtxZ", true, "0 - no, 1 - yes"}; @@ -47,6 +48,9 @@ struct centralityStudy { // Configurable Axes ConfigurableAxis axisMultFT0C{"axisMultFT0C", {2000, 0, 100000}, "FT0C amplitude"}; + ConfigurableAxis axisMultPVContributors{"axisMultPVContributors", {200, 0, 6000}, "Number of PV Contributors"}; + ConfigurableAxis axisMultITSOnly{"axisMultITSOnly", {200, 0, 6000}, "Number of ITS only tracks"}; + ConfigurableAxis axisMultITSTPC{"axisMultITSTPC", {200, 0, 6000}, "Number of ITSTPC matched tracks"}; void init(InitContext&) { @@ -71,6 +75,11 @@ struct centralityStudy { histos.add("hBCSelection", "hBCSelection", kTH1D, {{10, -0.5, 9.5f}}); histos.add("hFT0C_BCs", "hFT0C_BCs", kTH1D, {axisMultFT0C}); } + + if(do2DPlots){ + histos.add("hFT0CvsNContribs", "hFT0CvsNContribs", kTH2F, {axisMultPVContributors, axisMultFT0C}); + histos.add("hMatchedVsITSOnly", "hMatchedVsITSOnly", kTH2F, {axisMultITSOnly, axisMultITSTPC}); + } } void processCollisions(soa::Join::iterator const& collision) @@ -122,6 +131,11 @@ struct centralityStudy { // if we got here, we also finally fill the FT0C histogram, please histos.fill(HIST("hFT0C_Collisions"), collision.multFT0C() /* Not at same bunch pile-up */); + + if(do2DPlots){ + histos.fill(HIST("hFT0CvsNContribs"), collision.multNTracksPV(), collision.multFT0C()); + histos.fill(HIST("hMatchedVsITSOnly"), collision.multNTracksITSOnly(), collision.multNTracksITSTPC()); + } } void processBCs(aod::MultsBC::iterator const& multbc) From d29e679212c7f54cc021379e9dc9a1f9923990c6 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Wed, 24 Apr 2024 21:34:12 +0200 Subject: [PATCH 5/5] Please consider the following formatting changes (#281) --- Common/Tasks/centralityStudy.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 014a10d1800..9a87e1c5b7d 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -76,7 +76,7 @@ struct centralityStudy { histos.add("hFT0C_BCs", "hFT0C_BCs", kTH1D, {axisMultFT0C}); } - if(do2DPlots){ + if (do2DPlots) { histos.add("hFT0CvsNContribs", "hFT0CvsNContribs", kTH2F, {axisMultPVContributors, axisMultFT0C}); histos.add("hMatchedVsITSOnly", "hMatchedVsITSOnly", kTH2F, {axisMultITSOnly, axisMultITSTPC}); } @@ -132,7 +132,7 @@ struct centralityStudy { // if we got here, we also finally fill the FT0C histogram, please histos.fill(HIST("hFT0C_Collisions"), collision.multFT0C() /* Not at same bunch pile-up */); - if(do2DPlots){ + if (do2DPlots) { histos.fill(HIST("hFT0CvsNContribs"), collision.multNTracksPV(), collision.multFT0C()); histos.fill(HIST("hMatchedVsITSOnly"), collision.multNTracksITSOnly(), collision.multNTracksITSTPC()); }