|
| 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 | +/// \author junlee.kim@cern.ch |
| 12 | +/// \since Jul 2024 |
| 13 | + |
| 14 | +#include <experimental/type_traits> |
| 15 | +#include <cmath> |
| 16 | +#include <array> |
| 17 | +#include <cstdlib> |
| 18 | +#include <chrono> |
| 19 | +#include <string> |
| 20 | +#include <vector> |
| 21 | + |
| 22 | +#include "TLorentzVector.h" |
| 23 | +#include "TRandom3.h" |
| 24 | +#include "TF1.h" |
| 25 | +#include "TVector2.h" |
| 26 | +#include "Math/Vector3D.h" |
| 27 | +#include "Math/Vector4D.h" |
| 28 | +#include "Math/GenVector/Boost.h" |
| 29 | +#include <TMath.h> |
| 30 | + |
| 31 | +#include "Framework/runDataProcessing.h" |
| 32 | +#include "Framework/AnalysisTask.h" |
| 33 | +#include "Framework/AnalysisDataModel.h" |
| 34 | +#include "Framework/HistogramRegistry.h" |
| 35 | +#include "Framework/StepTHn.h" |
| 36 | +#include "Framework/O2DatabasePDGPlugin.h" |
| 37 | +#include "Framework/ASoAHelpers.h" |
| 38 | +#include "Framework/StaticFor.h" |
| 39 | + |
| 40 | +#include "Common/DataModel/Centrality.h" |
| 41 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 42 | +#include "Common/DataModel/EventSelection.h" |
| 43 | +#include "Common/DataModel/Qvectors.h" |
| 44 | + |
| 45 | +#include "Common/Core/trackUtilities.h" |
| 46 | +#include "Common/Core/TrackSelection.h" |
| 47 | +#include "Common/Core/EventPlaneHelper.h" |
| 48 | + |
| 49 | +#include "CommonConstants/PhysicsConstants.h" |
| 50 | + |
| 51 | +#include "ReconstructionDataFormats/Track.h" |
| 52 | + |
| 53 | +#include "DataFormatsParameters/GRPObject.h" |
| 54 | +#include "DataFormatsParameters/GRPMagField.h" |
| 55 | + |
| 56 | +#include "CCDB/CcdbApi.h" |
| 57 | +#include "CCDB/BasicCCDBManager.h" |
| 58 | + |
| 59 | +#include "PWGCF/DataModel/CorrelationsDerived.h" |
| 60 | + |
| 61 | +using namespace std; |
| 62 | +using namespace o2; |
| 63 | +using namespace o2::framework; |
| 64 | +using namespace o2::framework::expressions; |
| 65 | +using namespace o2::soa; |
| 66 | +using namespace o2::constants::physics; |
| 67 | + |
| 68 | +struct jEPDzeroFlowAnalysis { |
| 69 | + enum { |
| 70 | + kFT0C = 0, |
| 71 | + kFT0A = 1, |
| 72 | + kFT0M, |
| 73 | + kFV0A, |
| 74 | + kTPCpos, |
| 75 | + kTPCneg, |
| 76 | + kTPCall |
| 77 | + }; |
| 78 | + |
| 79 | + using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::CentFT0Cs, aod::Qvectors>; |
| 80 | + HistogramRegistry histos{ |
| 81 | + "histos", |
| 82 | + {}, |
| 83 | + OutputObjHandlingPolicy::AnalysisObject}; |
| 84 | + |
| 85 | + Configurable<float> cfgCentSel{"cfgCentSel", 80., "Centrality selection"}; |
| 86 | + Configurable<std::string> cfgCentEst{"cfgCentEst", "FT0C", "Centrality estimator; FT0M or FT0C available"}; |
| 87 | + |
| 88 | + Configurable<bool> cfgPVSel{"cfgPVSel", false, "Additional PV selection flag for syst"}; |
| 89 | + Configurable<float> cfgPV{"cfgPV", 8.0, "Additional PV selection range for syst"}; |
| 90 | + Configurable<bool> cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "flag for additional pileup selection"}; |
| 91 | + Configurable<int> cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; |
| 92 | + Configurable<int> cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; |
| 93 | + |
| 94 | + Configurable<int> cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; |
| 95 | + Configurable<int> cfgNQvec{"cfgNQvec", 7, "The number of total Qvectors for looping over the task"}; |
| 96 | + |
| 97 | + Configurable<float> cfgEtaMax{"cfgEtaMax", 0.8, "eta selection"}; |
| 98 | + Configurable<float> cfgPtMin{"cfgPtMin", 0.0, "pt selection"}; |
| 99 | + |
| 100 | + Configurable<std::string> cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"}; |
| 101 | + Configurable<std::string> cfgRefAName{"cfgRefAName", "TPCPos", "The name of detector for reference A"}; |
| 102 | + Configurable<std::string> cfgRefBName{"cfgRefBName", "TPCNeg", "The name of detector for reference B"}; |
| 103 | + |
| 104 | + ConfigurableAxis massAxis{"massAxis", {175, 1.7, 2.05}, "Invariant mass axis"}; |
| 105 | + ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; |
| 106 | + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; |
| 107 | + ConfigurableAxis cosAxis{"cosAxis", {110, -1.05, 1.05}, "Cosine axis"}; |
| 108 | + |
| 109 | + // Filter track2pFilter = (nabs(aod::cf2prongtrack::eta) < cfgEtaMax) && (aod::cf2prongtrack::pt > cfgPtMin); |
| 110 | + |
| 111 | + EventPlaneHelper helperEP; |
| 112 | + |
| 113 | + int DetId; |
| 114 | + int RefAId; |
| 115 | + int RefBId; |
| 116 | + |
| 117 | + float centrality; |
| 118 | + |
| 119 | + template <class T> |
| 120 | + using hasInvMass = decltype(std::declval<T&>().invMass()); |
| 121 | + |
| 122 | + template <typename T> |
| 123 | + int GetDetId(const T& name) |
| 124 | + { |
| 125 | + if (name.value == "FT0C") { |
| 126 | + return kFT0C; |
| 127 | + } else if (name.value == "FT0A") { |
| 128 | + return kFT0A; |
| 129 | + } else if (name.value == "FT0M") { |
| 130 | + return kFT0M; |
| 131 | + } else if (name.value == "FV0A") { |
| 132 | + return kFV0A; |
| 133 | + } else if (name.value == "TPCpos") { |
| 134 | + return kTPCpos; |
| 135 | + } else if (name.value == "TPCneg") { |
| 136 | + return kTPCneg; |
| 137 | + } else if (name.value == "TPCall") { |
| 138 | + return kTPCall; |
| 139 | + } else { |
| 140 | + return 0; |
| 141 | + } |
| 142 | + } |
| 143 | + |
| 144 | + template <typename TCollision> |
| 145 | + bool eventSelected(TCollision collision) |
| 146 | + { |
| 147 | + if (!collision.sel8()) { |
| 148 | + return false; |
| 149 | + } |
| 150 | + if (cfgCentSel < centrality) { |
| 151 | + return false; |
| 152 | + } |
| 153 | + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { |
| 154 | + return false; |
| 155 | + } |
| 156 | + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { |
| 157 | + return false; |
| 158 | + } |
| 159 | + if (cfgPVSel && std::abs(collision.posZ()) > cfgPV) { |
| 160 | + return false; |
| 161 | + } |
| 162 | + if (cfgAddEvtSelPileup && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { |
| 163 | + return false; |
| 164 | + } |
| 165 | + if (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy) { |
| 166 | + return false; |
| 167 | + } |
| 168 | + return true; |
| 169 | + } // event selection |
| 170 | + |
| 171 | + template <typename CollType, typename TrackType> |
| 172 | + void fillHistosFlow(const CollType& coll, TrackType& trks) |
| 173 | + { |
| 174 | + if (coll.qvecAmp()[DetId] < 1e-4 || coll.qvecAmp()[RefAId] < 1e-4 || coll.qvecAmp()[RefBId] < 1e-4) { |
| 175 | + return; |
| 176 | + } |
| 177 | + int DetInd = DetId * 4 + cfgNQvec * 4; |
| 178 | + // int RefAInd = RefAId * 4 + cfgNQvec * 4; |
| 179 | + // int RefBInd = RefBId * 4 + cfgNQvec * 4; |
| 180 | + for (auto& trk : trks) { |
| 181 | + histos.fill(HIST("hist_EP_cos_Det_v2"), trk.invMass(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecRe()[DetInd + 3], coll.qvecIm()[DetInd + 3], 2))), centrality); |
| 182 | + histos.fill(HIST("hist_EP_sin_Det_v2"), trk.invMass(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecRe()[DetInd + 3], coll.qvecIm()[DetInd + 3], 2))), centrality); |
| 183 | + } |
| 184 | + } |
| 185 | + |
| 186 | + void init(InitContext const&) |
| 187 | + { |
| 188 | + DetId = GetDetId(cfgDetName); |
| 189 | + RefAId = GetDetId(cfgRefAName); |
| 190 | + RefBId = GetDetId(cfgRefBName); |
| 191 | + |
| 192 | + if (DetId == RefAId || DetId == RefBId || RefAId == RefBId) { |
| 193 | + LOGF(fatal, "Wrong detector configuration \n set the systems correctly"); |
| 194 | + DetId = 0; |
| 195 | + RefAId = 4; |
| 196 | + RefBId = 5; |
| 197 | + } |
| 198 | + |
| 199 | + histos.add(Form("hist_EP_cos_Det_v2"), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); |
| 200 | + histos.add(Form("hist_EP_cos_Det_v2"), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); |
| 201 | + } |
| 202 | + |
| 203 | + void processData(MyCollisions::iterator const& collision, aod::CF2ProngTracks const& p2tracks) |
| 204 | + { |
| 205 | + if (cfgCentEst.value == "FT0C") { |
| 206 | + centrality = collision.centFT0C(); |
| 207 | + } else if (cfgCentEst.value == "FT0M") { |
| 208 | + centrality = collision.centFT0M(); |
| 209 | + } |
| 210 | + if (!eventSelected(collision)) { |
| 211 | + return; |
| 212 | + } |
| 213 | + fillHistosFlow(collision, p2tracks); |
| 214 | + } |
| 215 | + PROCESS_SWITCH(jEPDzeroFlowAnalysis, processData, "Process Event for data", true); |
| 216 | +}; |
| 217 | + |
| 218 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 219 | +{ |
| 220 | + return WorkflowSpec{ |
| 221 | + adaptAnalysisTask<jEPDzeroFlowAnalysis>(cfgc)}; |
| 222 | +} |
0 commit comments