|
| 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 uccZdc.cxx |
| 13 | +/// |
| 14 | +/// \brief task for analysis of UCC with the ZDC |
| 15 | +/// \author Omar Vazquez (omar.vazquez.rueda@cern.ch) |
| 16 | +/// \since January 29, 2025 |
| 17 | + |
| 18 | +#include "Common/CCDB/EventSelectionParams.h" |
| 19 | +#include "Common/CCDB/TriggerAliases.h" |
| 20 | +#include "Common/Core/TrackSelection.h" |
| 21 | +#include "Common/DataModel/Centrality.h" |
| 22 | +#include "Common/DataModel/EventSelection.h" |
| 23 | +#include "Common/DataModel/Multiplicity.h" |
| 24 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 25 | +#include "Framework/AnalysisDataModel.h" |
| 26 | +#include "Framework/AnalysisTask.h" |
| 27 | +#include "Framework/HistogramRegistry.h" |
| 28 | +#include "Framework/runDataProcessing.h" |
| 29 | +#include "ReconstructionDataFormats/GlobalTrackID.h" |
| 30 | +#include "ReconstructionDataFormats/Track.h" |
| 31 | + |
| 32 | +using namespace std; |
| 33 | +using namespace o2; |
| 34 | +using namespace o2::framework; |
| 35 | +using namespace o2::framework::expressions; |
| 36 | +using namespace o2::aod::evsel; |
| 37 | + |
| 38 | +using ColEvSels = soa::Join<aod::Collisions, aod::EvSels>; |
| 39 | +using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, |
| 40 | + aod::Run3MatchedToBCSparse>; |
| 41 | + |
| 42 | +struct UccZdc { |
| 43 | + // Configurables, binning |
| 44 | + Configurable<int> nBinsAmp{"nBinsAmp", 1025, "nbinsAmp"}; |
| 45 | + Configurable<float> maxZN{"maxZN", 4099.5, "Max ZN signal"}; |
| 46 | + Configurable<float> maxZP{"maxZP", 3099.5, "Max ZP signal"}; |
| 47 | + Configurable<float> maxZEM{"maxZEM", 3099.5, "Max ZEM signal"}; |
| 48 | + Configurable<int> nBinsTDC{"nBinsTDC", 480, "nbinsTDC"}; |
| 49 | + Configurable<int> nBinsFit{"nBinsFit", 1000, "nbinsFit"}; |
| 50 | + Configurable<float> maxMultFV0{"maxMultFV0", 3000, "Max FV0 signal"}; |
| 51 | + Configurable<float> maxMultFT0{"maxMultFT0", 3000, "Max FT0 signal"}; |
| 52 | + |
| 53 | + // Analysis Histograms: Data |
| 54 | + HistogramRegistry histos{ |
| 55 | + "histos", |
| 56 | + {}, |
| 57 | + OutputObjHandlingPolicy::AnalysisObject}; |
| 58 | + |
| 59 | + void init(InitContext const&) |
| 60 | + { |
| 61 | + // define axes you want to use |
| 62 | + const AxisSpec axisEvent{3, 0., +3.0, ""}; |
| 63 | + const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; |
| 64 | + |
| 65 | + // Histograms |
| 66 | + histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); |
| 67 | + histos.add("hEventCounter", "Event counter", kTH1F, {axisEvent}); |
| 68 | + histos.add("ZNAcomm", "; ZNA common energy; Entries", |
| 69 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZN}}}); |
| 70 | + histos.add("ZNCcomm", "; ZNC common energy; Entries", |
| 71 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZN}}}); |
| 72 | + histos.add("ZNAcoll", "ZNAcoll; ZNA amplitude; Entries", |
| 73 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZN}}}); |
| 74 | + histos.add("ZPAcoll", "ZPAcoll; ZPA amplitude; Entries", |
| 75 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZP}}}); |
| 76 | + histos.add("ZNCcoll", "ZNCcoll; ZNC amplitude; Entries", |
| 77 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZN}}}); |
| 78 | + histos.add("ZPCcoll", "ZPCcoll; ZPC amplitude; Entries", |
| 79 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZP}}}); |
| 80 | + histos.add("ZEM1coll", "ZEM1coll; ZEM1 amplitude; Entries", |
| 81 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZEM}}}); |
| 82 | + histos.add("ZEM2coll", "ZEM2coll; ZEM2 amplitude; Entries", |
| 83 | + {HistType::kTH1F, {{nBinsAmp, -0.5, maxZEM}}}); |
| 84 | + histos.add("ZNvsZEMcoll", "ZNvsZEMcoll; ZEM; ZNA+ZNC", |
| 85 | + {HistType::kTH2F, |
| 86 | + {{{nBinsAmp, -0.5, maxZEM}, {nBinsAmp, -0.5, 2. * maxZN}}}}); |
| 87 | + histos.add("ZNAvsZNCcoll", "ZNAvsZNCcoll; ZNC; ZNA", |
| 88 | + {HistType::kTH2F, |
| 89 | + {{{nBinsAmp, -0.5, maxZN}, {nBinsAmp, -0.5, maxZN}}}}); |
| 90 | + histos.add("ZPAvsZPCcoll", "ZPAvsZPCcoll; ZPA; ZPC", |
| 91 | + {HistType::kTH2F, |
| 92 | + {{{nBinsAmp, -0.5, maxZP}, {nBinsAmp, -0.5, maxZP}}}}); |
| 93 | + histos.add("ZNAvsZPAcoll", "ZNAvsZPAcoll; ZPA; ZNA", |
| 94 | + {HistType::kTH2F, |
| 95 | + {{{nBinsAmp, -0.5, maxZP}, {nBinsAmp, -0.5, maxZN}}}}); |
| 96 | + histos.add("ZNCvsZPCcoll", "ZNCvsZPCcoll; ZPC; ZNC", |
| 97 | + {HistType::kTH2F, |
| 98 | + {{{nBinsAmp, -0.5, maxZP}, {nBinsAmp, -0.5, maxZN}}}}); |
| 99 | + // |
| 100 | + histos.add("ZNCvstdccoll", "ZNCvstdccoll; time ZNC; ZNC", |
| 101 | + {HistType::kTH2F, |
| 102 | + {{{nBinsTDC, -13.5, 11.45}, {nBinsAmp, -0.5, maxZN}}}}); |
| 103 | + histos.add("ZNAvstdccoll", "ZNAvstdccoll; time ZNA; ZNA", |
| 104 | + {HistType::kTH2F, |
| 105 | + {{{nBinsTDC, -13.5, 11.45}, {nBinsAmp, -0.5, maxZN}}}}); |
| 106 | + histos.add("ZPCvstdccoll", "ZPCvstdccoll; time ZPC; ZPC", |
| 107 | + {HistType::kTH2F, |
| 108 | + {{{nBinsTDC, -13.5, 11.45}, {nBinsAmp, -0.5, maxZP}}}}); |
| 109 | + histos.add("ZPAvstdccoll", "ZPAvstdccoll; time ZPA; ZPA", |
| 110 | + {HistType::kTH2F, |
| 111 | + {{{nBinsTDC, -13.5, 11.45}, {nBinsAmp, -0.5, maxZP}}}}); |
| 112 | + histos.add("ZEM1vstdccoll", "ZEM1vstdccoll; time ZEM1; ZEM1", |
| 113 | + {HistType::kTH2F, |
| 114 | + {{{nBinsTDC, -13.5, 11.45}, {nBinsAmp, -0.5, maxZEM}}}}); |
| 115 | + histos.add("ZEM2vstdccoll", "ZEM2vstdccoll; time ZEM2; ZEM2", |
| 116 | + {HistType::kTH2F, |
| 117 | + {{{nBinsTDC, -13.5, 11.45}, {nBinsAmp, -0.5, maxZEM}}}}); |
| 118 | + histos.add("debunch", "ZN sum vs. ZN diff.", |
| 119 | + {HistType::kTH2F, {{{240, -12., 12.}, {240, -12., 12.}}}}); |
| 120 | + histos.add("ZNvsFV0Acorrel", "ZNvsFV0Acorrel", |
| 121 | + {HistType::kTH2F, |
| 122 | + {{{nBinsFit, 0., maxMultFV0}, {nBinsAmp, -0.5, 2. * maxZN}}}}); |
| 123 | + histos.add("ZNvsFT0correl", "ZNvsFT0correl", |
| 124 | + {HistType::kTH2F, |
| 125 | + {{{nBinsFit, 0., maxMultFT0}, {nBinsAmp, -0.5, 2. * maxZN}}}}); |
| 126 | + } |
| 127 | + |
| 128 | + void processZdcCollAss( |
| 129 | + ColEvSels const& cols, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/, |
| 130 | + aod::FV0As const& /*fv0as*/, aod::FT0s const& /*ft0s*/, |
| 131 | + soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA> const& tracks) |
| 132 | + { |
| 133 | + // Collision loop |
| 134 | + for (const auto& collision : cols) { |
| 135 | + histos.fill(HIST("hEventCounter"), 0.5); |
| 136 | + if (!collision.sel8()) { |
| 137 | + return; |
| 138 | + } |
| 139 | + |
| 140 | + histos.fill(HIST("hEventCounter"), 1.5); |
| 141 | + |
| 142 | + const auto& foundBC = collision.foundBC_as<BCsRun3>(); |
| 143 | + if (foundBC.has_zdc()) { |
| 144 | + histos.fill(HIST("hEventCounter"), 2.5); |
| 145 | + |
| 146 | + const auto& zdcread = foundBC.zdc(); |
| 147 | + auto aZNA = zdcread.amplitudeZNA(); |
| 148 | + auto aZNC = zdcread.amplitudeZNC(); |
| 149 | + auto aZPA = zdcread.amplitudeZPA(); |
| 150 | + auto aZPC = zdcread.amplitudeZPC(); |
| 151 | + auto aZEM1 = zdcread.amplitudeZEM1(); |
| 152 | + auto aZEM2 = zdcread.amplitudeZEM2(); |
| 153 | + auto tZEM1 = zdcread.timeZEM1(); |
| 154 | + auto tZEM2 = zdcread.timeZEM2(); |
| 155 | + auto tZNA = zdcread.timeZNA(); |
| 156 | + auto tZNC = zdcread.timeZNC(); |
| 157 | + auto tZPA = zdcread.timeZPA(); |
| 158 | + auto tZPC = zdcread.timeZPC(); |
| 159 | + float multT0A{0.}; |
| 160 | + float multT0C{0.}; |
| 161 | + float multV0A{0.}; |
| 162 | + |
| 163 | + if (foundBC.has_ft0()) { |
| 164 | + for (const auto& amplitude : foundBC.ft0().amplitudeA()) { |
| 165 | + multT0A += amplitude; |
| 166 | + } |
| 167 | + for (const auto& amplitude : foundBC.ft0().amplitudeC()) { |
| 168 | + multT0C += amplitude; |
| 169 | + } |
| 170 | + } else { |
| 171 | + multT0A = multT0C = -999; |
| 172 | + } |
| 173 | + |
| 174 | + if (foundBC.has_fv0a()) { |
| 175 | + for (const auto& amplitude : foundBC.fv0a().amplitude()) { |
| 176 | + multV0A += amplitude; |
| 177 | + } |
| 178 | + } else { |
| 179 | + multV0A = -999; |
| 180 | + } |
| 181 | + |
| 182 | + histos.get<TH1>(HIST("ZNAcomm"))->Fill(zdcread.energyCommonZNA()); |
| 183 | + histos.get<TH1>(HIST("ZNCcomm"))->Fill(zdcread.energyCommonZNC()); |
| 184 | + histos.get<TH1>(HIST("ZNAcoll"))->Fill(aZNA); |
| 185 | + histos.get<TH1>(HIST("ZNCcoll"))->Fill(aZNC); |
| 186 | + histos.get<TH1>(HIST("ZPAcoll"))->Fill(aZPA); |
| 187 | + histos.get<TH1>(HIST("ZPCcoll"))->Fill(aZPC); |
| 188 | + histos.get<TH2>(HIST("ZNvsZEMcoll"))->Fill(aZEM1 + aZEM2, aZNA + aZNC); |
| 189 | + histos.get<TH2>(HIST("ZNAvsZNCcoll"))->Fill(aZNC, aZNA); |
| 190 | + histos.get<TH2>(HIST("ZPAvsZPCcoll"))->Fill(aZPC, aZPA); |
| 191 | + histos.get<TH2>(HIST("ZNAvsZPAcoll"))->Fill(aZPA, aZNA); |
| 192 | + histos.get<TH2>(HIST("ZNCvsZPCcoll"))->Fill(aZPC, aZNC); |
| 193 | + |
| 194 | + histos.get<TH1>(HIST("ZEM1coll"))->Fill(aZEM1); |
| 195 | + histos.get<TH1>(HIST("ZEM2coll"))->Fill(aZEM2); |
| 196 | + histos.get<TH2>(HIST("ZNCvstdccoll"))->Fill(tZNC, aZNC); |
| 197 | + histos.get<TH2>(HIST("ZNAvstdccoll"))->Fill(tZNA, aZNA); |
| 198 | + histos.get<TH2>(HIST("ZPCvstdccoll"))->Fill(tZPC, aZPC); |
| 199 | + histos.get<TH2>(HIST("ZPAvstdccoll"))->Fill(tZPA, aZPA); |
| 200 | + histos.get<TH2>(HIST("ZEM1vstdccoll"))->Fill(tZEM1, aZEM1); |
| 201 | + histos.get<TH2>(HIST("ZEM2vstdccoll"))->Fill(tZEM2, aZEM2); |
| 202 | + histos.get<TH2>(HIST("debunch"))->Fill(tZNA - tZNC, tZNA + tZNC); |
| 203 | + |
| 204 | + histos.get<TH2>(HIST("ZNvsFV0Acorrel")) |
| 205 | + ->Fill(multV0A / 100., aZNA + aZNC); |
| 206 | + histos.get<TH2>(HIST("ZNvsFT0correl")) |
| 207 | + ->Fill((multT0A + multT0C) / 100., aZNC + aZNA); |
| 208 | + } // foundBC.has_zdc() |
| 209 | + |
| 210 | + for (const auto& track : tracks) { |
| 211 | + if (track.tpcNClsCrossedRows() < 70) |
| 212 | + continue; |
| 213 | + if (std::fabs(track.dcaXY()) > 0.2) |
| 214 | + continue; |
| 215 | + |
| 216 | + histos.fill(HIST("etaHistogram"), track.eta()); |
| 217 | + } |
| 218 | + } |
| 219 | + } |
| 220 | + PROCESS_SWITCH(UccZdc, processZdcCollAss, |
| 221 | + "Processing ZDC w. collision association", true); |
| 222 | +}; |
| 223 | + |
| 224 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 225 | +{ |
| 226 | + return WorkflowSpec{adaptAnalysisTask<UccZdc>(cfgc)}; |
| 227 | +} |
0 commit comments