|
| 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 | +/// |
| 13 | +/// \file ECALqa.cxx |
| 14 | +/// \author Nicolo' Jacazio |
| 15 | +/// \since 14/09/2021 |
| 16 | +/// \brief Task to use the ALICE3 ECAL table |
| 17 | +/// |
| 18 | + |
| 19 | +// O2 includes |
| 20 | +#include "Framework/AnalysisTask.h" |
| 21 | +#include "ALICE3/DataModel/ECAL.h" |
| 22 | +#include "Common/Core/MC.h" |
| 23 | +#include "Common/Core/PID/PIDResponse.h" |
| 24 | +#include "ReconstructionDataFormats/PID.h" |
| 25 | +#include "Framework/HistogramRegistry.h" |
| 26 | +#include "Framework/runDataProcessing.h" |
| 27 | + |
| 28 | +using namespace o2; |
| 29 | +using namespace o2::track; |
| 30 | +using namespace o2::framework; |
| 31 | +using namespace o2::framework::expressions; |
| 32 | + |
| 33 | +namespace o2::aod |
| 34 | +{ |
| 35 | + |
| 36 | +namespace indices |
| 37 | +{ |
| 38 | +DECLARE_SOA_INDEX_COLUMN(Track, track); |
| 39 | +DECLARE_SOA_INDEX_COLUMN(ECAL, ecal); |
| 40 | +} // namespace indices |
| 41 | + |
| 42 | +DECLARE_SOA_INDEX_TABLE_USER(ECALTracksIndex, Tracks, "ECALTRK", indices::TrackId, indices::ECALId); |
| 43 | +} // namespace o2::aod |
| 44 | + |
| 45 | +struct ecalIndexBuilder { // Builder of the ECAL-track index linkage |
| 46 | + Builds<o2::aod::ECALTracksIndex> ind; |
| 47 | + void init(o2::framework::InitContext&) |
| 48 | + { |
| 49 | + } |
| 50 | +}; |
| 51 | + |
| 52 | +struct ecalQaMc { |
| 53 | + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::QAObject}; |
| 54 | + |
| 55 | + void init(o2::framework::InitContext&) |
| 56 | + { |
| 57 | + histos.add("energy", ";Energy;Entries", HistType::kTH1F, {{1000, 0, 10000}}); |
| 58 | + } |
| 59 | + |
| 60 | + using Trks = soa::Join<aod::Tracks, aod::ECALTracksIndex, aod::TracksExtra>; |
| 61 | + void process(const aod::McParticles& mcParticles, |
| 62 | + const Trks& tracks, |
| 63 | + const aod::McTrackLabels& labels, |
| 64 | + const aod::ECALs&, |
| 65 | + const aod::Collisions& colls) |
| 66 | + { |
| 67 | + for (auto& track : tracks) { |
| 68 | + if (!track.has_ecal()) |
| 69 | + continue; |
| 70 | + histos.fill(HIST("energy"), track.ecal().energy()); |
| 71 | + } |
| 72 | + } |
| 73 | +}; |
| 74 | + |
| 75 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfg) |
| 76 | +{ |
| 77 | + auto workflow = WorkflowSpec{adaptAnalysisTask<ecalIndexBuilder>(cfg)}; |
| 78 | + workflow.push_back(adaptAnalysisTask<ecalQaMc>(cfg)); |
| 79 | + return workflow; |
| 80 | +} |
0 commit comments