From ab1a97070550db1c3a7c7438ea138e942ea4c6e1 Mon Sep 17 00:00:00 2001 From: Josue-MiniPC Date: Thu, 2 May 2024 14:48:58 -0600 Subject: [PATCH 1/4] new changes --- PWGMM/Lumi/Tasks/lumiStability.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGMM/Lumi/Tasks/lumiStability.cxx b/PWGMM/Lumi/Tasks/lumiStability.cxx index 70bb4f93910..dad3204da1d 100644 --- a/PWGMM/Lumi/Tasks/lumiStability.cxx +++ b/PWGMM/Lumi/Tasks/lumiStability.cxx @@ -28,7 +28,6 @@ using namespace o2; using namespace o2::framework; using BCsWithTimestamps = soa::Join; -using BCsRun3 = soa::Join; int nBCsPerOrbit = 3564; From f198e8929574bc1f5a247c77fbb7ed276634b342 Mon Sep 17 00:00:00 2001 From: Josue-MiniPC Date: Wed, 8 May 2024 00:56:24 -0600 Subject: [PATCH 2/4] new changes --- PWGUD/Tasks/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGUD/Tasks/CMakeLists.txt b/PWGUD/Tasks/CMakeLists.txt index c3590aad77d..3c9fbe7ec01 100644 --- a/PWGUD/Tasks/CMakeLists.txt +++ b/PWGUD/Tasks/CMakeLists.txt @@ -103,7 +103,6 @@ o2physics_add_dpl_workflow(polarisation-rho PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(upc-jpsi-corr SOURCES upcJpsiCentralBarrelCorr.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector @@ -128,4 +127,3 @@ o2physics_add_dpl_workflow(inclusive-phikstar-sd SOURCES sginclusivePhiKstarSD.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector COMPONENT_NAME Analysis) - From 27abffa891e84ba88428c8b28d53109bf47e1e63 Mon Sep 17 00:00:00 2001 From: Josue-MiniPC Date: Mon, 20 May 2024 11:13:55 -0600 Subject: [PATCH 3/4] new changes --- PWGMM/Lumi/Tasks/lumiStability.cxx | 44 +++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/PWGMM/Lumi/Tasks/lumiStability.cxx b/PWGMM/Lumi/Tasks/lumiStability.cxx index dad3204da1d..ee2f7b8b497 100644 --- a/PWGMM/Lumi/Tasks/lumiStability.cxx +++ b/PWGMM/Lumi/Tasks/lumiStability.cxx @@ -42,15 +42,17 @@ struct lumiStabilityTask { void init(InitContext const&) { - const AxisSpec axisCounts{3, -0.5, 2.5}; + const AxisSpec axisCounts{5, -0.5, 4.5}; const AxisSpec axisTriggger{nBCsPerOrbit, -0.5f, nBCsPerOrbit - 0.5f}; // histo about triggers - histos.add("FDD/hCounts", "0 CountVertexFDD - 1 CountPFPVertexCoincidencesFDD - 2 CountPFPTriggerCoincidencesFDD; Number of Count; counts", kTH1F, {axisCounts}); + histos.add("FDD/hCounts", "0 CountVertexFDD - 1 CountPFPVertexCoincidencesFDD - 2 CountPFPTriggerCoincidencesFDD - 3 CountPPVertexCoincidencesFDD - 4 CountPPTriggerCoincidencesFDD; Number; counts", kTH1F, {axisCounts}); histos.add("FDD/bcVertexTrigger", "vertex trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVertexTriggerCoincidence", "vertex trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVertexTriggerCoincidencePFP", "vertex trigger per BC (FDD) with coincidences and Past Future Protection;BC in FDD; counts", kTH1F, {axisTriggger}); + histos.add("FDD/bcVertexTriggerCoincidencePP", "vertex trigger per BC (FDD) with coincidences and Past Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVertexTriggerBothSidesCoincidencePFP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Future Protection;BC in FDD; counts", kTH1F, {axisTriggger}); + histos.add("FDD/bcVertexTriggerBothSidesCoincidencePP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcSCentralTrigger", "scentral trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcSCentralTriggerCoincidence", "scentral trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVSCTrigger", "vertex and scentral trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); @@ -60,22 +62,26 @@ struct lumiStabilityTask { histos.add("FDD/bcVCTrigger", "vertex and central trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVCTriggerCoincidence", "vertex and central trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger}); - histos.add("FT0/hCounts", "0 CountVertexFT0 - 1 CountPFPVertexCoincidencesFT0 - 2 CountPFPTriggerCoincidencesFT0; Number of Count; counts", kTH1F, {axisCounts}); + histos.add("FT0/hCounts", "0 CountVertexFT0 - 1 CountPFPVertexCoincidencesFT0 - 2 CountPFPTriggerCoincidencesFT0 - 3 CountPPVertexCoincidencesFT0 - 4 CountPPTriggerCoincidencesFT0; Number; counts", kTH1F, {axisCounts}); histos.add("FT0/bcVertexTrigger", "vertex trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVertexTriggerPFP", "vertex trigger per BC (FT0) with Past Future Protection;BC in FT0; counts", kTH1F, {axisTriggger}); + histos.add("FT0/bcVertexTriggerPP", "vertex trigger per BC (FT0) with Past Protection;BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVertexTriggerBothSidesPFP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Future Protection;BC in FDD; counts", kTH1F, {axisTriggger}); + histos.add("FT0/bcVertexTriggerBothSidesPP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcSCentralTrigger", "Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVSCTrigger", "vertex and Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcCentralTrigger", "central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVCTrigger", "vertex and central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); - histos.add("FV0/hCounts", "0 CountCentralFV0 - 1 CountPFPCentralFV0 - 2 CountPFPOutInFV0; Number of Count; counts", kTH1F, {axisCounts}); + histos.add("FV0/hCounts", "0 CountCentralFV0 - 1 CountPFPCentralFV0 - 2 CountPFPOutInFV0 - 3 CountPPCentralFV0 - 4 CountPPOutInFV0; Number; counts", kTH1F, {axisCounts}); histos.add("FV0/bcOutTrigger", "Out trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcInTrigger", "In trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcSCenTrigger", "SCen trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcCenTrigger", "Central trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcCenTriggerPFPCentral", "Central trigger per BC (FV0) with PFP in central trigger;BC in V0; counts", kTH1F, {axisTriggger}); + histos.add("FV0/bcCenTriggerPPCentral", "Central trigger per BC (FV0) with PP in central trigger;BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcCenTriggerPFPOutIn", "Central trigger per BC (FV0) with PFP in Out and In trigger;BC in V0; counts", kTH1F, {axisTriggger}); + histos.add("FV0/bcCenTriggerPPOutIn", "Central trigger per BC (FV0) with PP in Out and In trigger;BC in V0; counts", kTH1F, {axisTriggger}); } bool checkAnyCoincidence(const std::vector& channels) @@ -216,11 +222,21 @@ struct lumiStabilityTask { } else { histos.fill(HIST("FDD/bcVertexTriggerBothSidesCoincidencePFP"), localBC); } + if (pastActivityFDDTriggerACoincidenceA == true || pastActivityFDDTriggerCCoincidenceC == true) { + histos.fill(HIST("FDD/hCounts"), 4); + } else { + histos.fill(HIST("FDD/bcVertexTriggerBothSidesCoincidencePP"), localBC); + } if (pastActivityFDDVertexCoincidences == true || futureActivityFDDVertexCoincidences == true) { histos.fill(HIST("FDD/hCounts"), 1); } else { histos.fill(HIST("FDD/bcVertexTriggerCoincidencePFP"), localBC); } + if (pastActivityFDDVertexCoincidences == true) { + histos.fill(HIST("FDD/hCounts"), 3); + } else { + histos.fill(HIST("FDD/bcVertexTriggerCoincidencePP"), localBC); + } } } // vertex true @@ -326,11 +342,21 @@ struct lumiStabilityTask { } else { histos.fill(HIST("FT0/bcVertexTriggerBothSidesPFP"), localBC); } + if (pastActivityFT0TriggerA == true || pastActivityFT0TriggerC == true) { + histos.fill(HIST("FT0/hCounts"), 4); + } else { + histos.fill(HIST("FT0/bcVertexTriggerBothSidesPP"), localBC); + } if (pastActivityFT0Vertex == true || futureActivityFT0Vertex == true) { histos.fill(HIST("FT0/hCounts"), 1); } else { histos.fill(HIST("FT0/bcVertexTriggerPFP"), localBC); } + if (pastActivityFT0Vertex == true) { + histos.fill(HIST("FT0/hCounts"), 3); + } else { + histos.fill(HIST("FT0/bcVertexTriggerPP"), localBC); + } } // vertex true if (sCentral) { @@ -437,11 +463,21 @@ struct lumiStabilityTask { } else { histos.fill(HIST("FV0/bcCenTriggerPFPOutIn"), localBC); } + if (pastActivityFV0TriggerOut == true || pastActivityFV0TriggerIn == true) { + histos.fill(HIST("FV0/hCounts"), 4); + } else { + histos.fill(HIST("FV0/bcCenTriggerPPOutIn"), localBC); + } if (pastActivityFV0Cen == true || futureActivityFV0Cen == true) { histos.fill(HIST("FV0/hCounts"), 1); } else { histos.fill(HIST("FV0/bcCenTriggerPFPCentral"), localBC); } + if (pastActivityFV0Cen == true) { + histos.fill(HIST("FV0/hCounts"), 3); + } else { + histos.fill(HIST("FV0/bcCenTriggerPPCentral"), localBC); + } } } // loop over V0 events } // end processMain From 28357f7925f2adc37ef673f1fb47ceb5a2e78dbb Mon Sep 17 00:00:00 2001 From: Josue-MiniPC Date: Thu, 15 Aug 2024 13:19:33 -0600 Subject: [PATCH 4/4] new changes --- PWGMM/Lumi/Tasks/lumiStability.cxx | 351 ++++++++++++++++++++--------- 1 file changed, 239 insertions(+), 112 deletions(-) diff --git a/PWGMM/Lumi/Tasks/lumiStability.cxx b/PWGMM/Lumi/Tasks/lumiStability.cxx index ee2f7b8b497..0a6c62f35b9 100644 --- a/PWGMM/Lumi/Tasks/lumiStability.cxx +++ b/PWGMM/Lumi/Tasks/lumiStability.cxx @@ -23,14 +23,17 @@ #include "DataFormatsFT0/Digit.h" #include "DataFormatsFV0/Digit.h" #include "Framework/ASoA.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonDataFormat/BunchFilling.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "DataFormatsParameters/GRPECSObject.h" using namespace o2; using namespace o2::framework; using BCsWithTimestamps = soa::Join; -int nBCsPerOrbit = 3564; - struct lumiStabilityTask { // Histogram registry: an object to hold your histograms HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -39,19 +42,44 @@ struct lumiStabilityTask { Configurable myMaxDeltaBCFDD{"myMaxDeltaBCFDD", 5, {"My BC cut"}}; Configurable myMaxDeltaBCFT0{"myMaxDeltaBCFT0", 5, {"My BC cut"}}; Configurable myMaxDeltaBCFV0{"myMaxDeltaBCFV0", 5, {"My BC cut"}}; + Configurable nOrbitsConf{"nOrbits", 10000, "number of orbits"}; + Configurable minOrbitConf{"minOrbit", 0, "minimum orbit"}; + + Service ccdb; + int nBCsPerOrbit = 3564; + int lastRunNumber = -1; + int nOrbits = nOrbitsConf; + double minOrbit = minOrbitConf; + int64_t bcSOR = 0; // global bc of the start of the first orbit, setting 0 by default for unanchored MC + int64_t nBCsPerTF = 128 * nBCsPerOrbit; // duration of TF in bcs, should be 128*3564 or 32*3564, setting 128 orbits by default sfor unanchored MC + std::bitset beamPatternA; + std::bitset beamPatternC; + std::bitset bcPatternA; + std::bitset bcPatternC; + std::bitset bcPatternB; + std::bitset bcPatternE; void init(InitContext const&) { - const AxisSpec axisCounts{5, -0.5, 4.5}; + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + const AxisSpec axisCounts{6, -0.5, 5.5}; + const AxisSpec axisV0Counts{5, -0.5, 4.5}; const AxisSpec axisTriggger{nBCsPerOrbit, -0.5f, nBCsPerOrbit - 0.5f}; + histos.add("hBcA", "BC pattern A; BC ; It is present", kTH1F, {axisTriggger}); + histos.add("hBcC", "BC pattern C; BC ; It is present", kTH1F, {axisTriggger}); + histos.add("hBcB", "BC pattern B; BC ; It is present", kTH1F, {axisTriggger}); + histos.add("hBcE", "BC pattern Empty; BC ; It is present", kTH1F, {axisTriggger}); + // histo about triggers - histos.add("FDD/hCounts", "0 CountVertexFDD - 1 CountPFPVertexCoincidencesFDD - 2 CountPFPTriggerCoincidencesFDD - 3 CountPPVertexCoincidencesFDD - 4 CountPPTriggerCoincidencesFDD; Number; counts", kTH1F, {axisCounts}); + histos.add("FDD/hCounts", "0 FDDCount - 1 FDDVertexCount - 2 FDDPPVertexCount - 3 FDDCoincidencesVertexCount - 4 FDDPPCoincidencesVertexCount - 5 FDDPPBotSidesCount; Number; counts", kTH1F, {axisCounts}); histos.add("FDD/bcVertexTrigger", "vertex trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); + histos.add("FDD/bcVertexTriggerPP", "vertex trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVertexTriggerCoincidence", "vertex trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger}); - histos.add("FDD/bcVertexTriggerCoincidencePFP", "vertex trigger per BC (FDD) with coincidences and Past Future Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVertexTriggerCoincidencePP", "vertex trigger per BC (FDD) with coincidences and Past Protection;BC in FDD; counts", kTH1F, {axisTriggger}); - histos.add("FDD/bcVertexTriggerBothSidesCoincidencePFP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Future Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVertexTriggerBothSidesCoincidencePP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcSCentralTrigger", "scentral trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcSCentralTriggerCoincidence", "scentral trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger}); @@ -61,19 +89,41 @@ struct lumiStabilityTask { histos.add("FDD/bcCentralTriggerCoincidence", "central trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVCTrigger", "vertex and central trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FDD/bcVCTriggerCoincidence", "vertex and central trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger}); - - histos.add("FT0/hCounts", "0 CountVertexFT0 - 1 CountPFPVertexCoincidencesFT0 - 2 CountPFPTriggerCoincidencesFT0 - 3 CountPPVertexCoincidencesFT0 - 4 CountPPTriggerCoincidencesFT0; Number; counts", kTH1F, {axisCounts}); + histos.add("FDD/hBcAVertex", "BC pattern A in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/hBcCVertex", "BC pattern C in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/hBcBVertex", "BC pattern B in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/hBcEVertex", "BC pattern Empty in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/timeACbcBVertex", "time bcB ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/timeACbcAVertex", "time bcA ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/timeACbcCVertex", "time bcC ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/timeACbcEVertex", "time bcE ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/hBcA", "BC pattern A in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/hBcC", "BC pattern C in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/hBcB", "BC pattern B in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/hBcE", "BC pattern Empty in FDD; BC in FDD ; It is present", kTH1F, {axisTriggger}); + histos.add("FDD/timeACbcB", "time bcB ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/timeACbcA", "time bcA ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/timeACbcC", "time bcC ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/timeACbcE", "time bcE ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + + histos.add("FT0/hCounts", "0 FT0Count - 1 FT0VertexCount - 2 FT0PPVertexCount - 3 FT0PPBothSidesCount; Number; counts", kTH1F, {axisCounts}); histos.add("FT0/bcVertexTrigger", "vertex trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); - histos.add("FT0/bcVertexTriggerPFP", "vertex trigger per BC (FT0) with Past Future Protection;BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVertexTriggerPP", "vertex trigger per BC (FT0) with Past Protection;BC in FT0; counts", kTH1F, {axisTriggger}); - histos.add("FT0/bcVertexTriggerBothSidesPFP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Future Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVertexTriggerBothSidesPP", "vertex per BC (FDD) with coincidences, at least one side trigger and Past Protection;BC in FDD; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcSCentralTrigger", "Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVSCTrigger", "vertex and Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcCentralTrigger", "central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); histos.add("FT0/bcVCTrigger", "vertex and central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); - - histos.add("FV0/hCounts", "0 CountCentralFV0 - 1 CountPFPCentralFV0 - 2 CountPFPOutInFV0 - 3 CountPPCentralFV0 - 4 CountPPOutInFV0; Number; counts", kTH1F, {axisCounts}); + histos.add("FT0/hBcA", "BC pattern A in FT0; BC in FT0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FT0/hBcC", "BC pattern C in FT0; BC in FT0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FT0/hBcB", "BC pattern B in FT0; BC in FT0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FT0/hBcE", "BC pattern Empty in FT0; BC in FT0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FT0/timeACbcB", "time bcB ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FT0/timeACbcA", "time bcA ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FT0/timeACbcC", "time bcC ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FT0/timeACbcE", "time bcE ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + + histos.add("FV0/hCounts", "0 CountCentralFV0 - 1 CountPFPCentralFV0 - 2 CountPFPOutInFV0 - 3 CountPPCentralFV0 - 4 CountPPOutInFV0; Number; counts", kTH1F, {axisV0Counts}); histos.add("FV0/bcOutTrigger", "Out trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcInTrigger", "In trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcSCenTrigger", "SCen trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); @@ -101,8 +151,78 @@ struct lumiStabilityTask { return false; } - void processMain(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::FV0As const& fv0s, aod::BCsWithTimestamps const&) + void processMain(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::FV0As const& fv0s, aod::BCsWithTimestamps const& bcs) { + uint32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023 + int runNumber = bcs.iteratorAt(0).runNumber(); + if (runNumber != lastRunNumber) { + lastRunNumber = runNumber; // do it only once + int64_t tsSOR = 0; + int64_t tsEOR = 1; + + if (runNumber >= 500000) { // access CCDB for data or anchored MC only + int64_t ts = bcs.iteratorAt(0).timestamp(); + + // access colliding and beam-gas bc patterns + auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", ts); + beamPatternA = grplhcif->getBunchFilling().getBeamPattern(0); + beamPatternC = grplhcif->getBunchFilling().getBeamPattern(1); + bcPatternA = beamPatternA & ~beamPatternC; + bcPatternC = ~beamPatternA & beamPatternC; + bcPatternB = beamPatternA & beamPatternC; + bcPatternE = ~beamPatternA & ~beamPatternC; + + for (int i = 0; i < nBCsPerOrbit; i++) { + if (bcPatternA[i]) { + histos.fill(HIST("hBcA"), i); + } + if (bcPatternC[i]) { + histos.fill(HIST("hBcC"), i); + } + if (bcPatternB[i]) { + histos.fill(HIST("hBcB"), i); + } + if (bcPatternE[i]) { + histos.fill(HIST("hBcE"), i); + } + } + + EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", ts); + // access orbit-reset timestamp + auto ctpx = ccdb->getForTimeStamp>("CTP/Calib/OrbitReset", ts); + int64_t tsOrbitReset = (*ctpx)[0]; // us + // access TF duration, start-of-run and end-of-run timestamps from ECS GRP + std::map metadata; + metadata["runNumber"] = Form("%d", runNumber); + auto grpecs = ccdb->getSpecific("GLO/Config/GRPECS", ts, metadata); + nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023 + tsSOR = grpecs->getTimeStart(); // ms + tsEOR = grpecs->getTimeEnd(); // ms + // calculate SOR and EOR orbits + int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; + int64_t orbitEOR = (tsEOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; + // adjust to the nearest TF edge + orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; + orbitEOR = orbitEOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; + // set nOrbits and minOrbit used for orbit-axis binning + nOrbits = orbitEOR - orbitSOR; + minOrbit = orbitSOR; + // first bc of the first orbit (should coincide with TF start) + bcSOR = orbitSOR * o2::constants::lhc::LHCMaxBunches; + // duration of TF in bcs + nBCsPerTF = nOrbitsPerTF * o2::constants::lhc::LHCMaxBunches; + LOGP(info, "tsOrbitReset={} us, SOR = {} ms, EOR = {} ms, orbitSOR = {}, nBCsPerTF = {}", tsOrbitReset, tsSOR, tsEOR, orbitSOR, nBCsPerTF); + } + + // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available + // otherwise default minOrbit and nOrbits will be used + const AxisSpec axisOrbits{static_cast(nOrbits / nOrbitsPerTF), 0., static_cast(nOrbits), ""}; + histos.add("hOrbitFDD", "FDD Orbits; Orbit; Entries", kTH1F, {axisOrbits}); + histos.add("hOrbitFDDVertex", "FDD Orbits; Orbit; Entries", kTH1F, {axisOrbits}); + histos.add("hOrbitFT0", "FT0 Orbits; Orbit; Entries", kTH1F, {axisOrbits}); + histos.add("hOrbitFV0", "FV0 Orbits; Orbit; Entries", kTH1F, {axisOrbits}); + } + for (auto const& fdd : fdds) { auto bc = fdd.bc_as(); if (bc.timestamp() == 0) { @@ -111,6 +231,7 @@ struct lumiStabilityTask { Long64_t globalBC = bc.globalBC(); int localBC = globalBC % nBCsPerOrbit; + uint64_t orbit = globalBC / nBCsPerOrbit; std::bitset<8> fddTriggers = fdd.triggerMask(); bool vertex = fddTriggers[o2::fdd::Triggers::bitVertex]; @@ -133,10 +254,76 @@ struct lumiStabilityTask { bool isCoinA = checkAnyCoincidence(channelA); bool isCoinC = checkAnyCoincidence(channelC); + histos.fill(HIST("FDD/hCounts"), 0); if (vertex) { histos.fill(HIST("FDD/bcVertexTrigger"), localBC); + histos.fill(HIST("FDD/hCounts"), 1); + histos.fill(HIST("hOrbitFDDVertex"), orbit - minOrbit); + + if (bcPatternA[localBC]) { + histos.fill(HIST("FDD/timeACbcAVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcAVertex"), localBC); + } + if (bcPatternC[localBC]) { + histos.fill(HIST("FDD/timeACbcCVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcCVertex"), localBC); + } + if (bcPatternB[localBC]) { + histos.fill(HIST("FDD/timeACbcBVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcBVertex"), localBC); + } + if (bcPatternE[localBC]) { + histos.fill(HIST("FDD/timeACbcEVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcEVertex"), localBC); + } + + int deltaIndex = 0; // backward move counts + int deltaBC = 0; // current difference wrt globalBC + bool pastActivityFDDVertex = false; + while (deltaBC < myMaxDeltaBCFDD) { + deltaIndex++; + if (fdd.globalIndex() - deltaIndex < 0) { + break; + } + const auto& fdd_past = fdds.iteratorAt(fdd.globalIndex() - deltaIndex); + auto bc_past = fdd_past.bc_as(); + deltaBC = globalBC - bc_past.globalBC(); + + if (deltaBC < myMaxDeltaBCFDD) { + std::bitset<8> fddTriggersPast = fdd_past.triggerMask(); + bool vertexPast = fddTriggersPast[o2::fdd::Triggers::bitVertex]; + pastActivityFDDVertex |= (vertexPast); + } + } + deltaIndex = 0; + deltaBC = 0; + + if (pastActivityFDDVertex == false) { + histos.fill(HIST("FDD/hCounts"), 2); + histos.fill(HIST("FDD/bcVertexTriggerPP"), localBC); + } + if (isCoinA && isCoinC) { histos.fill(HIST("FDD/bcVertexTriggerCoincidence"), localBC); + histos.fill(HIST("FDD/hCounts"), 1); + histos.fill(HIST("hOrbitFDD"), orbit - minOrbit); + + if (bcPatternA[localBC]) { + histos.fill(HIST("FDD/timeACbcA"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcA"), localBC); + } + if (bcPatternC[localBC]) { + histos.fill(HIST("FDD/timeACbcC"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcC"), localBC); + } + if (bcPatternB[localBC]) { + histos.fill(HIST("FDD/timeACbcB"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcB"), localBC); + } + if (bcPatternE[localBC]) { + histos.fill(HIST("FDD/timeACbcE"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcE"), localBC); + } int deltaIndex = 0; // backward move counts int deltaBC = 0; // current difference wrt globalBC @@ -149,7 +336,8 @@ struct lumiStabilityTask { break; } const auto& fdd_past = fdds.iteratorAt(fdd.globalIndex() - deltaIndex); - deltaBC = fdd.bcId() - fdd_past.bcId(); + auto bc_past = fdd_past.bc_as(); + deltaBC = globalBC - bc_past.globalBC(); if (deltaBC < myMaxDeltaBCFDD) { std::bitset<8> fddTriggersPast = fdd_past.triggerMask(); @@ -179,66 +367,16 @@ struct lumiStabilityTask { deltaIndex = 0; deltaBC = 0; - bool futureActivityFDDVertexCoincidences = false; - bool futureActivityFDDTriggerACoincidenceA = false; - bool futureActivityFDDTriggerCCoincidenceC = false; - while (deltaBC < myMaxDeltaBCFDD) { - deltaIndex++; - if (fdd.globalIndex() + deltaIndex >= fdds.size()) { - break; - } - const auto& fdd_future = fdds.iteratorAt(fdd.globalIndex() + deltaIndex); - deltaBC = fdd_future.bcId() - fdd.bcId(); - - if (deltaBC < myMaxDeltaBCFDD) { - std::bitset<8> fddTriggersFuture = fdd_future.triggerMask(); - bool vertexFuture = fddTriggersFuture[o2::fdd::Triggers::bitVertex]; - bool triggerAFuture = fddTriggersFuture[o2::fdd::Triggers::bitA]; - bool triggerCFuture = fddTriggersFuture[o2::fdd::Triggers::bitC]; - auto SideAFuture = fdd_future.chargeA(); - auto SideCFuture = fdd_future.chargeC(); - std::vector channelAFuture; - std::vector channelCFuture; - for (auto i = 0; i < 8; i++) { - if (SideAFuture[i] > 0) { - channelAFuture.push_back(i); - } - if (SideCFuture[i] > 0) { - channelCFuture.push_back(i); - } - } - - bool isCoinAFuture = checkAnyCoincidence(channelAFuture); - bool isCoinCFuture = checkAnyCoincidence(channelCFuture); - futureActivityFDDVertexCoincidences |= (vertexFuture & isCoinAFuture & isCoinCFuture); - futureActivityFDDTriggerACoincidenceA |= (triggerAFuture & isCoinAFuture); - futureActivityFDDTriggerCCoincidenceC |= (triggerCFuture & isCoinCFuture); - } - } - - histos.fill(HIST("FDD/hCounts"), 0); - if ((pastActivityFDDTriggerACoincidenceA || futureActivityFDDTriggerACoincidenceA) == true || (pastActivityFDDTriggerCCoincidenceC || futureActivityFDDTriggerCCoincidenceC) == true) { + if (pastActivityFDDVertexCoincidences == false) { histos.fill(HIST("FDD/hCounts"), 2); - } else { - histos.fill(HIST("FDD/bcVertexTriggerBothSidesCoincidencePFP"), localBC); - } - if (pastActivityFDDTriggerACoincidenceA == true || pastActivityFDDTriggerCCoincidenceC == true) { - histos.fill(HIST("FDD/hCounts"), 4); - } else { - histos.fill(HIST("FDD/bcVertexTriggerBothSidesCoincidencePP"), localBC); - } - if (pastActivityFDDVertexCoincidences == true || futureActivityFDDVertexCoincidences == true) { - histos.fill(HIST("FDD/hCounts"), 1); - } else { - histos.fill(HIST("FDD/bcVertexTriggerCoincidencePFP"), localBC); + histos.fill(HIST("FDD/bcVertexTriggerCoincidencePP"), localBC); } - if (pastActivityFDDVertexCoincidences == true) { + if (pastActivityFDDTriggerACoincidenceA == false || pastActivityFDDTriggerCCoincidenceC == false) { histos.fill(HIST("FDD/hCounts"), 3); - } else { - histos.fill(HIST("FDD/bcVertexTriggerCoincidencePP"), localBC); + histos.fill(HIST("FDD/bcVertexTriggerBothSidesCoincidencePP"), localBC); } - } - } // vertex true + } // coincidences + } // vertex true if (scentral) { histos.fill(HIST("FDD/bcSCentralTrigger"), localBC); @@ -277,14 +415,34 @@ struct lumiStabilityTask { Long64_t globalBC = bc.globalBC(); int localBC = globalBC % nBCsPerOrbit; + uint64_t orbit = globalBC / nBCsPerOrbit; std::bitset<8> fT0Triggers = ft0.triggerMask(); bool vertex = fT0Triggers[o2::ft0::Triggers::bitVertex]; bool sCentral = fT0Triggers[o2::ft0::Triggers::bitSCen]; bool central = fT0Triggers[o2::ft0::Triggers::bitCen]; + histos.fill(HIST("FT0/hCounts"), 0); if (vertex) { histos.fill(HIST("FT0/bcVertexTrigger"), localBC); + histos.fill(HIST("hOrbitFT0"), orbit - minOrbit); + + if (bcPatternA[localBC]) { + histos.fill(HIST("FT0/timeACbcA"), ft0.timeA(), ft0.timeC()); + histos.fill(HIST("FT0/hBcA"), localBC); + } + if (bcPatternC[localBC]) { + histos.fill(HIST("FT0/timeACbcC"), ft0.timeA(), ft0.timeC()); + histos.fill(HIST("FT0/hBcC"), localBC); + } + if (bcPatternB[localBC]) { + histos.fill(HIST("FT0/timeACbcB"), ft0.timeA(), ft0.timeC()); + histos.fill(HIST("FT0/hBcB"), localBC); + } + if (bcPatternE[localBC]) { + histos.fill(HIST("FT0/timeACbcE"), ft0.timeA(), ft0.timeC()); + histos.fill(HIST("FT0/hBcE"), localBC); + } int deltaIndex = 0; // backward move counts int deltaBC = 0; // current difference wrt globalBC @@ -297,7 +455,8 @@ struct lumiStabilityTask { break; } const auto& ft0_past = ft0s.iteratorAt(ft0.globalIndex() - deltaIndex); - deltaBC = ft0.bcId() - ft0_past.bcId(); + auto bc_past = ft0_past.bc_as(); + deltaBC = globalBC - bc_past.globalBC(); if (deltaBC < myMaxDeltaBCFT0) { std::bitset<8> fT0TriggersPast = ft0_past.triggerMask(); @@ -313,49 +472,14 @@ struct lumiStabilityTask { deltaIndex = 0; deltaBC = 0; - bool futureActivityFT0Vertex = false; - bool futureActivityFT0TriggerA = false; - bool futureActivityFT0TriggerC = false; - while (deltaBC < myMaxDeltaBCFT0) { - deltaIndex++; - if (ft0.globalIndex() + deltaIndex >= ft0s.size()) { - break; - } - const auto& ft0_future = ft0s.iteratorAt(ft0.globalIndex() + deltaIndex); - deltaBC = ft0_future.bcId() - ft0.bcId(); - - if (deltaBC < myMaxDeltaBCFT0) { - std::bitset<8> fT0TriggersFuture = ft0_future.triggerMask(); - bool vertexFuture = fT0TriggersFuture[o2::ft0::Triggers::bitVertex]; - bool triggerAFuture = fT0TriggersFuture[o2::ft0::Triggers::bitA]; - bool triggerCFuture = fT0TriggersFuture[o2::ft0::Triggers::bitC]; - - futureActivityFT0Vertex |= vertexFuture; - futureActivityFT0TriggerA |= triggerAFuture; - futureActivityFT0TriggerC |= triggerCFuture; - } - } - - histos.fill(HIST("FT0/hCounts"), 0); - if ((pastActivityFT0TriggerA || futureActivityFT0TriggerA) == true || (pastActivityFT0TriggerC || futureActivityFT0TriggerC) == true) { + histos.fill(HIST("FT0/hCounts"), 1); + if (pastActivityFT0Vertex == false) { histos.fill(HIST("FT0/hCounts"), 2); - } else { - histos.fill(HIST("FT0/bcVertexTriggerBothSidesPFP"), localBC); - } - if (pastActivityFT0TriggerA == true || pastActivityFT0TriggerC == true) { - histos.fill(HIST("FT0/hCounts"), 4); - } else { - histos.fill(HIST("FT0/bcVertexTriggerBothSidesPP"), localBC); - } - if (pastActivityFT0Vertex == true || futureActivityFT0Vertex == true) { - histos.fill(HIST("FT0/hCounts"), 1); - } else { - histos.fill(HIST("FT0/bcVertexTriggerPFP"), localBC); + histos.fill(HIST("FT0/bcVertexTriggerPP"), localBC); } - if (pastActivityFT0Vertex == true) { + if (pastActivityFT0TriggerA == false || pastActivityFT0TriggerC == false) { histos.fill(HIST("FT0/hCounts"), 3); - } else { - histos.fill(HIST("FT0/bcVertexTriggerPP"), localBC); + histos.fill(HIST("FT0/bcVertexTriggerBothSidesPP"), localBC); } } // vertex true @@ -385,6 +509,7 @@ struct lumiStabilityTask { Long64_t globalBC = bc.globalBC(); int localBC = globalBC % nBCsPerOrbit; + uint64_t orbit = globalBC / nBCsPerOrbit; std::bitset<8> fv0Triggers = fv0.triggerMask(); bool aOut = fv0Triggers[o2::fv0::Triggers::bitAOut]; @@ -405,6 +530,7 @@ struct lumiStabilityTask { } if (aCen) { + histos.fill(HIST("hOrbitFV0"), orbit - minOrbit); histos.fill(HIST("FV0/bcCenTrigger"), localBC); int deltaIndex = 0; // backward move counts @@ -418,7 +544,8 @@ struct lumiStabilityTask { break; } const auto& fv0_past = fv0s.iteratorAt(fv0.globalIndex() - deltaIndex); - deltaBC = fv0.bcId() - fv0_past.bcId(); + auto bc_past = fv0_past.bc_as(); + deltaBC = globalBC - bc_past.globalBC(); if (deltaBC < myMaxDeltaBCFV0) { std::bitset<8> fv0Triggers = fv0_past.triggerMask();