|
| 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 taskSingleMuonReader.cxx |
| 13 | +/// \brief Task used to read the derived table produced by the tableMaker of DQ framework and extract observables on single muons needed for the HF-muon analysis. |
| 14 | +/// \author Maolin Zhang <maolin.zhang@cern.ch>, CCNU |
| 15 | +#include <iostream> |
| 16 | +#include "Framework/AnalysisDataModel.h" |
| 17 | +#include "Framework/AnalysisTask.h" |
| 18 | +#include "Framework/ASoAHelpers.h" |
| 19 | +#include "Framework/HistogramRegistry.h" |
| 20 | +#include "Framework/runDataProcessing.h" |
| 21 | +#include "ReconstructionDataFormats/TrackFwd.h" |
| 22 | +#include "PWGDQ/DataModel/ReducedInfoTables.h" |
| 23 | +#include "Common/Core/RecoDecay.h" |
| 24 | +#include "Common/DataModel/EventSelection.h" |
| 25 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 26 | + |
| 27 | +using namespace o2; |
| 28 | +using namespace o2::aod; |
| 29 | +using namespace o2::framework; |
| 30 | +using namespace o2::framework::expressions; |
| 31 | + |
| 32 | +using MyCollisions = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended>; |
| 33 | +using MyMuons = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra>; |
| 34 | + |
| 35 | +struct HfTaskSingleMuonReader { |
| 36 | + Configurable<int> trkType{"trkType", 0, "Muon track type, valid values are 0, 1, 2, 3 and 4"}; |
| 37 | + Configurable<float> etaMin{"etaMin", -3.6, "eta minimum value"}; |
| 38 | + Configurable<float> etaMax{"etaMax", -2.5, "eta maximum value"}; |
| 39 | + Configurable<float> pDcaMax{"pDcaMax", 594., "p*DCA maximum value"}; |
| 40 | + Configurable<float> rAbsMax{"rAbsMax", 89.5, "R at absorber end maximum value"}; |
| 41 | + Configurable<float> rAbsMin{"rAbsMin", 26.5, "R at absorber end minimum value"}; |
| 42 | + Configurable<float> zVtx{"zVtx", 10., "Z edge of primary vertex [cm]"}; |
| 43 | + |
| 44 | + o2::framework::HistogramRegistry registry{ |
| 45 | + "registry", |
| 46 | + {}, |
| 47 | + OutputObjHandlingPolicy::AnalysisObject, |
| 48 | + true, |
| 49 | + true}; |
| 50 | + |
| 51 | + void init(InitContext&) |
| 52 | + { |
| 53 | + AxisSpec axisPt{200, 0., 100., "#it{p}_{T} (GeV/#it{c})"}; |
| 54 | + AxisSpec axisEta{100, -4., -2., "#it{#eta}"}; |
| 55 | + AxisSpec axisDCA{400, 0., 4., "#it{DCA}_{xy} (cm)"}; |
| 56 | + AxisSpec axisChi2MatchMCHMFT{100, 0., 100., "MCH-MFT matching #chi^{2}"}; |
| 57 | + AxisSpec axisSign{5, -2.5, 2.5, "Charge"}; |
| 58 | + AxisSpec axisDeltaPt{10000, -50, 50, "#Delta #it{p}_{T} (GeV/#it{c})"}; |
| 59 | + AxisSpec axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; |
| 60 | + |
| 61 | + HistogramConfigSpec hTHnMu{HistType::kTHnSparseF, {axisPt, axisEta, axisDCA, axisSign, axisChi2MatchMCHMFT, axisDeltaPt}, 6}; |
| 62 | + HistogramConfigSpec hVtxZ{HistType::kTH1F, {axisVtxZ}}; |
| 63 | + |
| 64 | + registry.add("hMuAfterCuts", "", hTHnMu); |
| 65 | + registry.add("hVtxZ", "", hVtxZ); |
| 66 | + } |
| 67 | + |
| 68 | + void process(MyCollisions::iterator const& collision, MyMuons const& muons) |
| 69 | + { |
| 70 | + registry.fill(HIST("hVtxZ"), collision.posZ()); |
| 71 | + for (const auto& muon : muons) { |
| 72 | + if (muon.trackType() != trkType) { |
| 73 | + continue; |
| 74 | + } |
| 75 | + |
| 76 | + const auto eta(muon.eta()), pDca(muon.pDca()); |
| 77 | + const auto rAbs(muon.rAtAbsorberEnd()); |
| 78 | + const auto dcaXY(RecoDecay::sqrtSumOfSquares(muon.fwdDcaX(), muon.fwdDcaY())); |
| 79 | + const auto pt(muon.pt()); |
| 80 | + const auto charge(muon.sign()); |
| 81 | + const auto chi2(muon.chi2MatchMCHMFT()); |
| 82 | + |
| 83 | + if ((eta >= etaMax) || (eta < etaMin)) { |
| 84 | + continue; |
| 85 | + } |
| 86 | + if ((rAbs >= rAbsMax) || (rAbs < rAbsMin)) { |
| 87 | + continue; |
| 88 | + } |
| 89 | + if (pDca >= pDcaMax) { |
| 90 | + continue; |
| 91 | + } |
| 92 | + |
| 93 | + // histograms after acceptance cuts |
| 94 | + if (muon.has_matchMCHTrack()) { |
| 95 | + auto muonType3 = muon.matchMCHTrack_as<MyMuons>(); |
| 96 | + auto Dpt = muonType3.pt() - pt; |
| 97 | + registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, charge, chi2, Dpt); |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | +}; |
| 102 | + |
| 103 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 104 | +{ |
| 105 | + return WorkflowSpec{ |
| 106 | + adaptAnalysisTask<HfTaskSingleMuonReader>(cfgc), |
| 107 | + }; |
| 108 | +} |
0 commit comments