|
| 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 | +// K* spin alignment |
| 12 | +// Prottay Das (prottay.das@cern.ch) |
| 13 | + |
| 14 | +#include <TH1F.h> |
| 15 | +#include <TDirectory.h> |
| 16 | +#include <THn.h> |
| 17 | +#include <TLorentzVector.h> |
| 18 | +#include <TMath.h> |
| 19 | +#include <TObjArray.h> |
| 20 | +#include <TFile.h> |
| 21 | +#include <TH2F.h> |
| 22 | +#include <TLorentzVector.h> |
| 23 | +#include <TPDGCode.h> |
| 24 | +#include <string> |
| 25 | +#include <vector> |
| 26 | +#include <cmath> |
| 27 | +#include <array> |
| 28 | +#include <cstdlib> |
| 29 | + |
| 30 | +#include "TRandom3.h" |
| 31 | +#include "Math/Vector3D.h" |
| 32 | +#include "Math/Vector4D.h" |
| 33 | +#include "Math/GenVector/Boost.h" |
| 34 | +#include "TF1.h" |
| 35 | + |
| 36 | +#include "PWGLF/DataModel/EPCalibrationTables.h" |
| 37 | +#include "Framework/runDataProcessing.h" |
| 38 | +#include "Framework/AnalysisTask.h" |
| 39 | +#include "Framework/AnalysisDataModel.h" |
| 40 | +#include "Framework/HistogramRegistry.h" |
| 41 | +#include "Framework/StepTHn.h" |
| 42 | +#include "Common/DataModel/PIDResponse.h" |
| 43 | +#include "Common/DataModel/Multiplicity.h" |
| 44 | +#include "Common/DataModel/Centrality.h" |
| 45 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 46 | +#include "Common/DataModel/EventSelection.h" |
| 47 | +#include "Common/Core/trackUtilities.h" |
| 48 | +#include "CommonConstants/PhysicsConstants.h" |
| 49 | +#include "Common/Core/TrackSelection.h" |
| 50 | +#include "Framework/ASoAHelpers.h" |
| 51 | +#include "ReconstructionDataFormats/Track.h" |
| 52 | +#include "DataFormatsParameters/GRPObject.h" |
| 53 | +#include "DataFormatsParameters/GRPMagField.h" |
| 54 | +#include "Common/DataModel/PIDResponseITS.h" |
| 55 | +#include "CCDB/BasicCCDBManager.h" |
| 56 | + |
| 57 | +using namespace o2; |
| 58 | +using namespace o2::framework; |
| 59 | +using namespace o2::framework::expressions; |
| 60 | +using std::array; |
| 61 | + |
| 62 | +struct kstarpbpbsa { |
| 63 | + |
| 64 | + Service<o2::ccdb::BasicCCDBManager> ccdb; |
| 65 | + |
| 66 | + // events |
| 67 | + Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; |
| 68 | + Configurable<float> cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"}; |
| 69 | + // track |
| 70 | + Configurable<float> cfgCutCharge{"cfgCutCharge", 0.0, "cut on Charge"}; |
| 71 | + Configurable<float> cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; |
| 72 | + Configurable<float> cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; |
| 73 | + Configurable<float> cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; |
| 74 | + Configurable<float> cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; |
| 75 | + Configurable<bool> useGlobalTrack{"useGlobalTrack", true, "use Global track"}; |
| 76 | + Configurable<float> nsigmaCutTOF{"nsigmacutTOF", 3.0, "Value of the TOF Nsigma cut"}; |
| 77 | + Configurable<float> nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; |
| 78 | + Configurable<float> nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; |
| 79 | + Configurable<int> cfgNoMixedEvents{"cfgNoMixedEvents", 1, "Number of mixed events per event"}; |
| 80 | + Configurable<int> cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; |
| 81 | + Configurable<int> cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; |
| 82 | + Configurable<bool> removefaketrak{"removefaketrack", true, "Remove fake track from momentum difference"}; |
| 83 | + Configurable<float> ConfFakeKaonCut{"ConfFakeKaonCut", 0.1, "Cut based on track from momentum difference"}; |
| 84 | + Configurable<bool> ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; |
| 85 | + Configurable<bool> OnlyTOF{"OnlyTOF", true, "OnlyTOF"}; |
| 86 | + Configurable<int> strategyPID{"strategyPID", 2, "PID strategy"}; |
| 87 | + Configurable<float> cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; |
| 88 | + Configurable<float> confMinRot{"confMinRot", 5.0 * TMath::Pi() / 6.0, "Minimum of rotation"}; |
| 89 | + Configurable<float> confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"}; |
| 90 | + Configurable<int> nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"}; |
| 91 | + Configurable<bool> fillRotation{"fillRotation", true, "fill rotation"}; |
| 92 | + Configurable<bool> like{"like", true, "fill rotation"}; |
| 93 | + Configurable<int> spNbins{"spNbins", 2000, "Number of bins in sp"}; |
| 94 | + Configurable<float> lbinsp{"lbinsp", -1.0, "lower bin value in sp histograms"}; |
| 95 | + Configurable<float> hbinsp{"hbinsp", 1.0, "higher bin value in sp histograms"}; |
| 96 | + Configurable<float> nsigmaCutITS{"nsigmaCutITS", 3.0, "Value of the ITS Nsigma cut"}; |
| 97 | + Configurable<int> PIDstrategy{"PIDstrategy", 0, "0: TOF Veto, 1: TOF Veto opti, 2: TOF, 3: TOF loose 1, 4: TOF loose 2, 5: old pt dep"}; |
| 98 | + |
| 99 | + ConfigurableAxis configcentAxis{"configcentAxis", {VARIABLE_WIDTH, 0.0, 10.0, 40.0, 80.0}, "Cent V0M"}; |
| 100 | + ConfigurableAxis configrapAxis{"configrapAxis", {VARIABLE_WIDTH, -0.8, -0.4, 0.4, 0.8}, "Rapidity"}; |
| 101 | + ConfigurableAxis configresAxis{"configresAxis", {VARIABLE_WIDTH, -2.0, -1.5, -1.0, -0.6, -0.2, 0.2, 0.6, 1.0, 1.5, 2.0}, "Resolution"}; |
| 102 | + ConfigurableAxis configthnAxispT{"configthnAxisPt", {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}, "#it{p}_{T} (GeV/#it{c})"}; |
| 103 | + ConfigurableAxis configIMAxis{"configIMAxis", {VARIABLE_WIDTH, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.5, 1.7, 1.8, 1.9, 2.0}, "IM"}; |
| 104 | + |
| 105 | + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; |
| 106 | + Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality; |
| 107 | + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); |
| 108 | + Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); |
| 109 | + |
| 110 | + using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::FV0Mults, aod::TPCMults, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0Cs, aod::CentFT0As, aod::EPCalibrationTables, aod::Mults>>; |
| 111 | + using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTOFbeta, aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>>; |
| 112 | + |
| 113 | + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
| 114 | + |
| 115 | + void init(o2::framework::InitContext&) |
| 116 | + { |
| 117 | + AxisSpec spAxis = {spNbins, lbinsp, hbinsp, "Sp"}; |
| 118 | + |
| 119 | + histos.add("hCentrality", "Centrality distribution", kTH1F, {{20, 0.0, 100.0}}); |
| 120 | + |
| 121 | + histos.add("ResFT0CTPC", "ResFT0CTPC", HistType::kTHnSparseF, {configcentAxis, configresAxis}); |
| 122 | + histos.add("ResFT0CFT0A", "ResFT0CFT0A", HistType::kTHnSparseF, {configcentAxis, configresAxis}); |
| 123 | + histos.add("ResFT0ATPC", "ResFT0ATPC", HistType::kTHnSparseF, {configcentAxis, configresAxis}); |
| 124 | + histos.add("hSparseSAvsrapsameunlike", "hSparseSAvsrapsameunlike", HistType::kTHnSparseF, {configIMAxis, configthnAxispT, spAxis, configrapAxis, configcentAxis}, true); |
| 125 | + histos.add("hSparseSAvsrapsamelike", "hSparseSAvsrapsamelike", HistType::kTHnSparseF, {configIMAxis, configthnAxispT, spAxis, configrapAxis, configcentAxis}, true); |
| 126 | + histos.add("hSparseSAvsraprot", "hSparseSAvsraprot", HistType::kTHnSparseF, {configIMAxis, configthnAxispT, spAxis, configrapAxis, configcentAxis}, true); |
| 127 | + } |
| 128 | + |
| 129 | + double massKa = o2::constants::physics::MassKPlus; |
| 130 | + double massPr = o2::constants::physics::MassProton; |
| 131 | + double massPi = o2::constants::physics::MassPiMinus; |
| 132 | + |
| 133 | + template <typename T> |
| 134 | + bool selectionTrack(const T& candidate) |
| 135 | + { |
| 136 | + if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) { |
| 137 | + return false; |
| 138 | + } |
| 139 | + if (!useGlobalTrack && !(candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster)) { |
| 140 | + return false; |
| 141 | + } |
| 142 | + return true; |
| 143 | + } |
| 144 | + |
| 145 | + template <typename T> |
| 146 | + bool strategySelectionPID(const T& candidate, int PID, int strategy) |
| 147 | + { |
| 148 | + if (PID == 0) { |
| 149 | + if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { |
| 150 | + return true; |
| 151 | + } |
| 152 | + if (candidate.pt() >= 0.5 && TMath::Sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF) { |
| 153 | + return true; |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + else if (PID == 1) { |
| 158 | + if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { |
| 159 | + return true; |
| 160 | + } |
| 161 | + if (candidate.pt() >= 0.5 && TMath::Sqrt(candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) < nsigmaCutTOF) { |
| 162 | + return true; |
| 163 | + } |
| 164 | + } |
| 165 | + return false; |
| 166 | + } |
| 167 | + |
| 168 | + double GetPhiInRange(double phi) |
| 169 | + { |
| 170 | + double result = phi; |
| 171 | + while (result < 0) { |
| 172 | + result = result + 2. * TMath::Pi() / 2; |
| 173 | + } |
| 174 | + while (result > 2. * TMath::Pi() / 2) { |
| 175 | + result = result - 2. * TMath::Pi() / 2; |
| 176 | + } |
| 177 | + return result; |
| 178 | + } |
| 179 | + |
| 180 | + ROOT::Math::PxPyPzMVector KstarMother, daughter1, daughter2, fourVecDauCM; |
| 181 | + ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector; |
| 182 | + ROOT::Math::PxPyPzMVector kstarrot, kaonrot, daughter2rot, fourVecDauCMrot; |
| 183 | + ROOT::Math::XYZVector threeVecDauCMrot, threeVecDauCMXYrot; |
| 184 | + |
| 185 | + void processSE(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) |
| 186 | + { |
| 187 | + if (!collision.sel8() || !collision.triggereventep() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { |
| 188 | + return; |
| 189 | + } |
| 190 | + |
| 191 | + o2::aod::ITSResponse itsResponse; |
| 192 | + |
| 193 | + auto centrality = collision.centFT0C(); |
| 194 | + auto QFT0C = collision.qFT0C(); |
| 195 | + auto QFT0A = collision.qFT0A(); |
| 196 | + auto QTPC = collision.qTPC(); |
| 197 | + auto psiFT0C = collision.psiFT0C(); |
| 198 | + auto psiFT0A = collision.psiFT0A(); |
| 199 | + auto psiTPC = collision.psiTPC(); |
| 200 | + |
| 201 | + histos.fill(HIST("hCentrality"), centrality); |
| 202 | + |
| 203 | + histos.fill(HIST("ResFT0CTPC"), centrality, TMath::Cos(2.0 * (psiFT0C - psiTPC))); |
| 204 | + histos.fill(HIST("ResFT0CFT0A"), centrality, TMath::Cos(2.0 * (psiFT0C - psiFT0A))); |
| 205 | + histos.fill(HIST("ResFT0ATPC"), centrality, TMath::Cos(2.0 * (psiTPC - psiFT0A))); |
| 206 | + |
| 207 | + for (const auto& track1 : tracks) { |
| 208 | + if (!selectionTrack(track1)) { |
| 209 | + continue; |
| 210 | + } |
| 211 | + bool track1kaon = false; |
| 212 | + auto track1ID = track1.globalIndex(); |
| 213 | + if (!strategySelectionPID(track1, 0, strategyPID)) { |
| 214 | + continue; |
| 215 | + } |
| 216 | + track1kaon = true; |
| 217 | + |
| 218 | + for (const auto& track2 : tracks) { |
| 219 | + if (!selectionTrack(track2)) { |
| 220 | + continue; |
| 221 | + } |
| 222 | + |
| 223 | + bool track2pion = false; |
| 224 | + auto track2ID = track2.globalIndex(); |
| 225 | + if (!strategySelectionPID(track2, 1, strategyPID)) { |
| 226 | + continue; |
| 227 | + } |
| 228 | + |
| 229 | + track2pion = true; |
| 230 | + if (track2ID == track1ID) { |
| 231 | + continue; |
| 232 | + } |
| 233 | + if (!track1kaon || !track2pion) { |
| 234 | + continue; |
| 235 | + } |
| 236 | + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); |
| 237 | + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); |
| 238 | + KstarMother = daughter1 + daughter2; |
| 239 | + if (std::abs(KstarMother.Rapidity()) > 0.9) { |
| 240 | + continue; |
| 241 | + } |
| 242 | + |
| 243 | + ROOT::Math::Boost boost{KstarMother.BoostToCM()}; |
| 244 | + fourVecDauCM = boost(daughter1); |
| 245 | + threeVecDauCM = fourVecDauCM.Vect(); |
| 246 | + threeVecDauCMXY = ROOT::Math::XYZVector(threeVecDauCM.X(), threeVecDauCM.Y(), 0.); |
| 247 | + eventplaneVec = ROOT::Math::XYZVector(std::cos(2.0 * psiFT0C), std::sin(2.0 * psiFT0C), 0); |
| 248 | + auto cosPhistarminuspsi = GetPhiInRange(fourVecDauCM.Phi() - psiFT0C); |
| 249 | + auto SA = TMath::Cos(2.0 * cosPhistarminuspsi); |
| 250 | + |
| 251 | + int track1Sign = track1.sign(); |
| 252 | + int track2Sign = track2.sign(); |
| 253 | + |
| 254 | + if (track1Sign * track2Sign < 0) |
| 255 | + histos.fill(HIST("hSparseSAvsrapsameunlike"), KstarMother.M(), KstarMother.Pt(), SA, KstarMother.Rapidity(), centrality); |
| 256 | + else if (track1Sign * track2Sign > 0) |
| 257 | + histos.fill(HIST("hSparseSAvsrapsamelike"), KstarMother.M(), KstarMother.Pt(), SA, KstarMother.Rapidity(), centrality); |
| 258 | + |
| 259 | + if (fillRotation) { |
| 260 | + for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { |
| 261 | + auto anglestart = confMinRot; |
| 262 | + auto angleend = confMaxRot; |
| 263 | + auto anglestep = (angleend - anglestart) / (1.0 * (nBkgRotations - 1)); |
| 264 | + auto rotangle = anglestart + nrotbkg * anglestep; |
| 265 | + auto rotkaonPx = track1.px() * std::cos(rotangle) - track1.py() * std::sin(rotangle); |
| 266 | + auto rotkaonPy = track1.px() * std::sin(rotangle) + track1.py() * std::cos(rotangle); |
| 267 | + kaonrot = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa); |
| 268 | + kstarrot = kaonrot + daughter2; |
| 269 | + |
| 270 | + if (std::abs(kstarrot.Rapidity()) > 0.9) { |
| 271 | + continue; |
| 272 | + } |
| 273 | + |
| 274 | + ROOT::Math::Boost boost{kstarrot.BoostToCM()}; |
| 275 | + fourVecDauCMrot = boost(kaonrot); |
| 276 | + threeVecDauCMrot = fourVecDauCMrot.Vect(); |
| 277 | + threeVecDauCMXYrot = ROOT::Math::XYZVector(threeVecDauCMrot.X(), threeVecDauCMrot.Y(), 0.); |
| 278 | + auto cosPhistarminuspsirot = GetPhiInRange(fourVecDauCMrot.Phi() - psiFT0C); |
| 279 | + auto SArot = TMath::Cos(2.0 * cosPhistarminuspsirot); |
| 280 | + |
| 281 | + histos.fill(HIST("hSparseSAvsraprot"), kstarrot.M(), kstarrot.Pt(), SArot, kstarrot.Rapidity(), centrality); |
| 282 | + } |
| 283 | + } |
| 284 | + } |
| 285 | + } |
| 286 | + } |
| 287 | + PROCESS_SWITCH(kstarpbpbsa, processSE, "Process Same event", true); |
| 288 | +}; |
| 289 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 290 | +{ |
| 291 | + return WorkflowSpec{ |
| 292 | + adaptAnalysisTask<kstarpbpbsa>(cfgc, TaskName{"kstarpbpbsa"})}; |
| 293 | +} |
0 commit comments