|
| 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 | +/// \author Alberto Caliva (alberto.caliva@cern.ch) |
| 13 | +/// \since November 27, 2023 |
| 14 | + |
| 15 | +#include <vector> |
| 16 | +#include <TMath.h> |
| 17 | +#include <TPDGCode.h> |
| 18 | +#include <TRandom.h> |
| 19 | +#include <TVector2.h> |
| 20 | +#include <TVector3.h> |
| 21 | +#include <TDatabasePDG.h> |
| 22 | +#include "Framework/runDataProcessing.h" |
| 23 | +#include "Framework/AnalysisTask.h" |
| 24 | +#include "Framework/AnalysisDataModel.h" |
| 25 | +#include "Framework/ASoA.h" |
| 26 | +#include "Framework/ASoAHelpers.h" |
| 27 | +#include "Framework/HistogramRegistry.h" |
| 28 | +#include "Framework/RunningWorkflowInfo.h" |
| 29 | +#include "Framework/DataTypes.h" |
| 30 | +#include "ReconstructionDataFormats/Track.h" |
| 31 | +#include "ReconstructionDataFormats/PID.h" |
| 32 | +#include "ReconstructionDataFormats/DCA.h" |
| 33 | +#include "Common/Core/trackUtilities.h" |
| 34 | +#include "Common/Core/TrackSelection.h" |
| 35 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 36 | +#include "Common/DataModel/EventSelection.h" |
| 37 | +#include "Common/DataModel/Centrality.h" |
| 38 | +#include "Common/DataModel/PIDResponse.h" |
| 39 | + |
| 40 | +using namespace std; |
| 41 | +using namespace o2; |
| 42 | +using namespace o2::framework; |
| 43 | +using namespace o2::framework::expressions; |
| 44 | +using namespace o2::constants::physics; |
| 45 | +using std::array; |
| 46 | + |
| 47 | +using SelectedCollisions = soa::Join<aod::Collisions, aod::EvSels>; |
| 48 | + |
| 49 | +using FullTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TrackSelectionExtension, aod::TracksDCA, aod::pidTPCFullHe, aod::pidTPCFullTr, aod::pidTPCFullAl, aod::pidTOFFullTr>; |
| 50 | + |
| 51 | +using MCTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TrackSelectionExtension, aod::TracksDCA, aod::pidTPCFullHe, aod::pidTPCFullTr, aod::pidTPCFullAl, aod::pidTOFFullTr, aod::McTrackLabels>; |
| 52 | + |
| 53 | +struct helium_flow { |
| 54 | + |
| 55 | + // QC Histograms |
| 56 | + HistogramRegistry registryQC{ |
| 57 | + "registryQC", |
| 58 | + {}, |
| 59 | + OutputObjHandlingPolicy::AnalysisObject, |
| 60 | + true, |
| 61 | + true}; |
| 62 | + |
| 63 | + // Analysis Histograms: Data |
| 64 | + HistogramRegistry registryData{ |
| 65 | + "registryData", |
| 66 | + {}, |
| 67 | + OutputObjHandlingPolicy::AnalysisObject, |
| 68 | + true, |
| 69 | + true}; |
| 70 | + |
| 71 | + // Analysis Histograms: MC |
| 72 | + HistogramRegistry registryMC{ |
| 73 | + "registryMC", |
| 74 | + {}, |
| 75 | + OutputObjHandlingPolicy::AnalysisObject, |
| 76 | + true, |
| 77 | + true}; |
| 78 | + |
| 79 | + // Global Parameters |
| 80 | + Configurable<int> particle_of_interest{"particle_of_interest", 0, "0=antihelium3, 1=antitriton, 2=antihelium4"}; |
| 81 | + |
| 82 | + // Track Parameters |
| 83 | + Configurable<int> min_ITS_nClusters{"min_ITS_nClusters", 4, "minimum number of found ITS clusters"}; |
| 84 | + Configurable<int> min_TPC_nClusters{"min_TPC_nClusters", 80, "minimum number of found TPC clusters"}; |
| 85 | + Configurable<int> min_TPC_nCrossedRows{"min_TPC_nCrossedRows", 80, "minimum number of TPC crossed pad rows"}; |
| 86 | + Configurable<float> max_chi2_TPC{"max_chi2_TPC", 4.0f, "maximum TPC chi^2/Ncls"}; |
| 87 | + Configurable<float> max_chi2_ITS{"max_chi2_ITS", 36.0f, "maximum ITS chi^2/Ncls"}; |
| 88 | + Configurable<float> min_pt{"min_pt", 1.0f, "minimum pt of the tracks"}; |
| 89 | + Configurable<float> min_eta{"min_eta", -0.8f, "minimum_eta"}; |
| 90 | + Configurable<float> max_eta{"max_eta", +0.8f, "maximum_eta"}; |
| 91 | + Configurable<float> max_dcaxy{"max_dcaxy", 0.1f, "Maximum DCAxy"}; |
| 92 | + Configurable<float> max_dcaz{"max_dcaz", 0.1f, "Maximum DCAz"}; |
| 93 | + Configurable<float> min_nsigmaTPC{"min_nsigmaTPC", -3.0f, "Minimum nsigma TPC"}; |
| 94 | + Configurable<float> max_nsigmaTPC{"max_nsigmaTPC", +3.0f, "Maximum nsigma TPC"}; |
| 95 | + Configurable<bool> require_primVtx_contributor{"require_primVtx_contributor", true, "require that the track is a PV contributor"}; |
| 96 | + |
| 97 | + // List of Particles |
| 98 | + enum particle { antihelium3, |
| 99 | + antitriton, |
| 100 | + antihelium4 }; |
| 101 | + |
| 102 | + void init(InitContext const&) |
| 103 | + { |
| 104 | + // Global Properties |
| 105 | + registryQC.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{4, 0, 4, "1 = all, 2 = selected, 3 = events with particle of interest"}}); |
| 106 | + } |
| 107 | + |
| 108 | + // Single-Track Selection for the Particle of Interest |
| 109 | + template <typename T1> |
| 110 | + bool passedTrackSelection(const T1& track) |
| 111 | + { |
| 112 | + if (!track.hasITS()) |
| 113 | + return false; |
| 114 | + if (track.itsNCls() < min_ITS_nClusters) |
| 115 | + return false; |
| 116 | + if (!track.hasTPC()) |
| 117 | + return false; |
| 118 | + if (track.tpcNClsFound() < min_TPC_nClusters) |
| 119 | + return false; |
| 120 | + if (track.tpcNClsCrossedRows() < min_TPC_nCrossedRows) |
| 121 | + return false; |
| 122 | + if (track.tpcChi2NCl() > max_chi2_TPC) |
| 123 | + return false; |
| 124 | + if (track.itsChi2NCl() > max_chi2_ITS) |
| 125 | + return false; |
| 126 | + if (track.eta() < min_eta || track.eta() > max_eta) |
| 127 | + return false; |
| 128 | + if (track.pt() < min_pt) |
| 129 | + return false; |
| 130 | + if (TMath::Abs(track.dcaXY()) > max_dcaxy) |
| 131 | + return false; |
| 132 | + if (TMath::Abs(track.dcaZ()) > max_dcaz) |
| 133 | + return false; |
| 134 | + |
| 135 | + return true; |
| 136 | + } |
| 137 | + |
| 138 | + template <typename T2> |
| 139 | + bool isParticleOfInterest(const T2& track) |
| 140 | + { |
| 141 | + // Variables |
| 142 | + float nsigmaTPCHe3 = track.tpcNSigmaHe(); |
| 143 | + float nsigmaTPCH3 = track.tpcNSigmaTr(); |
| 144 | + float nsigmaTOFH3 = track.tofNSigmaTr(); |
| 145 | + float nsigmaTPCHe4 = track.tpcNSigmaAl(); |
| 146 | + float pt = track.pt(); |
| 147 | + |
| 148 | + // Antimatter Only |
| 149 | + if (track.sign() > 0) |
| 150 | + return false; |
| 151 | + |
| 152 | + // Antihelium3 ID |
| 153 | + if (particle_of_interest == particle::antihelium3) { |
| 154 | + if (pt >= 1.0 && TMath::Abs(nsigmaTPCHe3) < 8.0) |
| 155 | + return true; |
| 156 | + return false; |
| 157 | + } |
| 158 | + |
| 159 | + // Antitriton ID |
| 160 | + if (particle_of_interest == particle::antitriton) { |
| 161 | + if (pt >= 1.0 && pt < 2.0 && TMath::Abs(nsigmaTPCH3) < 8.0) |
| 162 | + return true; |
| 163 | + if (pt >= 2.0 && pt < 4.0 && track.hasTOF() && nsigmaTPCH3 > min_nsigmaTPC && nsigmaTPCH3 < max_nsigmaTPC && TMath::Abs(nsigmaTOFH3) < 8.0) |
| 164 | + return true; |
| 165 | + return false; |
| 166 | + } |
| 167 | + |
| 168 | + // Antihelium4 ID |
| 169 | + if (particle_of_interest == particle::antihelium4) { |
| 170 | + if (pt >= 1.0 && TMath::Abs(nsigmaTPCHe4) < 8.0) |
| 171 | + return true; |
| 172 | + return false; |
| 173 | + } |
| 174 | + return false; |
| 175 | + } |
| 176 | + |
| 177 | + // Process Data |
| 178 | + void processData(SelectedCollisions::iterator const& collision, FullTracks const& tracks) |
| 179 | + { |
| 180 | + // Event Counter (before event selection) |
| 181 | + registryQC.fill(HIST("number_of_events_data"), 0.5); |
| 182 | + |
| 183 | + // Event Selection |
| 184 | + if (!collision.sel8()) |
| 185 | + return; |
| 186 | + |
| 187 | + // Event Counter (after event selection) |
| 188 | + registryQC.fill(HIST("number_of_events_data"), 1.5); |
| 189 | + |
| 190 | + // Reduced Event |
| 191 | + std::vector<int> particle_ID; |
| 192 | + bool containsParticleOfInterest(false); |
| 193 | + |
| 194 | + // Loop over Reconstructed Tracks |
| 195 | + for (auto track : tracks) { |
| 196 | + |
| 197 | + // Track Selection |
| 198 | + if (!passedTrackSelection(track)) |
| 199 | + continue; |
| 200 | + if (!track.passedITSRefit()) |
| 201 | + continue; |
| 202 | + if (!track.passedTPCRefit()) |
| 203 | + continue; |
| 204 | + |
| 205 | + // Track Index |
| 206 | + int i = track.globalIndex(); |
| 207 | + |
| 208 | + // Trigger: Particle of Interest |
| 209 | + if (isParticleOfInterest(track)) |
| 210 | + containsParticleOfInterest = true; |
| 211 | + |
| 212 | + // Store Array Element |
| 213 | + particle_ID.push_back(i); |
| 214 | + } |
| 215 | + |
| 216 | + // Skip Events with no Particle of Interest |
| 217 | + if (!containsParticleOfInterest) |
| 218 | + return; |
| 219 | + |
| 220 | + // Event Counter (events with particle of interest) |
| 221 | + registryQC.fill(HIST("number_of_events_data"), 3.5); |
| 222 | + |
| 223 | + } // end processData |
| 224 | + PROCESS_SWITCH(helium_flow, processData, "Process data", true); |
| 225 | +}; |
| 226 | + |
| 227 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 228 | +{ |
| 229 | + return WorkflowSpec{adaptAnalysisTask<helium_flow>(cfgc)}; |
| 230 | +} |
0 commit comments