|
| 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 | +#include "Framework/runDataProcessing.h" |
| 13 | +#include "Framework/AnalysisTask.h" |
| 14 | +#include "Framework/AnalysisDataModel.h" |
| 15 | + |
| 16 | +using namespace o2; |
| 17 | +using namespace o2::framework; |
| 18 | + |
| 19 | +struct TracksExtraV002Converter { |
| 20 | + Produces<aod::StoredTracksExtra_002> tracksExtra_002; |
| 21 | + |
| 22 | + void processV000ToV002(aod::TracksExtra_000 const& tracksExtra_000) |
| 23 | + { |
| 24 | + |
| 25 | + for (const auto& track0 : tracksExtra_000) { |
| 26 | + |
| 27 | + uint32_t itsClusterSizes = 0; |
| 28 | + for (int layer = 0; layer < 7; layer++) { |
| 29 | + if (track0.itsClusterMap() & (1 << layer)) { |
| 30 | + itsClusterSizes |= (0xf << (layer * 4)); |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + int8_t TPCNClsFindableMinusPID = 0; |
| 35 | + |
| 36 | + tracksExtra_002(track0.tpcInnerParam(), |
| 37 | + track0.flags(), |
| 38 | + itsClusterSizes, |
| 39 | + track0.tpcNClsFindable(), |
| 40 | + track0.tpcNClsFindableMinusFound(), |
| 41 | + TPCNClsFindableMinusPID, |
| 42 | + track0.tpcNClsFindableMinusCrossedRows(), |
| 43 | + track0.tpcNClsShared(), |
| 44 | + track0.trdPattern(), |
| 45 | + track0.itsChi2NCl(), |
| 46 | + track0.tpcChi2NCl(), |
| 47 | + track0.trdChi2(), |
| 48 | + track0.tofChi2(), |
| 49 | + track0.tpcSignal(), |
| 50 | + track0.trdSignal(), |
| 51 | + track0.length(), |
| 52 | + track0.tofExpMom(), |
| 53 | + track0.trackEtaEmcal(), |
| 54 | + track0.trackPhiEmcal(), |
| 55 | + track0.trackTime(), |
| 56 | + track0.trackTimeRes()); |
| 57 | + } |
| 58 | + } |
| 59 | + PROCESS_SWITCH(TracksExtraV002Converter, processV000ToV002, "process v000-to-v002 conversion", false); |
| 60 | + |
| 61 | + void processV001ToV002(aod::TracksExtra_001 const& tracksExtra_001) |
| 62 | + { |
| 63 | + |
| 64 | + for (const auto& track1 : tracksExtra_001) { |
| 65 | + |
| 66 | + int8_t TPCNClsFindableMinusPID = 0; |
| 67 | + |
| 68 | + tracksExtra_002(track1.tpcInnerParam(), |
| 69 | + track1.flags(), |
| 70 | + track1.itsClusterSizes(), |
| 71 | + track1.tpcNClsFindable(), |
| 72 | + track1.tpcNClsFindableMinusFound(), |
| 73 | + TPCNClsFindableMinusPID, |
| 74 | + track1.tpcNClsFindableMinusCrossedRows(), |
| 75 | + track1.tpcNClsShared(), |
| 76 | + track1.trdPattern(), |
| 77 | + track1.itsChi2NCl(), |
| 78 | + track1.tpcChi2NCl(), |
| 79 | + track1.trdChi2(), |
| 80 | + track1.tofChi2(), |
| 81 | + track1.tpcSignal(), |
| 82 | + track1.trdSignal(), |
| 83 | + track1.length(), |
| 84 | + track1.tofExpMom(), |
| 85 | + track1.trackEtaEmcal(), |
| 86 | + track1.trackPhiEmcal(), |
| 87 | + track1.trackTime(), |
| 88 | + track1.trackTimeRes()); |
| 89 | + } |
| 90 | + } |
| 91 | + PROCESS_SWITCH(TracksExtraV002Converter, processV001ToV002, "process v001-to-v002 conversion", false); |
| 92 | +}; |
| 93 | + |
| 94 | +/// Spawn the extended table for TracksExtra002 to avoid the call to the internal spawner and a consequent circular dependency |
| 95 | +struct TracksExtraSpawner { |
| 96 | + Spawns<aod::TracksExtra_002> tracksExtra_002; |
| 97 | +}; |
| 98 | + |
| 99 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 100 | +{ |
| 101 | + return WorkflowSpec{ |
| 102 | + adaptAnalysisTask<TracksExtraV002Converter>(cfgc), |
| 103 | + adaptAnalysisTask<TracksExtraSpawner>(cfgc), |
| 104 | + }; |
| 105 | +} |
0 commit comments