|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | +/// |
| 12 | +/// \file pmdQa.cxx |
| 13 | +/// |
| 14 | +/// \brief QA task to check PMD info on Run 2 converted data |
| 15 | +/// \author Abhi Modak (abhi.modak@cern.ch) |
| 16 | +/// \since May 17, 2025 |
| 17 | + |
| 18 | +#include <cstdlib> |
| 19 | +#include <cmath> |
| 20 | +#include <vector> |
| 21 | + |
| 22 | +#include "Framework/runDataProcessing.h" |
| 23 | +#include "Framework/AnalysisTask.h" |
| 24 | +#include "Framework/ASoA.h" |
| 25 | +#include "Framework/AnalysisDataModel.h" |
| 26 | +#include "Common/DataModel/EventSelection.h" |
| 27 | +#include "Common/DataModel/PmdTable.h" |
| 28 | +#include "Framework/O2DatabasePDGPlugin.h" |
| 29 | +#include "CCDB/BasicCCDBManager.h" |
| 30 | +#include "TH1F.h" |
| 31 | +#include "TH2F.h" |
| 32 | + |
| 33 | +using namespace o2; |
| 34 | +using namespace o2::aod::run2; |
| 35 | +using namespace o2::framework; |
| 36 | +using namespace o2::aod::evsel; |
| 37 | +using namespace o2::framework::expressions; |
| 38 | + |
| 39 | +struct BuiltPmdIndex { |
| 40 | + // build the index table PMDTracksIndex |
| 41 | + Builds<aod::PMDTracksIndex> idx; |
| 42 | + void init(InitContext const&) {} |
| 43 | +}; |
| 44 | + |
| 45 | +struct PmdQa { |
| 46 | + |
| 47 | + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
| 48 | + ConfigurableAxis axisEventBin{"axisEventBin", {4, 0.5, 4.5}, ""}; |
| 49 | + ConfigurableAxis axisVtxZBin{"axisVtxZBin", {40, -20, 20}, ""}; |
| 50 | + ConfigurableAxis axisNPMDtracksBin{"axisNPMDtracksBin", {500, 0, 500}, "Number of pmdtracks"}; |
| 51 | + ConfigurableAxis axisClsxyBin{"axisClsxyBin", {200, -100, 100}, ""}; |
| 52 | + ConfigurableAxis axisAdcBin{"axisAdcBin", {200, 0, 2000}, ""}; |
| 53 | + ConfigurableAxis axisEtaBin{"axisEtaBin", {10, 2.1, 4.1}, ""}; |
| 54 | + ConfigurableAxis axisNcellBin{"axisNcellBin", {50, -0.5, 49.5}, ""}; |
| 55 | + Configurable<int> fMipCut{"fMipCut", 432, "fMipCut"}; |
| 56 | + Configurable<int> fNcellCut{"fNcellCut", 2, "fNcellCut"}; |
| 57 | + Configurable<float> fEtalow{"fEtalow", 2.3, "fEtalow"}; |
| 58 | + Configurable<float> fEtahigh{"fEtahigh", 3.9, "fEtahigh"}; |
| 59 | + Configurable<float> fVtxCut{"fVtxCut", 10.0, "fVtxCut"}; |
| 60 | + |
| 61 | + void init(InitContext&) |
| 62 | + { |
| 63 | + |
| 64 | + AxisSpec axisEvent = {axisEventBin, "Event", "EventAxis"}; |
| 65 | + AxisSpec axisVtxZ = {axisVtxZBin, "VtxZ", "VtxZAxis"}; |
| 66 | + AxisSpec axisNPMDtracks = {axisNPMDtracksBin, "NPMDtracks", "NPMDtracksAxis"}; |
| 67 | + AxisSpec axisClsxy = {axisClsxyBin, "Clsxy", "ClsxyAxis"}; |
| 68 | + AxisSpec axisAdc = {axisAdcBin, "Adc", "AdcAxis"}; |
| 69 | + AxisSpec axisEta = {axisEtaBin, "Eta", "EtaAxis"}; |
| 70 | + AxisSpec axisNcell = {axisNcellBin, "Ncell", "NcellAxis"}; |
| 71 | + |
| 72 | + histos.add("hEventHist", "hEventHist", kTH1F, {axisEvent}); |
| 73 | + histos.add("hVtxZHist", "hVtxZHist", kTH1F, {axisVtxZ}); |
| 74 | + histos.add("hNPMDtracks", "Number of pmdtracks", kTH1F, {axisNPMDtracks}); |
| 75 | + histos.add("hClusXY", "hClusXY", kTH2F, {axisClsxy, axisClsxy}); |
| 76 | + histos.add("hClusAdc", "hClusAdc", kTH1F, {axisAdc}); |
| 77 | + histos.add("hetacls", "hetacls", kTH1F, {axisEta}); |
| 78 | + histos.add("hclsncell", "hclsncell", kTH1F, {axisNcell}); |
| 79 | + } |
| 80 | + |
| 81 | + using ColTable = soa::Join<aod::Collisions, aod::PMDTracksIndex>; |
| 82 | + using ColevSel = soa::Join<ColTable, aod::EvSels>; |
| 83 | + |
| 84 | + void process(ColevSel::iterator const& collision, aod::Pmds const&) |
| 85 | + { |
| 86 | + histos.fill(HIST("hEventHist"), 1); |
| 87 | + if (collision.sel7()) { |
| 88 | + return; |
| 89 | + } |
| 90 | + histos.fill(HIST("hEventHist"), 2); |
| 91 | + if (std::abs(collision.posZ()) >= fVtxCut) { |
| 92 | + return; |
| 93 | + } |
| 94 | + histos.fill(HIST("hEventHist"), 3); |
| 95 | + histos.fill(HIST("hVtxZHist"), collision.posZ()); |
| 96 | + |
| 97 | + if (collision.has_pmd()) { |
| 98 | + histos.fill(HIST("hEventHist"), 4); |
| 99 | + auto tracks = collision.pmd(); |
| 100 | + histos.fill(HIST("hNPMDtracks"), tracks.size()); |
| 101 | + for (const auto& track : tracks) { |
| 102 | + if (track.pmddet() == 1) { |
| 103 | + return; |
| 104 | + } |
| 105 | + if (track.pmdclsz() == 0) { |
| 106 | + return; |
| 107 | + } |
| 108 | + if (!track.pmdmodule()) { |
| 109 | + return; |
| 110 | + } |
| 111 | + histos.fill(HIST("hClusXY"), track.pmdclsx(), track.pmdclsy()); |
| 112 | + histos.fill(HIST("hClusAdc"), track.pmdclsadc()); |
| 113 | + float rdist = std::sqrt(track.pmdclsx() * track.pmdclsx() + track.pmdclsy() * track.pmdclsy()); |
| 114 | + float theta = std::atan2(rdist, track.pmdclsz()); |
| 115 | + float etacls = -std::log(std::tan(0.5 * theta)); |
| 116 | + if (track.pmdclsadc() > fMipCut && track.pmdncell() > fNcellCut) { |
| 117 | + if (etacls > fEtalow && etacls < fEtahigh) { |
| 118 | + histos.fill(HIST("hetacls"), etacls); |
| 119 | + histos.fill(HIST("hclsncell"), track.pmdncell()); |
| 120 | + } |
| 121 | + } |
| 122 | + } |
| 123 | + } |
| 124 | + } |
| 125 | +}; |
| 126 | + |
| 127 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 128 | +{ |
| 129 | + return WorkflowSpec{ |
| 130 | + adaptAnalysisTask<PmdQa>(cfgc), |
| 131 | + adaptAnalysisTask<BuiltPmdIndex>(cfgc), |
| 132 | + }; |
| 133 | +} |
0 commit comments