From 94b345d7b1f4faceb505a355c0599b3bec1f6e20 Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Thu, 5 Sep 2024 14:54:11 +0900 Subject: [PATCH 01/20] PWGHF new task for W/Z->e in midrapidity --- PWGHF/HFL/Tasks/CMakeLists.txt | 6 + PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 244 ++++++++++++++++++++++ 2 files changed, 250 insertions(+) create mode 100644 PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx diff --git a/PWGHF/HFL/Tasks/CMakeLists.txt b/PWGHF/HFL/Tasks/CMakeLists.txt index 609213a5716..a0b41ab8cc8 100644 --- a/PWGHF/HFL/Tasks/CMakeLists.txt +++ b/PWGHF/HFL/Tasks/CMakeLists.txt @@ -9,6 +9,11 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +o2physics_add_dpl_workflow(task-electron-weakboson + SOURCES taskElectronWeakBoson.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(task-muon-charm-beauty-separation SOURCES taskMuonCharmBeautySeparation.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -33,3 +38,4 @@ o2physics_add_dpl_workflow(task-single-muon-source SOURCES taskSingleMuonSource.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx new file mode 100644 index 00000000000..bd2ffbc58bd --- /dev/null +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -0,0 +1,244 @@ +// 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. +/// +/// \ task for WeakBoson (W/Z) based on electron in mid-rapidity +/// +/// \S. Sakai & S. Ito + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/PIDResponse.h" +#include "Framework/ASoAHelpers.h" + +#include "EMCALBase/Geometry.h" +#include "EMCALCalib/BadChannelMap.h" +#include "PWGJE/DataModel/EMCALClusters.h" +#include "DataFormatsEMCAL/Cell.h" +#include "DataFormatsEMCAL/Constants.h" +#include "DataFormatsEMCAL/AnalysisCluster.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using selectedClusters = o2::soa::Filtered; + +// PbPb +using TrackEle = o2::soa::Filtered>; + +// pp +//using TrackEle = o2::soa::Filtered>; + +struct HfTaskElectronWeakBoson { + + Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; + Preslice perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId; + PresliceUnsorted perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId; + + Configurable nBinsPt{"nBinsPt", 100, "N bins in pt histo"}; + Configurable nBinsE{"nBinsE", 100, "N bins in E histo"}; + + // event filter + Filter eventFilter = (o2::aod::evsel::sel8 == true); + Configurable vtxZ{"vtxZ", 10.f, ""}; + Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); + + // track cuts + Filter filter_globalTr = requireGlobalTrackInFilter(); + + Configurable etalow{"etalow", -0.6f, ""}; + Configurable etaup{"etaup", 0.6f, ""}; + Filter etafilter = (aod::track::eta < etaup) && (aod::track::eta > etalow); + + Configurable dcaxy_cut{"dcaxy_cut", 2.0f, ""}; + Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut); + + Configurable mimpT_cut{"mimpT_cut", 3.0f, "minimum pT cut"}; + Configurable itschi2_cut{"itschi2_cut", 15.0f, "its chi2 cut"}; + Configurable tpcchi2_cut{"tpcchi2_cut", 4.0f, "tpc chi2 cut"}; + Configurable itsNcl_cut{"itsNcl_cut", 2.0f, "its # of cluster cut"}; + Configurable tpcNcl_cut{"tpcNcl_cut", 100.0f, "tpc # if cluster cut"}; + Configurable tpcNclCr_cut{"tpcNclCr_cut", 100.0f, "tpc # of crossedRows cut"}; + + // cluster cut + Configurable mClusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; + Configurable minTime{"minTime", -25., "Minimum cluster time for time cut"}; + Configurable maxTime{"maxTime", +20., "Maximum cluster time for time cut"}; + Configurable minM02{"minM02", 0.1, "Minimum M02 for M02 cut"}; + Configurable maxM02{"maxM02", 0.9, "Maximum M02 for M02 cut"}; + Configurable minM20{"minM20", 0.1, "Minimum M20 for M20 cut"}; + Configurable maxM20{"maxM20", 0.6, "Maximum M20 for M20 cut"}; + Configurable MatchR_cut{"MatchR_cut", 0.1, "cluster - track matching cut"}; + + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); + + // Histogram registry: an object to hold your histograms + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + + // define axes you want to use + const AxisSpec axisZvtx{400, -20, 20, "Zvtx"}; + const AxisSpec axisCounter{1, 0, 1, "events"}; + const AxisSpec axisEta{200, -1.0, 1.0, "#eta"}; + const AxisSpec axisPt{nBinsPt, 0, 10, "p_{T}"}; + const AxisSpec axisNsigma{100, -5, 5, "N#sigma"}; + const AxisSpec axisE{nBinsE, 0, 10, "Energy"}; + const AxisSpec axisM02{100, 0, 1, "M02"}; + const AxisSpec axisdPhi{200, -1, 1, "dPhi"}; + const AxisSpec axisdEta{200, -1, 1, "dEta"}; + const AxisSpec axisPhi{350, 0, 7, "Phi"}; + const AxisSpec axisEop{200, 0, 2, "Eop"}; + const AxisSpec axisChi2{500, 0.0, 50.0, "#chi^{2}"}; + const AxisSpec axisCluster{100, 0.0, 200.0, "counts"}; + const AxisSpec axisITSNCls{20, 0.0, 20, "counts"}; + const AxisSpec axisEMCtime{200, -100.0, 100, "EMC time"}; + + // create histograms + histos.add("ZvtxHistogram", "ZvtxHistogram", kTH1F, {axisZvtx}); + histos.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter}); + histos.add("ITS_Chi2_Hist", "ITS #chi^{2} Hist", kTH1F, {axisChi2}); + histos.add("TPC_Chi2_Hist", "TPC #chi^{2} Hist", kTH1F, {axisChi2}); + histos.add("TPC_NCls_Hist", "TPC_NCls_Hist", kTH1F, {axisCluster}); + histos.add("ITS_NCls_Hist", "ITS_NCls_Hist", kTH1F, {axisITSNCls}); + histos.add("TPC_NClsCrossedRows_Hist", "TPC_NClsCrossedRows_Hist", kTH1F, {axisCluster}); + histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); + histos.add("ptHistogram", "ptHistogram", kTH1F, {axisPt}); + histos.add("TPCElHistogram", "TPCElHistogram", kTH2F, {{axisPt}, {axisNsigma}}); + histos.add("EnergyHistogram", "EnergyHistogram", kTH1F, {axisE}); + histos.add("M02Histogram", "M02Histogram", kTH2F, {{axisNsigma},{axisM02}}); + histos.add("M20Histogram", "M20Histogram", kTH2F, {{axisNsigma},{axisM02}}); + histos.add("TrMatchHistogram", "TrMatchHistogram", kTH2F, {{axisdPhi},{axisdEta}}); + histos.add("TrMatchHistogram_mim", "TrMatchHistogram_mim", kTH2F, {{axisdPhi},{axisdEta}}); + histos.add("MatchPhiHistogram", "MatchPhiHistogram", kTH2F, {{axisPhi},{axisPhi}}); + histos.add("MatchEtaHistogram", "MatchEtaHistogram", kTH2F, {{axisEta},{axisEta}}); + histos.add("EopHistogram", "EopHistogram", kTH2F, {{axisPt},{axisEop}}); + histos.add("EopNsigTPCHistogram", "EopNsigTPCHistogram", kTH2F, {{axisNsigma},{axisEop}}); + histos.add("EMCtimeHistogram", "EMCtimeHistogram", kTH1F, {axisEMCtime}); + } + + //void process(soa::Filtered::iterator const& collision, selectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) + void process(soa::Filtered::iterator const& collision, selectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) + { + histos.fill(HIST("hEventCounter"),0.5); + + //LOGF(info, "Collision index : %d", collision.index()); + //LOGF(info, "Number of tracks: %d", tracks.size()); + //LOGF(info, "Number of clusters: %d", clusters.size()); + //LOGF(info, "Number of clusters: %d", emcClusters.size()); + + histos.fill(HIST("ZvtxHistogram"), collision.posZ()); + + for (auto& track : tracks) { + + histos.fill(HIST("etaHistogram"), track.eta()); + histos.fill(HIST("ITS_Chi2_Hist"), track.itsChi2NCl()); + histos.fill(HIST("TPC_Chi2_Hist"), track.tpcChi2NCl()); + histos.fill(HIST("TPC_NCls_Hist"), track.tpcNClsFound()); + histos.fill(HIST("ITS_NCls_Hist"), track.itsNCls()); + histos.fill(HIST("TPC_NClsCrossedRows_Hist"), track.tpcNClsCrossedRows()); + + if(TMath::Abs(track.eta())>0.6)continue; + if(track.tpcNClsCrossedRows()dcaxy_cut)continue; + if(track.itsChi2NCl() > itschi2_cut) continue; + if(track.tpcChi2NCl() > tpcchi2_cut) continue; + if (track.tpcNClsFound() < tpcNcl_cut) continue; + if(track.itsNCls()3.265)continue; + auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); + + //LOGF(info, "Number of matched track: %d", tracksofcluster.size()); + + double Rmim = 999.9; + double dPhi_mim = 999.9; + double dEta_mim = 999.9; + + if(tracksofcluster.size()>0) + { + int nmatch = 0; + for(const auto& match : tracksofcluster) + { + if(match.emcalcluster_as().time()().time()>maxTime)continue; + if(match.emcalcluster_as().m02()().m02()>maxM02)continue; + + double emc_m20 = match.emcalcluster_as().m20(); + double emc_m02 = match.emcalcluster_as().m02(); + double emc_energy = match.emcalcluster_as().energy(); + double emc_phi = match.emcalcluster_as().phi(); + double emc_eta = match.emcalcluster_as().eta(); + double emc_time = match.emcalcluster_as().time(); + //LOG(info) << "tr phi0 = " << match.track_as().phi(); + //LOG(info) << "tr phi1 = " << track.phi(); + //LOG(info) << "emc phi = " << emc_phi; + if(nmatch==0) + { + double dPhi = match.track_as().phi() - emc_phi; + double dEta = match.track_as().eta() - emc_eta; + + histos.fill(HIST("MatchPhiHistogram"),emc_phi,match.track_as().phi()); + histos.fill(HIST("MatchEtaHistogram"),emc_eta,match.track_as().eta()); + + double R = sqrt(pow(dPhi,2)+pow(dEta,2)); + if(R().p(); + //LOG(info) << "E/p" << eop; + histos.fill(HIST("EopNsigTPCHistogram"), match.track_as().tpcNSigmaEl(), eop); + histos.fill(HIST("M02Histogram"), match.track_as().tpcNSigmaEl(),emc_m02); + histos.fill(HIST("M20Histogram"), match.track_as().tpcNSigmaEl(),emc_m20); + if(match.track_as().tpcNSigmaEl()>-1.0 && match.track_as().tpcNSigmaEl()<3) + { + histos.fill(HIST("EopHistogram"), match.track_as().pt(), eop); + } + } + + + nmatch++; + } + } + + + if(Rmim<10.0) + { + //LOG(info) << "R mim = " << Rmim; + histos.fill(HIST("TrMatchHistogram_mim"), dPhi_mim, dEta_mim); + } + + + } // end of track loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From d838101b5ee3bcb21bbad6de0e70e7a621074f22 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:02:32 +0900 Subject: [PATCH 02/20] Update PWGHF/HFL/Tasks/CMakeLists.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/CMakeLists.txt b/PWGHF/HFL/Tasks/CMakeLists.txt index a0b41ab8cc8..6a7f2ce8ae2 100644 --- a/PWGHF/HFL/Tasks/CMakeLists.txt +++ b/PWGHF/HFL/Tasks/CMakeLists.txt @@ -9,7 +9,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(task-electron-weakboson +o2physics_add_dpl_workflow(task-electron-weak-boson SOURCES taskElectronWeakBoson.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) From ce7a53376685daac9a15185d433749b70db0a04f Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:03:00 +0900 Subject: [PATCH 03/20] Update PWGHF/HFL/Tasks/CMakeLists.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/CMakeLists.txt b/PWGHF/HFL/Tasks/CMakeLists.txt index 6a7f2ce8ae2..8a6c9ab4285 100644 --- a/PWGHF/HFL/Tasks/CMakeLists.txt +++ b/PWGHF/HFL/Tasks/CMakeLists.txt @@ -38,4 +38,3 @@ o2physics_add_dpl_workflow(task-single-muon-source SOURCES taskSingleMuonSource.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) - From 545edd4e53f369aee5a4337b7337b0819d4db4e6 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:11:37 +0900 Subject: [PATCH 04/20] Update PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index bd2ffbc58bd..27b11c615cf 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -31,7 +31,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using selectedClusters = o2::soa::Filtered; +using SelectedClusters = o2::soa::Filtered; // PbPb using TrackEle = o2::soa::Filtered>; From bfd618306c366a3bdf39a017be1e11cabbf2cc43 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:13:49 +0900 Subject: [PATCH 05/20] Update PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 27b11c615cf..6a580ceb19f 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -149,9 +149,9 @@ struct HfTaskElectronWeakBoson { histos.fill(HIST("ITS_NCls_Hist"), track.itsNCls()); histos.fill(HIST("TPC_NClsCrossedRows_Hist"), track.tpcNClsCrossedRows()); - if(TMath::Abs(track.eta())>0.6)continue; + if(std::abs(track.eta())>0.6)continue; if(track.tpcNClsCrossedRows()dcaxy_cut)continue; + if(std::abs(track.dcaXY())>dcaxy_cut)continue; if(track.itsChi2NCl() > itschi2_cut) continue; if(track.tpcChi2NCl() > tpcchi2_cut) continue; if (track.tpcNClsFound() < tpcNcl_cut) continue; From 7c9e17e9c6005686aedf6da1cd9852cddcaf1edc Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:19:36 +0900 Subject: [PATCH 06/20] Update taskElectronWeakBoson.cxx --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 6a580ceb19f..d79c262e3e2 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -8,10 +8,9 @@ // 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. -/// +/// \ file taskElectronWeakBoson.cxx /// \ task for WeakBoson (W/Z) based on electron in mid-rapidity -/// -/// \S. Sakai & S. Ito +/// \ author S. Sakai & S. Ito (Univ. of Tsukuba) #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" From a278ca4db601595b782a978dc2cfdfb36827ece0 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:24:16 +0900 Subject: [PATCH 07/20] Update taskElectronWeakBoson.cxx --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index d79c262e3e2..7c289874194 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -14,14 +14,17 @@ #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" + #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponse.h" -#include "Framework/ASoAHelpers.h" #include "EMCALBase/Geometry.h" #include "EMCALCalib/BadChannelMap.h" + #include "PWGJE/DataModel/EMCALClusters.h" + #include "DataFormatsEMCAL/Cell.h" #include "DataFormatsEMCAL/Constants.h" #include "DataFormatsEMCAL/AnalysisCluster.h" From e7a5c19a3ba23d137d187c43983956269e4484e0 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:26:41 +0900 Subject: [PATCH 08/20] Update taskElectronWeakBoson.cxx --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 7c289874194..fcb63c91488 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -36,10 +36,10 @@ using namespace o2::framework::expressions; using SelectedClusters = o2::soa::Filtered; // PbPb -using TrackEle = o2::soa::Filtered>; +using TrackEle = o2::soa::Filtered>; // pp -//using TrackEle = o2::soa::Filtered>; +//using TrackEle = o2::soa::Filtered>; struct HfTaskElectronWeakBoson { From 6a140b5e80e3a69f01cabfb7c8fc541893ae9157 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 15:28:46 +0900 Subject: [PATCH 09/20] Update taskElectronWeakBoson.cxx --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index fcb63c91488..002582b1acb 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -56,7 +56,7 @@ struct HfTaskElectronWeakBoson { Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); // track cuts - Filter filter_globalTr = requireGlobalTrackInFilter(); + Filter filter_globalTr = requireGlobalTrackInFilter(); Configurable etalow{"etalow", -0.6f, ""}; Configurable etaup{"etaup", 0.6f, ""}; From 2a52793666bcd2fe1efcbd6b4811e948e3edef0e Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 16:50:57 +0900 Subject: [PATCH 10/20] Update taskElectronWeakBoson.cxx --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 111 ++++++++++++---------- 1 file changed, 60 insertions(+), 51 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 002582b1acb..f182fea1bc8 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -39,7 +39,7 @@ using SelectedClusters = o2::soa::Filtered; using TrackEle = o2::soa::Filtered>; // pp -//using TrackEle = o2::soa::Filtered>; +// using TrackEle = o2::soa::Filtered>; struct HfTaskElectronWeakBoson { @@ -74,13 +74,13 @@ struct HfTaskElectronWeakBoson { // cluster cut Configurable mClusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; - Configurable minTime{"minTime", -25., "Minimum cluster time for time cut"}; - Configurable maxTime{"maxTime", +20., "Maximum cluster time for time cut"}; - Configurable minM02{"minM02", 0.1, "Minimum M02 for M02 cut"}; - Configurable maxM02{"maxM02", 0.9, "Maximum M02 for M02 cut"}; - Configurable minM20{"minM20", 0.1, "Minimum M20 for M20 cut"}; - Configurable maxM20{"maxM20", 0.6, "Maximum M20 for M20 cut"}; - Configurable MatchR_cut{"MatchR_cut", 0.1, "cluster - track matching cut"}; + Configurable minTime{"minTime", -25., "Minimum cluster time for time cut"}; + Configurable maxTime{"maxTime", +20., "Maximum cluster time for time cut"}; + Configurable minM02{"minM02", 0.1, "Minimum M02 for M02 cut"}; + Configurable maxM02{"maxM02", 0.9, "Maximum M02 for M02 cut"}; + Configurable minM20{"minM20", 0.1, "Minimum M20 for M20 cut"}; + Configurable maxM20{"maxM20", 0.6, "Maximum M20 for M20 cut"}; + Configurable MatchR_cut{"MatchR_cut", 0.1, "cluster - track matching cut"}; Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); @@ -130,15 +130,14 @@ struct HfTaskElectronWeakBoson { histos.add("EMCtimeHistogram", "EMCtimeHistogram", kTH1F, {axisEMCtime}); } - //void process(soa::Filtered::iterator const& collision, selectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) void process(soa::Filtered::iterator const& collision, selectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) { - histos.fill(HIST("hEventCounter"),0.5); + histos.fill(HIST("hEventCounter"), 0.5); - //LOGF(info, "Collision index : %d", collision.index()); - //LOGF(info, "Number of tracks: %d", tracks.size()); - //LOGF(info, "Number of clusters: %d", clusters.size()); - //LOGF(info, "Number of clusters: %d", emcClusters.size()); + // LOGF(info, "Collision index : %d", collision.index()); + // LOGF(info, "Number of tracks: %d", tracks.size()); + // LOGF(info, "Number of clusters: %d", clusters.size()); + // LOGF(info, "Number of clusters: %d", emcClusters.size()); histos.fill(HIST("ZvtxHistogram"), collision.posZ()); @@ -151,36 +150,46 @@ struct HfTaskElectronWeakBoson { histos.fill(HIST("ITS_NCls_Hist"), track.itsNCls()); histos.fill(HIST("TPC_NClsCrossedRows_Hist"), track.tpcNClsCrossedRows()); - if(std::abs(track.eta())>0.6)continue; - if(track.tpcNClsCrossedRows()dcaxy_cut)continue; - if(track.itsChi2NCl() > itschi2_cut) continue; - if(track.tpcChi2NCl() > tpcchi2_cut) continue; - if (track.tpcNClsFound() < tpcNcl_cut) continue; - if(track.itsNCls() 0.6) + continue; + if (track.tpcNClsCrossedRows() < tpcNclCr_cut) + continue; + if (std::abs(track.dcaXY()) > dcaxy_cut) + continue; + if (track.itsChi2NCl() > itschi2_cut) + continue; + if (track.tpcChi2NCl() > tpcchi2_cut) + continue; + if (track.tpcNClsFound() < tpcNcl_cut) + continue; + if (track.itsNCls() < itsNcl_cut) + continue; + if (track.pt() < mimpT_cut) + continue; histos.fill(HIST("ptHistogram"), track.pt()); - histos.fill(HIST("TPCElHistogram"), track.p(),track.tpcNSigmaEl()); + histos.fill(HIST("TPCElHistogram"), track.p(), track.tpcNSigmaEl()); // track - match - if(emcClusters.size()<1)continue; - if(track.phi()<1.39 || track.phi()>3.265)continue; - auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); + if (emcClusters.size() < 1) + continue; + if (track.phi() < 1.39 || track.phi() > 3.265) + continue; + auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); - //LOGF(info, "Number of matched track: %d", tracksofcluster.size()); + // LOGF(info, "Number of matched track: %d", tracksofcluster.size()); double Rmim = 999.9; double dPhi_mim = 999.9; double dEta_mim = 999.9; - if(tracksofcluster.size()>0) - { + if (tracksofcluster.size() > 0) { int nmatch = 0; - for(const auto& match : tracksofcluster) - { - if(match.emcalcluster_as().time()().time()>maxTime)continue; - if(match.emcalcluster_as().m02()().m02()>maxM02)continue; + for (const auto& match : tracksofcluster) { + if (match.emcalcluster_as().time() < minTime || match.emcalcluster_as().time() > maxTime) + continue; + if (match.emcalcluster_as().m02() < minM02 || match.emcalcluster_as().m02() > maxM02) + continue; double emc_m20 = match.emcalcluster_as().m20(); double emc_m02 = match.emcalcluster_as().m02(); @@ -188,19 +197,18 @@ struct HfTaskElectronWeakBoson { double emc_phi = match.emcalcluster_as().phi(); double emc_eta = match.emcalcluster_as().eta(); double emc_time = match.emcalcluster_as().time(); - //LOG(info) << "tr phi0 = " << match.track_as().phi(); - //LOG(info) << "tr phi1 = " << track.phi(); - //LOG(info) << "emc phi = " << emc_phi; - if(nmatch==0) - { + // LOG(info) << "tr phi0 = " << match.track_as().phi(); + // LOG(info) << "tr phi1 = " << track.phi(); + // LOG(info) << "emc phi = " << emc_phi; + if (nmatch==0) { double dPhi = match.track_as().phi() - emc_phi; double dEta = match.track_as().eta() - emc_eta; - histos.fill(HIST("MatchPhiHistogram"),emc_phi,match.track_as().phi()); - histos.fill(HIST("MatchEtaHistogram"),emc_eta,match.track_as().eta()); + histos.fill(HIST("MatchPhiHistogram"), emc_phi,match.track_as().phi()); + histos.fill(HIST("MatchEtaHistogram"), emc_eta,match.track_as().eta()); - double R = sqrt(pow(dPhi,2)+pow(dEta,2)); - if(R().p(); - //LOG(info) << "E/p" << eop; + double eop = emc_energy / match.track_as().p(); + // LOG(info) << "E/p" << eop; histos.fill(HIST("EopNsigTPCHistogram"), match.track_as().tpcNSigmaEl(), eop); - histos.fill(HIST("M02Histogram"), match.track_as().tpcNSigmaEl(),emc_m02); - histos.fill(HIST("M20Histogram"), match.track_as().tpcNSigmaEl(),emc_m20); - if(match.track_as().tpcNSigmaEl()>-1.0 && match.track_as().tpcNSigmaEl()<3) + histos.fill(HIST("M02Histogram"), match.track_as().tpcNSigmaEl(), emc_m02); + histos.fill(HIST("M20Histogram"), match.track_as().tpcNSigmaEl(), emc_m20); + if (match.track_as().tpcNSigmaEl() > -1.0 && match.track_as().tpcNSigmaEl() <3) { histos.fill(HIST("EopHistogram"), match.track_as().pt(), eop); } @@ -225,12 +234,12 @@ struct HfTaskElectronWeakBoson { nmatch++; } - } + } - if(Rmim<10.0) + if (Rmim < 10.0) { - //LOG(info) << "R mim = " << Rmim; + // LOG(info) << "R mim = " << Rmim; histos.fill(HIST("TrMatchHistogram_mim"), dPhi_mim, dEta_mim); } From 6f07ddc4dc0b7e144d8751a933c650d8fdc003d5 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 17:07:43 +0900 Subject: [PATCH 11/20] Update taskElectronWeakBoson.cxx --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index f182fea1bc8..78f5256fd9f 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -156,11 +156,11 @@ struct HfTaskElectronWeakBoson { continue; if (std::abs(track.dcaXY()) > dcaxy_cut) continue; - if (track.itsChi2NCl() > itschi2_cut) + if (track.itsChi2NCl() > itschi2_cut) continue; - if (track.tpcChi2NCl() > tpcchi2_cut) + if (track.tpcChi2NCl() > tpcchi2_cut) continue; - if (track.tpcNClsFound() < tpcNcl_cut) + if (track.tpcNClsFound() < tpcNcl_cut) continue; if (track.itsNCls() < itsNcl_cut) continue; @@ -170,7 +170,7 @@ struct HfTaskElectronWeakBoson { histos.fill(HIST("TPCElHistogram"), track.p(), track.tpcNSigmaEl()); // track - match - + if (emcClusters.size() < 1) continue; if (track.phi() < 1.39 || track.phi() > 3.265) @@ -230,8 +230,6 @@ struct HfTaskElectronWeakBoson { histos.fill(HIST("EopHistogram"), match.track_as().pt(), eop); } } - - nmatch++; } } From 335f04ce77b19d29a980fc9b6103bc6452da4547 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 6 Sep 2024 17:22:25 +0900 Subject: [PATCH 12/20] Update taskElectronWeakBoson.cxx --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 78f5256fd9f..c27599409c0 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -119,14 +119,14 @@ struct HfTaskElectronWeakBoson { histos.add("ptHistogram", "ptHistogram", kTH1F, {axisPt}); histos.add("TPCElHistogram", "TPCElHistogram", kTH2F, {{axisPt}, {axisNsigma}}); histos.add("EnergyHistogram", "EnergyHistogram", kTH1F, {axisE}); - histos.add("M02Histogram", "M02Histogram", kTH2F, {{axisNsigma},{axisM02}}); - histos.add("M20Histogram", "M20Histogram", kTH2F, {{axisNsigma},{axisM02}}); - histos.add("TrMatchHistogram", "TrMatchHistogram", kTH2F, {{axisdPhi},{axisdEta}}); - histos.add("TrMatchHistogram_mim", "TrMatchHistogram_mim", kTH2F, {{axisdPhi},{axisdEta}}); - histos.add("MatchPhiHistogram", "MatchPhiHistogram", kTH2F, {{axisPhi},{axisPhi}}); - histos.add("MatchEtaHistogram", "MatchEtaHistogram", kTH2F, {{axisEta},{axisEta}}); - histos.add("EopHistogram", "EopHistogram", kTH2F, {{axisPt},{axisEop}}); - histos.add("EopNsigTPCHistogram", "EopNsigTPCHistogram", kTH2F, {{axisNsigma},{axisEop}}); + histos.add("M02Histogram", "M02Histogram", kTH2F, {{axisNsigma}, {axisM02}}); + histos.add("M20Histogram", "M20Histogram", kTH2F, {{axisNsigma}, {axisM02}}); + histos.add("TrMatchHistogram", "TrMatchHistogram", kTH2F, {{axisdPhi}, {axisdEta}}); + histos.add("TrMatchHistogram_mim", "TrMatchHistogram_mim", kTH2F, {{axisdPhi}, {axisdEta}}); + histos.add("MatchPhiHistogram", "MatchPhiHistogram", kTH2F, {{axisPhi}, {axisPhi}}); + histos.add("MatchEtaHistogram", "MatchEtaHistogram", kTH2F, {{axisEta}, {axisEta}}); + histos.add("EopHistogram", "EopHistogram", kTH2F, {{axisPt}, {axisEop}}); + histos.add("EopNsigTPCHistogram", "EopNsigTPCHistogram", kTH2F, {{axisNsigma}, {axisEop}}); histos.add("EMCtimeHistogram", "EMCtimeHistogram", kTH1F, {axisEMCtime}); } @@ -200,12 +200,12 @@ struct HfTaskElectronWeakBoson { // LOG(info) << "tr phi0 = " << match.track_as().phi(); // LOG(info) << "tr phi1 = " << track.phi(); // LOG(info) << "emc phi = " << emc_phi; - if (nmatch==0) { + if (nmatch == 0) { double dPhi = match.track_as().phi() - emc_phi; double dEta = match.track_as().eta() - emc_eta; - histos.fill(HIST("MatchPhiHistogram"), emc_phi,match.track_as().phi()); - histos.fill(HIST("MatchEtaHistogram"), emc_eta,match.track_as().eta()); + histos.fill(HIST("MatchPhiHistogram"), emc_phi, match.track_as().phi()); + histos.fill(HIST("MatchEtaHistogram"), emc_eta, match.track_as().eta()); double R = sqrt(pow(dPhi, 2)+pow(dEta, 2)); if (R < Rmim) From a6875867b1dd8fe029455ae70d33beafe6fddadd Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Fri, 6 Sep 2024 20:04:23 +0900 Subject: [PATCH 13/20] fixed clang-format --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 158 +++++++++++----------- 1 file changed, 77 insertions(+), 81 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index c27599409c0..d396e56c0f4 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -8,9 +8,9 @@ // 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. -/// \ file taskElectronWeakBoson.cxx -/// \ task for WeakBoson (W/Z) based on electron in mid-rapidity -/// \ author S. Sakai & S. Ito (Univ. of Tsukuba) +/// \file taskElectronWeakNoson.cxx +/// \briff task for WeakBoson (W/Z) based on electron in mid-rapidity +/// \author S. Sakai & S. Ito (Univ. of Tsukuba) #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -23,25 +23,26 @@ #include "EMCALBase/Geometry.h" #include "EMCALCalib/BadChannelMap.h" -#include "PWGJE/DataModel/EMCALClusters.h" - #include "DataFormatsEMCAL/Cell.h" #include "DataFormatsEMCAL/Constants.h" #include "DataFormatsEMCAL/AnalysisCluster.h" +#include "PWGJE/DataModel/EMCALClusters.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using SelectedClusters = o2::soa::Filtered; -// PbPb -using TrackEle = o2::soa::Filtered>; +struct HfTaskElectronWeakBoson { + + using SelectedClusters = o2::soa::Filtered; -// pp -// using TrackEle = o2::soa::Filtered>; + // PbPb + using TrackEle = o2::soa::Filtered>; -struct HfTaskElectronWeakBoson { + // pp + // using TrackEle = o2::soa::Filtered>; Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; Preslice perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId; @@ -56,15 +57,9 @@ struct HfTaskElectronWeakBoson { Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); // track cuts - Filter filter_globalTr = requireGlobalTrackInFilter(); - Configurable etalow{"etalow", -0.6f, ""}; Configurable etaup{"etaup", 0.6f, ""}; - Filter etafilter = (aod::track::eta < etaup) && (aod::track::eta > etalow); - Configurable dcaxy_cut{"dcaxy_cut", 2.0f, ""}; - Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut); - Configurable mimpT_cut{"mimpT_cut", 3.0f, "minimum pT cut"}; Configurable itschi2_cut{"itschi2_cut", 15.0f, "its chi2 cut"}; Configurable tpcchi2_cut{"tpcchi2_cut", 4.0f, "tpc chi2 cut"}; @@ -72,8 +67,12 @@ struct HfTaskElectronWeakBoson { Configurable tpcNcl_cut{"tpcNcl_cut", 100.0f, "tpc # if cluster cut"}; Configurable tpcNclCr_cut{"tpcNclCr_cut", 100.0f, "tpc # of crossedRows cut"}; + Filter filter_globalTr = requireGlobalTrackInFilter(); + Filter etafilter = (aod::track::eta < etaup) && (aod::track::eta > etalow); + Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut); + // cluster cut - Configurable mClusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; + Configurable mClusterDefinition{"mClusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; Configurable minTime{"minTime", -25., "Minimum cluster time for time cut"}; Configurable maxTime{"maxTime", +20., "Maximum cluster time for time cut"}; Configurable minM02{"minM02", 0.1, "Minimum M02 for M02 cut"}; @@ -130,7 +129,8 @@ struct HfTaskElectronWeakBoson { histos.add("EMCtimeHistogram", "EMCtimeHistogram", kTH1F, {axisEMCtime}); } - void process(soa::Filtered::iterator const& collision, selectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) + // void process(soa::Filtered::iterator const& collision, SelectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) + void process(soa::Filtered::iterator const& collision, SelectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) { histos.fill(HIST("hEventCounter"), 0.5); @@ -141,7 +141,7 @@ struct HfTaskElectronWeakBoson { histos.fill(HIST("ZvtxHistogram"), collision.posZ()); - for (auto& track : tracks) { + for (const auto& track : tracks) { histos.fill(HIST("etaHistogram"), track.eta()); histos.fill(HIST("ITS_Chi2_Hist"), track.itsChi2NCl()); @@ -150,7 +150,7 @@ struct HfTaskElectronWeakBoson { histos.fill(HIST("ITS_NCls_Hist"), track.itsNCls()); histos.fill(HIST("TPC_NClsCrossedRows_Hist"), track.tpcNClsCrossedRows()); - if (std::abs(track.eta()) > 0.6) + if (std::abs(track.eta()) > etaup) continue; if (track.tpcNClsCrossedRows() < tpcNclCr_cut) continue; @@ -172,9 +172,9 @@ struct HfTaskElectronWeakBoson { // track - match if (emcClusters.size() < 1) - continue; - if (track.phi() < 1.39 || track.phi() > 3.265) - continue; + continue; + if (track.phi() < 1.39 || track.phi() > 3.15) + continue; auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); // LOGF(info, "Number of matched track: %d", tracksofcluster.size()); @@ -184,63 +184,59 @@ struct HfTaskElectronWeakBoson { double dEta_mim = 999.9; if (tracksofcluster.size() > 0) { - int nmatch = 0; - for (const auto& match : tracksofcluster) { - if (match.emcalcluster_as().time() < minTime || match.emcalcluster_as().time() > maxTime) - continue; - if (match.emcalcluster_as().m02() < minM02 || match.emcalcluster_as().m02() > maxM02) - continue; - - double emc_m20 = match.emcalcluster_as().m20(); - double emc_m02 = match.emcalcluster_as().m02(); - double emc_energy = match.emcalcluster_as().energy(); - double emc_phi = match.emcalcluster_as().phi(); - double emc_eta = match.emcalcluster_as().eta(); - double emc_time = match.emcalcluster_as().time(); - // LOG(info) << "tr phi0 = " << match.track_as().phi(); - // LOG(info) << "tr phi1 = " << track.phi(); - // LOG(info) << "emc phi = " << emc_phi; - if (nmatch == 0) { - double dPhi = match.track_as().phi() - emc_phi; - double dEta = match.track_as().eta() - emc_eta; - - histos.fill(HIST("MatchPhiHistogram"), emc_phi, match.track_as().phi()); - histos.fill(HIST("MatchEtaHistogram"), emc_eta, match.track_as().eta()); - - double R = sqrt(pow(dPhi, 2)+pow(dEta, 2)); - if (R < Rmim) - { - Rmim = R; - dPhi_mim = dPhi; - dEta_mim = dEta; - } - histos.fill(HIST("TrMatchHistogram"), dPhi, dEta); - histos.fill(HIST("EMCtimeHistogram"), emc_time); - - if (R < MatchR_cut) - continue; - - double eop = emc_energy / match.track_as().p(); - // LOG(info) << "E/p" << eop; - histos.fill(HIST("EopNsigTPCHistogram"), match.track_as().tpcNSigmaEl(), eop); - histos.fill(HIST("M02Histogram"), match.track_as().tpcNSigmaEl(), emc_m02); - histos.fill(HIST("M20Histogram"), match.track_as().tpcNSigmaEl(), emc_m20); - if (match.track_as().tpcNSigmaEl() > -1.0 && match.track_as().tpcNSigmaEl() <3) - { - histos.fill(HIST("EopHistogram"), match.track_as().pt(), eop); - } - } - nmatch++; - } - } - - - if (Rmim < 10.0) - { - // LOG(info) << "R mim = " << Rmim; - histos.fill(HIST("TrMatchHistogram_mim"), dPhi_mim, dEta_mim); - } - + int nmatch = 0; + for (const auto& match : tracksofcluster) { + if (match.emcalcluster_as().time() < minTime || match.emcalcluster_as().time() > maxTime) + continue; + if (match.emcalcluster_as().m02() < minM02 || match.emcalcluster_as().m02() > maxM02) + continue; + + double emc_m20 = match.emcalcluster_as().m20(); + double emc_m02 = match.emcalcluster_as().m02(); + double emc_energy = match.emcalcluster_as().energy(); + double emc_phi = match.emcalcluster_as().phi(); + double emc_eta = match.emcalcluster_as().eta(); + double emc_time = match.emcalcluster_as().time(); + // LOG(info) << "tr phi0 = " << match.track_as().phi(); + // LOG(info) << "tr phi1 = " << track.phi(); + // LOG(info) << "emc phi = " << emc_phi; + if (nmatch == 0) { + double dPhi = match.track_as().phi() - emc_phi; + double dEta = match.track_as().eta() - emc_eta; + + histos.fill(HIST("MatchPhiHistogram"), emc_phi, match.track_as().phi()); + histos.fill(HIST("MatchEtaHistogram"), emc_eta, match.track_as().eta()); + + double R = sqrt(pow(dPhi, 2) + pow(dEta, 2)); + if (R < Rmim) { + Rmim = R; + dPhi_mim = dPhi; + dEta_mim = dEta; + } + histos.fill(HIST("TrMatchHistogram"), dPhi, dEta); + histos.fill(HIST("EMCtimeHistogram"), emc_time); + + if (R < MatchR_cut) + continue; + + double eop = emc_energy / match.track_as().p(); + // LOG(info) << "E/p" << eop; + histos.fill(HIST("EopNsigTPCHistogram"), match.track_as().tpcNSigmaEl(), eop); + histos.fill(HIST("M02Histogram"), match.track_as().tpcNSigmaEl(), emc_m02); + histos.fill(HIST("M20Histogram"), match.track_as().tpcNSigmaEl(), emc_m20); + if (match.track_as().tpcNSigmaEl() > -1.0 && match.track_as().tpcNSigmaEl() < 3) { + histos.fill(HIST("EopHistogram"), match.track_as().pt(), eop); + } + } + + nmatch++; + } + } + + if (Rmim < 10.0) { + // LOG(info) << "R mim = " << Rmim; + histos.fill(HIST("TrMatchHistogram_mim"), dPhi_mim, dEta_mim); + } } // end of track loop } From 2e7045fc1617cd365ff1392c52133e48390a0b07 Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Fri, 6 Sep 2024 21:27:11 +0900 Subject: [PATCH 14/20] PWGHF Apply clang-format fixes --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index d396e56c0f4..2e21474d357 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -33,7 +33,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; - struct HfTaskElectronWeakBoson { using SelectedClusters = o2::soa::Filtered; From 47aeff1e56d14d3bb90b178dbf00f04dc884e584 Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Mon, 9 Sep 2024 13:31:14 +0900 Subject: [PATCH 15/20] PWGHF modified task by comments --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 178 ++++++++++++---------- 1 file changed, 96 insertions(+), 82 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 2e21474d357..9924f53a238 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -8,8 +8,9 @@ // 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. -/// \file taskElectronWeakNoson.cxx -/// \briff task for WeakBoson (W/Z) based on electron in mid-rapidity + +/// \file taskElectronWeakBoson.cxx +/// \brief task for WeakBoson (W/Z) based on electron in mid-rapidity /// \author S. Sakai & S. Ito (Univ. of Tsukuba) #include "Framework/runDataProcessing.h" @@ -43,47 +44,54 @@ struct HfTaskElectronWeakBoson { // pp // using TrackEle = o2::soa::Filtered>; - Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; - Preslice perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId; - PresliceUnsorted perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId; + // configurable parameters + Configurable nBinsPt{"nBinsPt", 100, "N bins in pt registry"}; + Configurable BinPtmax{"BinPtmax", 100.0, "maximum pt registry"}; + Configurable nBinsE{"nBinsE", 100, "N bins in E registry"}; + Configurable BinEmax{"BinEmax", 100.0, "maximum E registry"}; - Configurable nBinsPt{"nBinsPt", 100, "N bins in pt histo"}; - Configurable nBinsE{"nBinsE", 100, "N bins in E histo"}; - - // event filter - Filter eventFilter = (o2::aod::evsel::sel8 == true); Configurable vtxZ{"vtxZ", 10.f, ""}; - Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); - // track cuts - Configurable etalow{"etalow", -0.6f, ""}; - Configurable etaup{"etaup", 0.6f, ""}; - Configurable dcaxy_cut{"dcaxy_cut", 2.0f, ""}; - Configurable mimpT_cut{"mimpT_cut", 3.0f, "minimum pT cut"}; + Configurable etalow_cut{"etalow_cut", -0.6f, "eta lower cut"}; + Configurable etaup_cut{"etaup_cut", 0.6f, "eta upper cut"}; + Configurable dcaxy_cut{"dcaxy_cut", 2.0f, "dca xy cut"}; Configurable itschi2_cut{"itschi2_cut", 15.0f, "its chi2 cut"}; + Configurable mimpT_cut{"mimpT_cut", 3.0f, "minimum pT cut"}; Configurable tpcchi2_cut{"tpcchi2_cut", 4.0f, "tpc chi2 cut"}; Configurable itsNcl_cut{"itsNcl_cut", 2.0f, "its # of cluster cut"}; Configurable tpcNcl_cut{"tpcNcl_cut", 100.0f, "tpc # if cluster cut"}; Configurable tpcNclCr_cut{"tpcNclCr_cut", 100.0f, "tpc # of crossedRows cut"}; + Configurable tpcNsiglow_cut{"tpcNsiglow_cut", -1.0, "tpc Nsig lower cut"}; + Configurable tpcNsigup_cut{"tpcNsigup_cut", 3.0, "tpc Nsig upper cut"}; - Filter filter_globalTr = requireGlobalTrackInFilter(); - Filter etafilter = (aod::track::eta < etaup) && (aod::track::eta > etalow); - Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut); - - // cluster cut + Configurable emcacc_phimin{"emcacc_phimin", 1.39, "Maximum M20"}; + Configurable emcacc_phimax{"emcacc_phimax", 3.36, "Maximum M20"}; Configurable mClusterDefinition{"mClusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; - Configurable minTime{"minTime", -25., "Minimum cluster time for time cut"}; - Configurable maxTime{"maxTime", +20., "Maximum cluster time for time cut"}; - Configurable minM02{"minM02", 0.1, "Minimum M02 for M02 cut"}; - Configurable maxM02{"maxM02", 0.9, "Maximum M02 for M02 cut"}; - Configurable minM20{"minM20", 0.1, "Minimum M20 for M20 cut"}; - Configurable maxM20{"maxM20", 0.6, "Maximum M20 for M20 cut"}; + Configurable minTime{"minTime", -25., "Minimum cluster time"}; + Configurable maxTime{"maxTime", +20., "Maximum cluster time"}; + Configurable minM02{"minM02", 0.1, "Minimum M02"}; + Configurable maxM02{"maxM02", 0.9, "Maximum M02"}; + Configurable minM20{"minM20", 0.1, "Minimum M20"}; + Configurable maxM20{"maxM20", 0.6, "Maximum M20"}; Configurable MatchR_cut{"MatchR_cut", 0.1, "cluster - track matching cut"}; + // Filter + Filter eventFilter = (o2::aod::evsel::sel8 == true); + Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); + + Filter etafilter = (aod::track::eta < etaup_cut) && (aod::track::eta > etalow_cut); + Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut); + Filter filter_globalTr = requireGlobalTrackInFilter(); + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); - // Histogram registry: an object to hold your histograms - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // Data Handling Objects + Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; + Preslice perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId; + PresliceUnsorted perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId; + + // Histogram registry: an object to hold your registrygrams + HistogramRegistry registry{"registry"}; void init(InitContext const&) { @@ -92,9 +100,9 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisZvtx{400, -20, 20, "Zvtx"}; const AxisSpec axisCounter{1, 0, 1, "events"}; const AxisSpec axisEta{200, -1.0, 1.0, "#eta"}; - const AxisSpec axisPt{nBinsPt, 0, 10, "p_{T}"}; + const AxisSpec axisPt{nBinsPt, 0, BinPtmax, "p_{T}"}; const AxisSpec axisNsigma{100, -5, 5, "N#sigma"}; - const AxisSpec axisE{nBinsE, 0, 10, "Energy"}; + const AxisSpec axisE{nBinsE, 0, BinEmax, "Energy"}; const AxisSpec axisM02{100, 0, 1, "M02"}; const AxisSpec axisdPhi{200, -1, 1, "dPhi"}; const AxisSpec axisdEta{200, -1, 1, "dEta"}; @@ -105,51 +113,51 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisITSNCls{20, 0.0, 20, "counts"}; const AxisSpec axisEMCtime{200, -100.0, 100, "EMC time"}; - // create histograms - histos.add("ZvtxHistogram", "ZvtxHistogram", kTH1F, {axisZvtx}); - histos.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter}); - histos.add("ITS_Chi2_Hist", "ITS #chi^{2} Hist", kTH1F, {axisChi2}); - histos.add("TPC_Chi2_Hist", "TPC #chi^{2} Hist", kTH1F, {axisChi2}); - histos.add("TPC_NCls_Hist", "TPC_NCls_Hist", kTH1F, {axisCluster}); - histos.add("ITS_NCls_Hist", "ITS_NCls_Hist", kTH1F, {axisITSNCls}); - histos.add("TPC_NClsCrossedRows_Hist", "TPC_NClsCrossedRows_Hist", kTH1F, {axisCluster}); - histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); - histos.add("ptHistogram", "ptHistogram", kTH1F, {axisPt}); - histos.add("TPCElHistogram", "TPCElHistogram", kTH2F, {{axisPt}, {axisNsigma}}); - histos.add("EnergyHistogram", "EnergyHistogram", kTH1F, {axisE}); - histos.add("M02Histogram", "M02Histogram", kTH2F, {{axisNsigma}, {axisM02}}); - histos.add("M20Histogram", "M20Histogram", kTH2F, {{axisNsigma}, {axisM02}}); - histos.add("TrMatchHistogram", "TrMatchHistogram", kTH2F, {{axisdPhi}, {axisdEta}}); - histos.add("TrMatchHistogram_mim", "TrMatchHistogram_mim", kTH2F, {{axisdPhi}, {axisdEta}}); - histos.add("MatchPhiHistogram", "MatchPhiHistogram", kTH2F, {{axisPhi}, {axisPhi}}); - histos.add("MatchEtaHistogram", "MatchEtaHistogram", kTH2F, {{axisEta}, {axisEta}}); - histos.add("EopHistogram", "EopHistogram", kTH2F, {{axisPt}, {axisEop}}); - histos.add("EopNsigTPCHistogram", "EopNsigTPCHistogram", kTH2F, {{axisNsigma}, {axisEop}}); - histos.add("EMCtimeHistogram", "EMCtimeHistogram", kTH1F, {axisEMCtime}); + // create registrygrams + registry.add("hZvtx", "Z vertex", kTH1F, {axisZvtx}); + registry.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter}); + registry.add("hITS_Chi2", "ITS #chi^{2}", kTH1F, {axisChi2}); + registry.add("hTPC_Chi2", "TPC #chi^{2}", kTH1F, {axisChi2}); + registry.add("hTPC_NCls", "TPC NCls", kTH1F, {axisCluster}); + registry.add("hITS_NCls", "ITS NCls", kTH1F, {axisITSNCls}); + registry.add("hTPC_NClsCrossedRows", "TPC NClsCrossedRows", kTH1F, {axisCluster}); + registry.add("hEta", "track eta", kTH1F, {axisEta}); + registry.add("hPt", "track pt", kTH1F, {axisPt}); + registry.add("hTPCNsigma", "TPC electron Nsigma", kTH2F, {{axisPt}, {axisNsigma}}); + registry.add("hEnergy", "EMC cluster energy", kTH1F, {axisE}); + registry.add("hM02", "EMC M02", kTH2F, {{axisNsigma}, {axisM02}}); + registry.add("hM20", "EMC M20", kTH2F, {{axisNsigma}, {axisM02}}); + registry.add("hTrMatch", "Track EMC Match", kTH2F, {{axisdPhi}, {axisdEta}}); + registry.add("hTrMatch_mim", "Track EMC Match minimu minimumm", kTH2F, {{axisdPhi}, {axisdEta}}); + registry.add("hMatchPhi", "Match in Phi", kTH2F, {{axisPhi}, {axisPhi}}); + registry.add("hMatchEta", "Match in Eta", kTH2F, {{axisEta}, {axisEta}}); + registry.add("hEop", "energy momentum match", kTH2F, {{axisPt}, {axisEop}}); + registry.add("hEopNsigTPC", "Eop vs. Nsigma", kTH2F, {{axisNsigma}, {axisEop}}); + registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime}); } // void process(soa::Filtered::iterator const& collision, SelectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) void process(soa::Filtered::iterator const& collision, SelectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) { - histos.fill(HIST("hEventCounter"), 0.5); + registry.fill(HIST("hEventCounter"), 0.5); // LOGF(info, "Collision index : %d", collision.index()); // LOGF(info, "Number of tracks: %d", tracks.size()); // LOGF(info, "Number of clusters: %d", clusters.size()); // LOGF(info, "Number of clusters: %d", emcClusters.size()); - histos.fill(HIST("ZvtxHistogram"), collision.posZ()); + registry.fill(HIST("hZvtx"), collision.posZ()); for (const auto& track : tracks) { - histos.fill(HIST("etaHistogram"), track.eta()); - histos.fill(HIST("ITS_Chi2_Hist"), track.itsChi2NCl()); - histos.fill(HIST("TPC_Chi2_Hist"), track.tpcChi2NCl()); - histos.fill(HIST("TPC_NCls_Hist"), track.tpcNClsFound()); - histos.fill(HIST("ITS_NCls_Hist"), track.itsNCls()); - histos.fill(HIST("TPC_NClsCrossedRows_Hist"), track.tpcNClsCrossedRows()); + registry.fill(HIST("hEta"), track.eta()); + registry.fill(HIST("hITS_Chi2"), track.itsChi2NCl()); + registry.fill(HIST("hTPC_Chi2"), track.tpcChi2NCl()); + registry.fill(HIST("hTPC_NCls"), track.tpcNClsFound()); + registry.fill(HIST("hITS_NCls"), track.itsNCls()); + registry.fill(HIST("hTPC_NClsCrossedRows"), track.tpcNClsCrossedRows()); - if (std::abs(track.eta()) > etaup) + if (std::abs(track.eta()) > etaup_cut) continue; if (track.tpcNClsCrossedRows() < tpcNclCr_cut) continue; @@ -165,14 +173,14 @@ struct HfTaskElectronWeakBoson { continue; if (track.pt() < mimpT_cut) continue; - histos.fill(HIST("ptHistogram"), track.pt()); - histos.fill(HIST("TPCElHistogram"), track.p(), track.tpcNSigmaEl()); + registry.fill(HIST("hPt"), track.pt()); + registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl()); // track - match - if (emcClusters.size() < 1) + if (!emcClusters.size()) continue; - if (track.phi() < 1.39 || track.phi() > 3.15) + if (track.phi() < emcacc_phimin || track.phi() > emcacc_phimax) continue; auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); @@ -182,7 +190,7 @@ struct HfTaskElectronWeakBoson { double dPhi_mim = 999.9; double dEta_mim = 999.9; - if (tracksofcluster.size() > 0) { + if (tracksofcluster.size()) { int nmatch = 0; for (const auto& match : tracksofcluster) { if (match.emcalcluster_as().time() < minTime || match.emcalcluster_as().time() > maxTime) @@ -190,9 +198,9 @@ struct HfTaskElectronWeakBoson { if (match.emcalcluster_as().m02() < minM02 || match.emcalcluster_as().m02() > maxM02) continue; - double emc_m20 = match.emcalcluster_as().m20(); - double emc_m02 = match.emcalcluster_as().m02(); - double emc_energy = match.emcalcluster_as().energy(); + float emc_m20 = match.emcalcluster_as().m20(); + float emc_m02 = match.emcalcluster_as().m02(); + float emc_energy = match.emcalcluster_as().energy(); double emc_phi = match.emcalcluster_as().phi(); double emc_eta = match.emcalcluster_as().eta(); double emc_time = match.emcalcluster_as().time(); @@ -200,31 +208,37 @@ struct HfTaskElectronWeakBoson { // LOG(info) << "tr phi1 = " << track.phi(); // LOG(info) << "emc phi = " << emc_phi; if (nmatch == 0) { - double dPhi = match.track_as().phi() - emc_phi; double dEta = match.track_as().eta() - emc_eta; + double dPhi = match.track_as().phi() - emc_phi; + if (dPhi > o2::constants::math::PI) { + dPhi -= 2 * o2::constants::math::PI; + } else if (dPhi < -o2::constants::math::PI) { + dPhi += 2 * o2::constants::math::PI; + } - histos.fill(HIST("MatchPhiHistogram"), emc_phi, match.track_as().phi()); - histos.fill(HIST("MatchEtaHistogram"), emc_eta, match.track_as().eta()); + registry.fill(HIST("hMatchPhi"), emc_phi, match.track_as().phi()); + registry.fill(HIST("hMatchEta"), emc_eta, match.track_as().eta()); - double R = sqrt(pow(dPhi, 2) + pow(dEta, 2)); + double R = std::sqrt(std::pow(dPhi, 2) + std::pow(dEta, 2)); if (R < Rmim) { Rmim = R; dPhi_mim = dPhi; dEta_mim = dEta; } - histos.fill(HIST("TrMatchHistogram"), dPhi, dEta); - histos.fill(HIST("EMCtimeHistogram"), emc_time); + registry.fill(HIST("hTrMatch"), dPhi, dEta); + registry.fill(HIST("hEMCtime"), emc_time); + registry.fill(HIST("hEnergy"), emc_energy); if (R < MatchR_cut) continue; double eop = emc_energy / match.track_as().p(); // LOG(info) << "E/p" << eop; - histos.fill(HIST("EopNsigTPCHistogram"), match.track_as().tpcNSigmaEl(), eop); - histos.fill(HIST("M02Histogram"), match.track_as().tpcNSigmaEl(), emc_m02); - histos.fill(HIST("M20Histogram"), match.track_as().tpcNSigmaEl(), emc_m20); - if (match.track_as().tpcNSigmaEl() > -1.0 && match.track_as().tpcNSigmaEl() < 3) { - histos.fill(HIST("EopHistogram"), match.track_as().pt(), eop); + registry.fill(HIST("hEopNsigTPC"), match.track_as().tpcNSigmaEl(), eop); + registry.fill(HIST("hM02"), match.track_as().tpcNSigmaEl(), emc_m02); + registry.fill(HIST("hM20"), match.track_as().tpcNSigmaEl(), emc_m20); + if (match.track_as().tpcNSigmaEl() > tpcNsiglow_cut && match.track_as().tpcNSigmaEl() < tpcNsigup_cut) { + registry.fill(HIST("hEop"), match.track_as().pt(), eop); } } @@ -232,9 +246,9 @@ struct HfTaskElectronWeakBoson { } } - if (Rmim < 10.0) { + if (Rmim < MatchR_cut) { // LOG(info) << "R mim = " << Rmim; - histos.fill(HIST("TrMatchHistogram_mim"), dPhi_mim, dEta_mim); + registry.fill(HIST("hTrMatch_mim"), dPhi_mim, dEta_mim); } } // end of track loop From 60041bce40ef34b1ac2deae5f5cb4b709806e3ed Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Thu, 19 Sep 2024 16:16:51 +0900 Subject: [PATCH 16/20] PWGHF fixing naming convention --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 91 +++++++++++------------ 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 9924f53a238..fb6e8b3a0d4 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -36,10 +36,10 @@ using namespace o2::framework::expressions; struct HfTaskElectronWeakBoson { - using SelectedClusters = o2::soa::Filtered; + using SelectedClusters = o2::aod::EMCALClusters; // PbPb - using TrackEle = o2::soa::Filtered>; + using TrackEle = o2::soa::Join; // pp // using TrackEle = o2::soa::Filtered>; @@ -52,38 +52,38 @@ struct HfTaskElectronWeakBoson { Configurable vtxZ{"vtxZ", 10.f, ""}; - Configurable etalow_cut{"etalow_cut", -0.6f, "eta lower cut"}; - Configurable etaup_cut{"etaup_cut", 0.6f, "eta upper cut"}; - Configurable dcaxy_cut{"dcaxy_cut", 2.0f, "dca xy cut"}; - Configurable itschi2_cut{"itschi2_cut", 15.0f, "its chi2 cut"}; - Configurable mimpT_cut{"mimpT_cut", 3.0f, "minimum pT cut"}; - Configurable tpcchi2_cut{"tpcchi2_cut", 4.0f, "tpc chi2 cut"}; - Configurable itsNcl_cut{"itsNcl_cut", 2.0f, "its # of cluster cut"}; - Configurable tpcNcl_cut{"tpcNcl_cut", 100.0f, "tpc # if cluster cut"}; - Configurable tpcNclCr_cut{"tpcNclCr_cut", 100.0f, "tpc # of crossedRows cut"}; - Configurable tpcNsiglow_cut{"tpcNsiglow_cut", -1.0, "tpc Nsig lower cut"}; - Configurable tpcNsigup_cut{"tpcNsigup_cut", 3.0, "tpc Nsig upper cut"}; - - Configurable emcacc_phimin{"emcacc_phimin", 1.39, "Maximum M20"}; - Configurable emcacc_phimax{"emcacc_phimax", 3.36, "Maximum M20"}; - Configurable mClusterDefinition{"mClusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; + Configurable etalowCut{"etalowCut", -0.6f, "eta lower cut"}; + Configurable etaupCut{"etaupCut", 0.6f, "eta upper cut"}; + Configurable dcaxyCut{"dcaxyCut", 2.0f, "dca xy cut"}; + Configurable itschi2Cut{"itschi2Cut", 15.0f, "its chi2 cut"}; + Configurable mimpTCut{"mimpTCut", 3.0f, "minimum pT cut"}; + Configurable tpcchi2Cut{"tpcchi2Cut", 4.0f, "tpc chi2 cut"}; + Configurable itsNclCut{"itsNclCut", 2.0f, "its # of cluster cut"}; + Configurable tpcNclCut{"tpcNclCut", 100.0f, "tpc # if cluster cut"}; + Configurable tpcNclCrCut{"tpcNclCrCut", 100.0f, "tpc # of crossedRows cut"}; + Configurable tpcNsiglowCut{"tpcNsiglowCut", -1.0, "tpc Nsig lower cut"}; + Configurable tpcNsigupCut{"tpcNsigupCut", 3.0, "tpc Nsig upper cut"}; + + Configurable emcaccPhimin{"emcaccPhimin", 1.39, "Maximum M20"}; + Configurable emcaccPhimax{"emcaccPhimax", 3.36, "Maximum M20"}; + Configurable ClusterDefinition{"ClusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; Configurable minTime{"minTime", -25., "Minimum cluster time"}; Configurable maxTime{"maxTime", +20., "Maximum cluster time"}; Configurable minM02{"minM02", 0.1, "Minimum M02"}; Configurable maxM02{"maxM02", 0.9, "Maximum M02"}; Configurable minM20{"minM20", 0.1, "Minimum M20"}; Configurable maxM20{"maxM20", 0.6, "Maximum M20"}; - Configurable MatchR_cut{"MatchR_cut", 0.1, "cluster - track matching cut"}; + Configurable MatchRCut{"MatchRCut", 0.1, "cluster - track matching cut"}; // Filter Filter eventFilter = (o2::aod::evsel::sel8 == true); Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); - Filter etafilter = (aod::track::eta < etaup_cut) && (aod::track::eta > etalow_cut); - Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxy_cut); + Filter etafilter = (aod::track::eta < etaupCut) && (aod::track::eta > etalowCut); + Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxyCut); Filter filter_globalTr = requireGlobalTrackInFilter(); - Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == ClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); // Data Handling Objects Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; @@ -116,11 +116,11 @@ struct HfTaskElectronWeakBoson { // create registrygrams registry.add("hZvtx", "Z vertex", kTH1F, {axisZvtx}); registry.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter}); - registry.add("hITS_Chi2", "ITS #chi^{2}", kTH1F, {axisChi2}); - registry.add("hTPC_Chi2", "TPC #chi^{2}", kTH1F, {axisChi2}); - registry.add("hTPC_NCls", "TPC NCls", kTH1F, {axisCluster}); - registry.add("hITS_NCls", "ITS NCls", kTH1F, {axisITSNCls}); - registry.add("hTPC_NClsCrossedRows", "TPC NClsCrossedRows", kTH1F, {axisCluster}); + registry.add("hITSchi2", "ITS #chi^{2}", kTH1F, {axisChi2}); + registry.add("hTPCchi2", "TPC #chi^{2}", kTH1F, {axisChi2}); + registry.add("hTPCnCls", "TPC NCls", kTH1F, {axisCluster}); + registry.add("hITSnCls", "ITS NCls", kTH1F, {axisITSNCls}); + registry.add("hTPCnClsCrossedRows", "TPC NClsCrossedRows", kTH1F, {axisCluster}); registry.add("hEta", "track eta", kTH1F, {axisEta}); registry.add("hPt", "track pt", kTH1F, {axisPt}); registry.add("hTPCNsigma", "TPC electron Nsigma", kTH2F, {{axisPt}, {axisNsigma}}); @@ -138,49 +138,48 @@ struct HfTaskElectronWeakBoson { // void process(soa::Filtered::iterator const& collision, SelectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) void process(soa::Filtered::iterator const& collision, SelectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) + // void process(soa::Filtered::iterator const& collision, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) { registry.fill(HIST("hEventCounter"), 0.5); // LOGF(info, "Collision index : %d", collision.index()); // LOGF(info, "Number of tracks: %d", tracks.size()); // LOGF(info, "Number of clusters: %d", clusters.size()); - // LOGF(info, "Number of clusters: %d", emcClusters.size()); registry.fill(HIST("hZvtx"), collision.posZ()); for (const auto& track : tracks) { registry.fill(HIST("hEta"), track.eta()); - registry.fill(HIST("hITS_Chi2"), track.itsChi2NCl()); - registry.fill(HIST("hTPC_Chi2"), track.tpcChi2NCl()); - registry.fill(HIST("hTPC_NCls"), track.tpcNClsFound()); - registry.fill(HIST("hITS_NCls"), track.itsNCls()); - registry.fill(HIST("hTPC_NClsCrossedRows"), track.tpcNClsCrossedRows()); + registry.fill(HIST("hITSchi2"), track.itsChi2NCl()); + registry.fill(HIST("hTPCchi2"), track.tpcChi2NCl()); + registry.fill(HIST("hTPCnCls"), track.tpcNClsFound()); + registry.fill(HIST("hITSnCls"), track.itsNCls()); + registry.fill(HIST("hTPCnClsCrossedRows"), track.tpcNClsCrossedRows()); - if (std::abs(track.eta()) > etaup_cut) + if (std::abs(track.eta()) > etaupCut) continue; - if (track.tpcNClsCrossedRows() < tpcNclCr_cut) + if (track.tpcNClsCrossedRows() < tpcNclCrCut) continue; - if (std::abs(track.dcaXY()) > dcaxy_cut) + if (std::abs(track.dcaXY()) > dcaxyCut) continue; - if (track.itsChi2NCl() > itschi2_cut) + if (track.itsChi2NCl() > itschi2Cut) continue; - if (track.tpcChi2NCl() > tpcchi2_cut) + if (track.tpcChi2NCl() > tpcchi2Cut) continue; - if (track.tpcNClsFound() < tpcNcl_cut) + if (track.tpcNClsFound() < tpcNclCut) continue; - if (track.itsNCls() < itsNcl_cut) + if (track.itsNCls() < itsNclCut) continue; - if (track.pt() < mimpT_cut) + if (track.pt() < mimpTCut) continue; registry.fill(HIST("hPt"), track.pt()); registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl()); // track - match - if (!emcClusters.size()) - continue; - if (track.phi() < emcacc_phimin || track.phi() > emcacc_phimax) + // continue; + if (track.phi() < emcaccPhimin || track.phi() > emcaccPhimax) continue; auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); @@ -229,7 +228,7 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hEMCtime"), emc_time); registry.fill(HIST("hEnergy"), emc_energy); - if (R < MatchR_cut) + if (R < MatchRCut) continue; double eop = emc_energy / match.track_as().p(); @@ -237,7 +236,7 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hEopNsigTPC"), match.track_as().tpcNSigmaEl(), eop); registry.fill(HIST("hM02"), match.track_as().tpcNSigmaEl(), emc_m02); registry.fill(HIST("hM20"), match.track_as().tpcNSigmaEl(), emc_m20); - if (match.track_as().tpcNSigmaEl() > tpcNsiglow_cut && match.track_as().tpcNSigmaEl() < tpcNsigup_cut) { + if (match.track_as().tpcNSigmaEl() > tpcNsiglowCut && match.track_as().tpcNSigmaEl() < tpcNsigupCut) { registry.fill(HIST("hEop"), match.track_as().pt(), eop); } } @@ -246,7 +245,7 @@ struct HfTaskElectronWeakBoson { } } - if (Rmim < MatchR_cut) { + if (Rmim < MatchRCut) { // LOG(info) << "R mim = " << Rmim; registry.fill(HIST("hTrMatch_mim"), dPhi_mim, dEta_mim); } From ba2a45f8344f7d337793fe1bcabf3edebaa4173c Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Fri, 20 Sep 2024 16:15:29 +0900 Subject: [PATCH 17/20] PWGHF remove specific version of a table --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index fb6e8b3a0d4..5f6ee927cf7 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -39,7 +39,7 @@ struct HfTaskElectronWeakBoson { using SelectedClusters = o2::aod::EMCALClusters; // PbPb - using TrackEle = o2::soa::Join; + using TrackEle = o2::soa::Join; // pp // using TrackEle = o2::soa::Filtered>; From dfe033afab318532edd176edcc5d3d90f7b5cb0c Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Mon, 30 Sep 2024 17:25:15 +0900 Subject: [PATCH 18/20] PWGHF updated by following coding develop guidelines --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 152 +++++++++++----------- 1 file changed, 75 insertions(+), 77 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 5f6ee927cf7..440b2838922 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -17,10 +17,6 @@ #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" - #include "EMCALBase/Geometry.h" #include "EMCALCalib/BadChannelMap.h" @@ -28,6 +24,10 @@ #include "DataFormatsEMCAL/Constants.h" #include "DataFormatsEMCAL/AnalysisCluster.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/PIDResponse.h" + #include "PWGJE/DataModel/EMCALClusters.h" using namespace o2; @@ -36,14 +36,6 @@ using namespace o2::framework::expressions; struct HfTaskElectronWeakBoson { - using SelectedClusters = o2::aod::EMCALClusters; - - // PbPb - using TrackEle = o2::soa::Join; - - // pp - // using TrackEle = o2::soa::Filtered>; - // configurable parameters Configurable nBinsPt{"nBinsPt", 100, "N bins in pt registry"}; Configurable BinPtmax{"BinPtmax", 100.0, "maximum pt registry"}; @@ -52,38 +44,43 @@ struct HfTaskElectronWeakBoson { Configurable vtxZ{"vtxZ", 10.f, ""}; - Configurable etalowCut{"etalowCut", -0.6f, "eta lower cut"}; - Configurable etaupCut{"etaupCut", 0.6f, "eta upper cut"}; - Configurable dcaxyCut{"dcaxyCut", 2.0f, "dca xy cut"}; - Configurable itschi2Cut{"itschi2Cut", 15.0f, "its chi2 cut"}; - Configurable mimpTCut{"mimpTCut", 3.0f, "minimum pT cut"}; - Configurable tpcchi2Cut{"tpcchi2Cut", 4.0f, "tpc chi2 cut"}; - Configurable itsNclCut{"itsNclCut", 2.0f, "its # of cluster cut"}; - Configurable tpcNclCut{"tpcNclCut", 100.0f, "tpc # if cluster cut"}; - Configurable tpcNclCrCut{"tpcNclCrCut", 100.0f, "tpc # of crossedRows cut"}; - Configurable tpcNsiglowCut{"tpcNsiglowCut", -1.0, "tpc Nsig lower cut"}; - Configurable tpcNsigupCut{"tpcNsigupCut", 3.0, "tpc Nsig upper cut"}; - - Configurable emcaccPhimin{"emcaccPhimin", 1.39, "Maximum M20"}; - Configurable emcaccPhimax{"emcaccPhimax", 3.36, "Maximum M20"}; - Configurable ClusterDefinition{"ClusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; - Configurable minTime{"minTime", -25., "Minimum cluster time"}; - Configurable maxTime{"maxTime", +20., "Maximum cluster time"}; - Configurable minM02{"minM02", 0.1, "Minimum M02"}; - Configurable maxM02{"maxM02", 0.9, "Maximum M02"}; - Configurable minM20{"minM20", 0.1, "Minimum M20"}; - Configurable maxM20{"maxM20", 0.6, "Maximum M20"}; - Configurable MatchRCut{"MatchRCut", 0.1, "cluster - track matching cut"}; + Configurable etaTrLow{"etaTrLow", -0.6f, "minimun track eta"}; + Configurable etaTrUp{"etaTrUp", 0.6f, "maximum track eta"}; + Configurable dcaxyMax{"dcaxyMax", 2.0f, "mximum DCA xy"}; + Configurable chi2ItsMax{"chi2ItsMax", 15.0f, "its chi2 cut"}; + Configurable ptMin{"ptMin", 3.0f, "minimum pT cut"}; + Configurable chi2TpcMax{"chi2TpcMax", 4.0f, "tpc chi2 cut"}; + Configurable nclItsMin{"nclItsMin", 2.0f, "its # of cluster cut"}; + Configurable nclTpcMin{"nclTpcMin", 100.0f, "tpc # if cluster cut"}; + Configurable nclcrossTpcMin{"nclcrossTpcMin", 100.0f, "tpc # of crossedRows cut"}; + Configurable nsigTpcMin{"nsigTpcMin", -1.0, "tpc Nsig lower cut"}; + Configurable nsigTpcMax{"nsigTpcMax", 3.0, "tpc Nsig upper cut"}; + + Configurable phiEmcMin{"phiEmcMin", 1.39, "EMC phi acc min"}; + Configurable phiEmcMax{"phiEmcMax", 3.36, "EMC phi acc max"}; + Configurable clusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; + Configurable timeEmcMin{"timeEmcMin", -25., "Minimum EMCcluster timing"}; + Configurable timeEmcMax{"timeEmcMax", +20., "Maximum EMCcluster timing"}; + Configurable m02Min{"m02Min", 0.1, "Minimum M02"}; + Configurable m02Max{"m02Max", 0.9, "Maximum M02"}; + Configurable rMatchMax{"rMatchMax", 0.1, "cluster - track matching cut"}; + + using SelectedClusters = o2::aod::EMCALClusters; + // PbPb + using TrackEle = o2::soa::Join; + + // pp + // using TrackEle = o2::soa::Filtered>; // Filter Filter eventFilter = (o2::aod::evsel::sel8 == true); Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); - Filter etafilter = (aod::track::eta < etaupCut) && (aod::track::eta > etalowCut); - Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxyCut); + Filter etafilter = (aod::track::eta < etaTrUp) && (aod::track::eta > etaTrLow); + Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxyMax); Filter filter_globalTr = requireGlobalTrackInFilter(); - Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == ClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == clusterDefinition) && (o2::aod::emcalcluster::time >= timeEmcMin) && (o2::aod::emcalcluster::time <= timeEmcMax) && (o2::aod::emcalcluster::m02 > m02Min) && (o2::aod::emcalcluster::m02 < m02Max); // Data Handling Objects Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; @@ -136,9 +133,10 @@ struct HfTaskElectronWeakBoson { registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime}); } - // void process(soa::Filtered::iterator const& collision, SelectedClusters const& clusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) - void process(soa::Filtered::iterator const& collision, SelectedClusters const& emcClusters, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) - // void process(soa::Filtered::iterator const& collision, TrackEle const& tracks, o2::aod::EMCALMatchedTracks const& matchedtracks) + void process(soa::Filtered::iterator const& collision, + SelectedClusters const& emcClusters, + TrackEle const& tracks, + o2::aod::EMCALMatchedTracks const& matchedtracks) { registry.fill(HIST("hEventCounter"), 0.5); @@ -150,36 +148,36 @@ struct HfTaskElectronWeakBoson { for (const auto& track : tracks) { - registry.fill(HIST("hEta"), track.eta()); - registry.fill(HIST("hITSchi2"), track.itsChi2NCl()); - registry.fill(HIST("hTPCchi2"), track.tpcChi2NCl()); - registry.fill(HIST("hTPCnCls"), track.tpcNClsFound()); - registry.fill(HIST("hITSnCls"), track.itsNCls()); - registry.fill(HIST("hTPCnClsCrossedRows"), track.tpcNClsCrossedRows()); - - if (std::abs(track.eta()) > etaupCut) + if (std::abs(track.eta()) > etaTrUp) continue; - if (track.tpcNClsCrossedRows() < tpcNclCrCut) + if (track.tpcNClsCrossedRows() < nclcrossTpcMin) continue; - if (std::abs(track.dcaXY()) > dcaxyCut) + if (std::abs(track.dcaXY()) > dcaxyMax) continue; - if (track.itsChi2NCl() > itschi2Cut) + if (track.itsChi2NCl() > chi2ItsMax) continue; - if (track.tpcChi2NCl() > tpcchi2Cut) + if (track.tpcChi2NCl() > chi2TpcMax) continue; - if (track.tpcNClsFound() < tpcNclCut) + if (track.tpcNClsFound() < nclTpcMin) continue; - if (track.itsNCls() < itsNclCut) + if (track.itsNCls() < nclItsMin) continue; - if (track.pt() < mimpTCut) + if (track.pt() < ptMin) continue; + + registry.fill(HIST("hEta"), track.eta()); + registry.fill(HIST("hITSchi2"), track.itsChi2NCl()); + registry.fill(HIST("hTPCchi2"), track.tpcChi2NCl()); + registry.fill(HIST("hTPCnCls"), track.tpcNClsFound()); + registry.fill(HIST("hITSnCls"), track.itsNCls()); + registry.fill(HIST("hTPCnClsCrossedRows"), track.tpcNClsCrossedRows()); registry.fill(HIST("hPt"), track.pt()); registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl()); // track - match // continue; - if (track.phi() < emcaccPhimin || track.phi() > emcaccPhimax) + if (track.phi() < phiEmcMin || track.phi() > phiEmcMax) continue; auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); @@ -192,31 +190,31 @@ struct HfTaskElectronWeakBoson { if (tracksofcluster.size()) { int nmatch = 0; for (const auto& match : tracksofcluster) { - if (match.emcalcluster_as().time() < minTime || match.emcalcluster_as().time() > maxTime) + if (match.emcalcluster_as().time() < timeEmcMin || match.emcalcluster_as().time() > timeEmcMax) continue; - if (match.emcalcluster_as().m02() < minM02 || match.emcalcluster_as().m02() > maxM02) + if (match.emcalcluster_as().m02() < m02Min || match.emcalcluster_as().m02() > m02Max) continue; - float emc_m20 = match.emcalcluster_as().m20(); - float emc_m02 = match.emcalcluster_as().m02(); - float emc_energy = match.emcalcluster_as().energy(); - double emc_phi = match.emcalcluster_as().phi(); - double emc_eta = match.emcalcluster_as().eta(); - double emc_time = match.emcalcluster_as().time(); + float m20Emc = match.emcalcluster_as().m20(); + float m02Emc = match.emcalcluster_as().m02(); + float energyEmc = match.emcalcluster_as().energy(); + double phiEmc = match.emcalcluster_as().phi(); + double etaEmc = match.emcalcluster_as().eta(); + double timeEmc = match.emcalcluster_as().time(); // LOG(info) << "tr phi0 = " << match.track_as().phi(); // LOG(info) << "tr phi1 = " << track.phi(); - // LOG(info) << "emc phi = " << emc_phi; + // LOG(info) << "emc phi = " << phiEmc; if (nmatch == 0) { - double dEta = match.track_as().eta() - emc_eta; - double dPhi = match.track_as().phi() - emc_phi; + double dEta = match.track_as().eta() - etaEmc; + double dPhi = match.track_as().phi() - phiEmc; if (dPhi > o2::constants::math::PI) { dPhi -= 2 * o2::constants::math::PI; } else if (dPhi < -o2::constants::math::PI) { dPhi += 2 * o2::constants::math::PI; } - registry.fill(HIST("hMatchPhi"), emc_phi, match.track_as().phi()); - registry.fill(HIST("hMatchEta"), emc_eta, match.track_as().eta()); + registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as().phi()); + registry.fill(HIST("hMatchEta"), etaEmc, match.track_as().eta()); double R = std::sqrt(std::pow(dPhi, 2) + std::pow(dEta, 2)); if (R < Rmim) { @@ -225,18 +223,18 @@ struct HfTaskElectronWeakBoson { dEta_mim = dEta; } registry.fill(HIST("hTrMatch"), dPhi, dEta); - registry.fill(HIST("hEMCtime"), emc_time); - registry.fill(HIST("hEnergy"), emc_energy); + registry.fill(HIST("hEMCtime"), timeEmc); + registry.fill(HIST("hEnergy"), energyEmc); - if (R < MatchRCut) + if (R < rMatchMax) continue; - double eop = emc_energy / match.track_as().p(); + double eop = energyEmc / match.track_as().p(); // LOG(info) << "E/p" << eop; registry.fill(HIST("hEopNsigTPC"), match.track_as().tpcNSigmaEl(), eop); - registry.fill(HIST("hM02"), match.track_as().tpcNSigmaEl(), emc_m02); - registry.fill(HIST("hM20"), match.track_as().tpcNSigmaEl(), emc_m20); - if (match.track_as().tpcNSigmaEl() > tpcNsiglowCut && match.track_as().tpcNSigmaEl() < tpcNsigupCut) { + registry.fill(HIST("hM02"), match.track_as().tpcNSigmaEl(), m02Emc); + registry.fill(HIST("hM20"), match.track_as().tpcNSigmaEl(), m20Emc); + if (match.track_as().tpcNSigmaEl() > nsigTpcMin && match.track_as().tpcNSigmaEl() < nsigTpcMax) { registry.fill(HIST("hEop"), match.track_as().pt(), eop); } } @@ -245,7 +243,7 @@ struct HfTaskElectronWeakBoson { } } - if (Rmim < MatchRCut) { + if (Rmim < rMatchMax) { // LOG(info) << "R mim = " << Rmim; registry.fill(HIST("hTrMatch_mim"), dPhi_mim, dEta_mim); } From 5a9b2372cbb1fb5e6737862d565be755333c564c Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Tue, 1 Oct 2024 13:22:08 +0900 Subject: [PATCH 19/20] PWGHF implemented comments by Vit --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 40 ++++++++++------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 440b2838922..fe6bb764573 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -24,6 +24,7 @@ #include "DataFormatsEMCAL/Constants.h" #include "DataFormatsEMCAL/AnalysisCluster.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponse.h" @@ -183,12 +184,12 @@ struct HfTaskElectronWeakBoson { // LOGF(info, "Number of matched track: %d", tracksofcluster.size()); - double Rmim = 999.9; - double dPhi_mim = 999.9; - double dEta_mim = 999.9; + double rMin = 999.9; + double dPhiMin = 999.9; + double dEtaMin = 999.9; if (tracksofcluster.size()) { - int nmatch = 0; + int nMatch = 0; for (const auto& match : tracksofcluster) { if (match.emcalcluster_as().time() < timeEmcMin || match.emcalcluster_as().time() > timeEmcMax) continue; @@ -204,29 +205,25 @@ struct HfTaskElectronWeakBoson { // LOG(info) << "tr phi0 = " << match.track_as().phi(); // LOG(info) << "tr phi1 = " << track.phi(); // LOG(info) << "emc phi = " << phiEmc; - if (nmatch == 0) { + if (nMatch == 0) { double dEta = match.track_as().eta() - etaEmc; double dPhi = match.track_as().phi() - phiEmc; - if (dPhi > o2::constants::math::PI) { - dPhi -= 2 * o2::constants::math::PI; - } else if (dPhi < -o2::constants::math::PI) { - dPhi += 2 * o2::constants::math::PI; - } + dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI); registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as().phi()); registry.fill(HIST("hMatchEta"), etaEmc, match.track_as().eta()); - double R = std::sqrt(std::pow(dPhi, 2) + std::pow(dEta, 2)); - if (R < Rmim) { - Rmim = R; - dPhi_mim = dPhi; - dEta_mim = dEta; + double r = RecoDecay::sqrtSumOfSquares(dPhi, dEta); + if (r < rMin) { + rMin = r; + dPhiMin = dPhi; + dEtaMin = dEta; } registry.fill(HIST("hTrMatch"), dPhi, dEta); registry.fill(HIST("hEMCtime"), timeEmc); registry.fill(HIST("hEnergy"), energyEmc); - if (R < rMatchMax) + if (r < rMatchMax) continue; double eop = energyEmc / match.track_as().p(); @@ -239,13 +236,13 @@ struct HfTaskElectronWeakBoson { } } - nmatch++; + nMatch++; } } - if (Rmim < rMatchMax) { - // LOG(info) << "R mim = " << Rmim; - registry.fill(HIST("hTrMatch_mim"), dPhi_mim, dEta_mim); + if (rMin < rMatchMax) { + // LOG(info) << "R mim = " << rMin; + registry.fill(HIST("hTrMatch_mim"), dPhiMin, dEtaMin); } } // end of track loop @@ -254,6 +251,5 @@ struct HfTaskElectronWeakBoson { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 09bfea3f5642dfb9fe3db24f41619e916d791a94 Mon Sep 17 00:00:00 2001 From: Shingo Sakai Date: Wed, 20 Nov 2024 13:47:45 +0900 Subject: [PATCH 20/20] [PWGHF] modified function to get EMCal matched track phi and eta --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 918f06da9bd..e86fe36813f 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -206,8 +206,8 @@ struct HfTaskElectronWeakBoson { // LOG(info) << "tr phi1 = " << track.phi(); // LOG(info) << "emc phi = " << phiEmc; if (nMatch == 0) { - double dEta = match.track_as().eta() - etaEmc; - double dPhi = match.track_as().phi() - phiEmc; + double dEta = match.track_as().trackEtaEmcal() - etaEmc; + double dPhi = match.track_as().trackPhiEmcal() - phiEmc; dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI); registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as().phi());