|
| 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 filterdoublephi.cxx |
| 13 | +/// \brief Selection of events with triplets and pairs for femtoscopic studies |
| 14 | +/// |
| 15 | +/// \author Sourav Kundu, sourav.kundu@cern.ch |
| 16 | + |
| 17 | +#include <Framework/Configurable.h> |
| 18 | +#include <Math/GenVector/Boost.h> |
| 19 | +#include <Math/Vector4D.h> |
| 20 | +#include <TMath.h> |
| 21 | +#include <fairlogger/Logger.h> |
| 22 | +#include <TDatabasePDG.h> // FIXME |
| 23 | +#include <TPDGCode.h> // FIXME |
| 24 | + |
| 25 | +#include <iostream> |
| 26 | +#include <iterator> |
| 27 | +#include <string> |
| 28 | +#include <vector> |
| 29 | + |
| 30 | +#include "../filterTables.h" |
| 31 | +#include "PWGLF/DataModel/ReducedDoublePhiTables.h" |
| 32 | +#include "Framework/ASoAHelpers.h" |
| 33 | +#include "Framework/AnalysisDataModel.h" |
| 34 | +#include "Framework/AnalysisTask.h" |
| 35 | +#include "Framework/HistogramRegistry.h" |
| 36 | +#include "Framework/runDataProcessing.h" |
| 37 | +#include "CommonConstants/MathConstants.h" |
| 38 | +#include "Common/Core/TrackSelection.h" |
| 39 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 40 | +#include "Common/DataModel/EventSelection.h" |
| 41 | +#include "Common/DataModel/Multiplicity.h" |
| 42 | +#include "Common/DataModel/PIDResponse.h" |
| 43 | +#include "DataFormatsTPC/BetheBlochAleph.h" |
| 44 | +#include "CCDB/BasicCCDBManager.h" |
| 45 | +#include "CCDB/CcdbApi.h" |
| 46 | +#include "Common/DataModel/PIDResponseITS.h" |
| 47 | + |
| 48 | +using namespace o2; |
| 49 | +using namespace o2::framework; |
| 50 | +using namespace o2::framework::expressions; |
| 51 | + |
| 52 | +struct filterdoublephi { |
| 53 | + |
| 54 | + // Produce derived tables |
| 55 | + Produces<aod::DoublePhiFilters> tags; |
| 56 | + |
| 57 | + // events |
| 58 | + Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; |
| 59 | + // Configurable<float> cfgCutCentralityMax{"cfgCutCentralityMax", 0.0f, "Accepted maximum Centrality"}; |
| 60 | + // Configurable<float> cfgCutCentralityMin{"cfgCutCentralityMin", 100.0f, "Accepted minimum Centrality"}; |
| 61 | + // track |
| 62 | + Configurable<bool> isPtdepPID1{"isPtdepPID1", false, "use pt dep PID kplus"}; |
| 63 | + Configurable<bool> isPtdepPID2{"isPtdepPID2", false, "use pt dep PID kminus"}; |
| 64 | + Configurable<bool> useGlobalTrack{"useGlobalTrack", true, "use Global track"}; |
| 65 | + Configurable<float> cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; |
| 66 | + Configurable<float> cfgCutCharge{"cfgCutCharge", 0.0, "cut on Charge"}; |
| 67 | + Configurable<float> cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; |
| 68 | + Configurable<float> cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; |
| 69 | + Configurable<float> cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; |
| 70 | + Configurable<float> cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; |
| 71 | + Configurable<float> nsigmaCutTPC{"nsigmacutTPC", -2.0, "Value of the TPC Nsigma cut"}; |
| 72 | + Configurable<float> nsigmaCutTPCPreSel{"nsigmacutTPCPreSel", 3.0, "Value of the TPC Nsigma cut Pre selection"}; |
| 73 | + Configurable<float> nsigmaCutTOF{"nsigmaCutTOF", 3.0, "Value of the TOF Nsigma cut"}; |
| 74 | + Configurable<int> cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; |
| 75 | + Configurable<int> cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; |
| 76 | + Configurable<bool> isDeepAngle{"isDeepAngle", true, "Deep Angle cut"}; |
| 77 | + Configurable<double> cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; |
| 78 | + ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {120, 0.98, 1.1}, "#it{M} (GeV/#it{c}^{2})"}; |
| 79 | + ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.0, 10.}, "#it{p}_{T} (GeV/#it{c})"}; |
| 80 | + Configurable<float> minPhiMass{"minPhiMass", 1.01, "Minimum phi mass"}; |
| 81 | + Configurable<float> maxPhiMass{"maxPhiMass", 1.03, "Maximum phi mass"}; |
| 82 | + Configurable<float> MinPhiPairPt{"MinPhiPairPt", 2.0, "Minimum phi pair Pt"}; |
| 83 | + Configurable<float> MinPhiPairMass{"MinPhiPairMass", 2.5, "Minimum phi pair mass"}; |
| 84 | + Configurable<float> MaxPhiPairMass{"MaxPhiPairMass", 3.0, "Max phi pair mass"}; |
| 85 | + |
| 86 | + // Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; |
| 87 | + // Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin); |
| 88 | + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); |
| 89 | + Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); |
| 90 | + Filter PIDcutFilter = nabs(aod::pidtpc::tpcNSigmaKa) < nsigmaCutTPCPreSel; |
| 91 | + |
| 92 | + // using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults>>; |
| 93 | + using EventCandidates = soa::Join<aod::Collisions, aod::EvSels>; |
| 94 | + using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTOFbeta, aod::pidTPCFullKa, aod::pidTOFFullKa>>; |
| 95 | + |
| 96 | + SliceCache cache; |
| 97 | + Partition<TrackCandidates> posTracks = aod::track::signed1Pt > cfgCutCharge; |
| 98 | + Partition<TrackCandidates> negTracks = aod::track::signed1Pt < cfgCutCharge; |
| 99 | + |
| 100 | + // Histogram |
| 101 | + OutputObj<TH1D> hProcessedEvents{TH1D("hProcessedEvents", ";; Number of events", 3, 0.0f, 3.0f)}; |
| 102 | + HistogramRegistry qaRegistry{"QAHistos", { |
| 103 | + {"hInvMassPhi", "hInvMassPhi", {HistType::kTH2F, {{40, 1.0f, 1.04f}, {100, 0.0f, 10.0f}}}}, |
| 104 | + {"hInvMassDoublePhi", "hInvMassDoublePhi", {HistType::kTH2F, {{1000, 2.0f, 3.0f}, {100, 0.0f, 10.0f}}}}, |
| 105 | + {"hNsigmaPtkaonTPC", "hNsigmaPtkaonTPC", {HistType::kTH2F, {{200, -10.0f, 10.0f}, {100, 0.0f, 10.0f}}}}, |
| 106 | + {"hNsigmaPtkaonTOF", "hNsigmaPtkaonTOF", {HistType::kTH2F, {{200, -10.0f, 10.0f}, {100, 0.0f, 10.0f}}}}, |
| 107 | + }, |
| 108 | + OutputObjHandlingPolicy::AnalysisObject}; |
| 109 | + |
| 110 | + double massKa = o2::constants::physics::MassKPlus; |
| 111 | + |
| 112 | + void init(o2::framework::InitContext&) |
| 113 | + { |
| 114 | + hProcessedEvents->GetXaxis()->SetBinLabel(1, "All events"); |
| 115 | + hProcessedEvents->GetXaxis()->SetBinLabel(2, "Events with double Phi without sel."); |
| 116 | + hProcessedEvents->GetXaxis()->SetBinLabel(3, aod::filtering::TriggerEventDoublePhi::columnLabel()); |
| 117 | + } |
| 118 | + |
| 119 | + template <typename T> |
| 120 | + bool selectionTrack(const T& candidate) |
| 121 | + { |
| 122 | + if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsCrossedRows() > cfgTPCcluster)) { |
| 123 | + return false; |
| 124 | + } |
| 125 | + return true; |
| 126 | + } |
| 127 | + template <typename T> |
| 128 | + bool selectionPID(const T& candidate) |
| 129 | + { |
| 130 | + if (candidate.pt() < 0.5 && candidate.tpcNSigmaKa() > nsigmaCutTPC && candidate.tpcNSigmaKa() < 3.0) { |
| 131 | + return true; |
| 132 | + } |
| 133 | + if (candidate.pt() >= 0.5) { |
| 134 | + if (!candidate.hasTOF() && candidate.tpcNSigmaKa() > nsigmaCutTPC && candidate.tpcNSigmaKa() < 3.0) { |
| 135 | + return true; |
| 136 | + } |
| 137 | + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && candidate.tpcNSigmaKa() > nsigmaCutTPC && candidate.tpcNSigmaKa() < 3.0 && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { |
| 138 | + return true; |
| 139 | + } |
| 140 | + } |
| 141 | + return false; |
| 142 | + } |
| 143 | + template <typename T> |
| 144 | + bool selectionPID2(const T& candidate) |
| 145 | + { |
| 146 | + if (candidate.pt() < 0.5 && candidate.tpcNSigmaKa() > nsigmaCutTPC && candidate.tpcNSigmaKa() < 3.0) { |
| 147 | + return true; |
| 148 | + } |
| 149 | + if (candidate.pt() >= 0.5) { |
| 150 | + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && candidate.tpcNSigmaKa() > nsigmaCutTPC && candidate.tpcNSigmaKa() < 3.0 && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { |
| 151 | + return true; |
| 152 | + } |
| 153 | + } |
| 154 | + return false; |
| 155 | + } |
| 156 | + // deep angle cut on pair to remove photon conversion |
| 157 | + template <typename T1, typename T2> |
| 158 | + bool selectionPair(const T1& candidate1, const T2& candidate2) |
| 159 | + { |
| 160 | + double pt1, pt2, pz1, pz2, p1, p2, angle; |
| 161 | + pt1 = candidate1.pt(); |
| 162 | + pt2 = candidate2.pt(); |
| 163 | + pz1 = candidate1.pz(); |
| 164 | + pz2 = candidate2.pz(); |
| 165 | + p1 = candidate1.p(); |
| 166 | + p2 = candidate2.p(); |
| 167 | + angle = TMath::ACos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); |
| 168 | + if (isDeepAngle && angle < cfgDeepAngle) { |
| 169 | + return false; |
| 170 | + } |
| 171 | + return true; |
| 172 | + } |
| 173 | + |
| 174 | + ROOT::Math::PxPyPzMVector KaonPlus, KaonMinus, PhiMesonMother, PhiVectorDummy, PhiVectorDummy2, PhiPair; |
| 175 | + void processPhiReducedTable(EventCandidates::iterator const& collision, TrackCandidates const&, aod::BCsWithTimestamps const&) |
| 176 | + { |
| 177 | + bool keepEventDoublePhi = false; |
| 178 | + int numberPhi = 0; |
| 179 | + o2::aod::ITSResponse itsResponse; |
| 180 | + std::vector<int64_t> Phid1Index = {}; |
| 181 | + std::vector<int64_t> Phid2Index = {}; |
| 182 | + std::vector<ROOT::Math::PtEtaPhiMVector> phiresonance, phiresonanced1, phiresonanced2; |
| 183 | + int Npostrack = 0; |
| 184 | + int Nnegtrack = 0; |
| 185 | + hProcessedEvents->Fill(0.5); |
| 186 | + if (collision.sel8()) { |
| 187 | + auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); |
| 188 | + auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); |
| 189 | + for (auto track1 : posThisColl) { |
| 190 | + // track selection |
| 191 | + if (!selectionTrack(track1)) { |
| 192 | + continue; |
| 193 | + } |
| 194 | + // PID check |
| 195 | + if (isPtdepPID1 && !selectionPID2(track1)) { |
| 196 | + continue; |
| 197 | + } |
| 198 | + if (!isPtdepPID1 && !selectionPID(track1)) { |
| 199 | + continue; |
| 200 | + } |
| 201 | + if (track1.pt() > 0.4 && track1.pt() < 1.0 && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(track1) > -2.0 && itsResponse.nSigmaITS<o2::track::PID::Kaon>(track1) < 3.0)) { |
| 202 | + continue; |
| 203 | + } |
| 204 | + Npostrack = Npostrack + 1; |
| 205 | + qaRegistry.fill(HIST("hNsigmaPtkaonTPC"), track1.tpcNSigmaKa(), track1.pt()); |
| 206 | + if (track1.hasTOF()) { |
| 207 | + qaRegistry.fill(HIST("hNsigmaPtkaonTOF"), track1.tofNSigmaKa(), track1.pt()); |
| 208 | + } |
| 209 | + auto track1ID = track1.globalIndex(); |
| 210 | + for (auto track2 : negThisColl) { |
| 211 | + // track selection |
| 212 | + if (!selectionTrack(track2)) { |
| 213 | + continue; |
| 214 | + } |
| 215 | + // PID check |
| 216 | + if (isPtdepPID2 && !selectionPID2(track2)) { |
| 217 | + continue; |
| 218 | + } |
| 219 | + if (!isPtdepPID2 && !selectionPID(track2)) { |
| 220 | + continue; |
| 221 | + } |
| 222 | + if (track2.pt() > 0.4 && track2.pt() < 1.0 && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(track2) > -2.0 && itsResponse.nSigmaITS<o2::track::PID::Kaon>(track2) < 3.0)) { |
| 223 | + continue; |
| 224 | + } |
| 225 | + if (Npostrack == 1) { |
| 226 | + Nnegtrack = Nnegtrack + 1; |
| 227 | + } |
| 228 | + auto track2ID = track2.globalIndex(); |
| 229 | + if (track2ID == track1ID) { |
| 230 | + continue; |
| 231 | + } |
| 232 | + if (!selectionPair(track1, track2)) { |
| 233 | + continue; |
| 234 | + } |
| 235 | + KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); |
| 236 | + KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); |
| 237 | + PhiMesonMother = KaonPlus + KaonMinus; |
| 238 | + if (PhiMesonMother.M() > minPhiMass && PhiMesonMother.M() < maxPhiMass) { |
| 239 | + numberPhi = numberPhi + 1; |
| 240 | + ROOT::Math::PtEtaPhiMVector temp1(track1.pt(), track1.eta(), track1.phi(), massKa); |
| 241 | + ROOT::Math::PtEtaPhiMVector temp2(track2.pt(), track2.eta(), track2.phi(), massKa); |
| 242 | + ROOT::Math::PtEtaPhiMVector temp3(PhiMesonMother.pt(), PhiMesonMother.eta(), PhiMesonMother.phi(), PhiMesonMother.M()); |
| 243 | + phiresonanced1.push_back(temp1); |
| 244 | + phiresonanced2.push_back(temp2); |
| 245 | + phiresonance.push_back(temp3); |
| 246 | + Phid1Index.push_back(track1.globalIndex()); |
| 247 | + Phid2Index.push_back(track2.globalIndex()); |
| 248 | + qaRegistry.fill(HIST("hInvMassPhi"), PhiMesonMother.M(), PhiMesonMother.Pt()); |
| 249 | + } |
| 250 | + } |
| 251 | + } |
| 252 | + } // select collision |
| 253 | + if (numberPhi > 1 && Npostrack > 1 && Nnegtrack > 1 && (phiresonance.size() == phiresonanced1.size()) && (phiresonance.size() == phiresonanced2.size())) { |
| 254 | + hProcessedEvents->Fill(1.5); |
| 255 | + for (auto if1 = phiresonance.begin(); if1 != phiresonance.end(); ++if1) { |
| 256 | + auto i5 = std::distance(phiresonance.begin(), if1); |
| 257 | + PhiVectorDummy = phiresonance.at(i5); |
| 258 | + for (auto if2 = if1 + 1; if2 != phiresonance.end(); ++if2) { |
| 259 | + auto i6 = std::distance(phiresonance.begin(), if2); |
| 260 | + PhiVectorDummy2 = phiresonance.at(i6); |
| 261 | + PhiPair = PhiVectorDummy + PhiVectorDummy2; |
| 262 | + if ((Phid1Index.at(i5) != Phid1Index.at(i6)) && (Phid2Index.at(i5) != Phid2Index.at(i6)) && PhiPair.M() > MinPhiPairMass && PhiPair.M() < MaxPhiPairMass && PhiPair.Pt() > MinPhiPairPt) { |
| 263 | + qaRegistry.fill(HIST("hInvMassDoublePhi"), PhiPair.M(), PhiPair.Pt()); |
| 264 | + keepEventDoublePhi = true; |
| 265 | + } |
| 266 | + } |
| 267 | + } |
| 268 | + } |
| 269 | + if (keepEventDoublePhi) { |
| 270 | + hProcessedEvents->Fill(2.5); |
| 271 | + } |
| 272 | + tags(keepEventDoublePhi); |
| 273 | + } // process |
| 274 | + PROCESS_SWITCH(filterdoublephi, processPhiReducedTable, "Process table creation for double phi", true); |
| 275 | +}; |
| 276 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfg) |
| 277 | +{ |
| 278 | + return WorkflowSpec{adaptAnalysisTask<filterdoublephi>(cfg, TaskName{"lf-doublephi-filter"})}; |
| 279 | +} |
0 commit comments