|
9 | 9 | // granted to it by virtue of its status as an Intergovernmental Organization |
10 | 10 | // or submit itself to any jurisdiction. |
11 | 11 |
|
12 | | -#include <cmath> |
13 | | -#include <vector> |
14 | | - |
15 | | -#include "Framework/runDataProcessing.h" |
16 | | -#include "Framework/AnalysisTask.h" |
17 | | -#include "Framework/AnalysisDataModel.h" |
18 | | -#include "Framework/ASoAHelpers.h" |
19 | | -#include "Framework/HistogramRegistry.h" |
20 | | -#include "Framework/Configurable.h" |
21 | | -#include "Framework/InitContext.h" |
22 | | -#include "Framework/O2DatabasePDGPlugin.h" |
23 | | - |
24 | | -#include "ReconstructionDataFormats/Track.h" |
25 | | -#include "Common/DataModel/Multiplicity.h" |
26 | | -#include "Common/DataModel/EventSelection.h" |
27 | | -#include "Common/DataModel/TrackSelectionTables.h" |
28 | 12 | #include "Common/Core/TrackSelection.h" |
29 | 13 | #include "Common/Core/TrackSelectionDefaults.h" |
| 14 | +#include "Common/DataModel/EventSelection.h" |
| 15 | +#include "Common/DataModel/Multiplicity.h" |
| 16 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 17 | + |
| 18 | +#include <Framework/ASoAHelpers.h> |
| 19 | +#include <Framework/AnalysisDataModel.h> |
| 20 | +#include <Framework/AnalysisTask.h> |
| 21 | +#include <Framework/Configurable.h> |
| 22 | +#include <Framework/HistogramRegistry.h> |
| 23 | +#include <Framework/InitContext.h> |
| 24 | +#include <Framework/O2DatabasePDGPlugin.h> |
| 25 | +#include <Framework/runDataProcessing.h> |
| 26 | +#include <ReconstructionDataFormats/Track.h> |
| 27 | + |
| 28 | +#include <cmath> |
| 29 | +#include <vector> |
30 | 30 |
|
31 | 31 | using namespace o2; |
32 | 32 | using namespace o2::framework; |
@@ -72,10 +72,10 @@ struct flattenicityTask { |
72 | 72 | // Define histograms |
73 | 73 | AxisSpec flatBins = {40, 0.0, 1.0, "#rho"}; |
74 | 74 | AxisSpec nchBins = {100, -0.5, 99.5, "N_{ch}"}; |
75 | | - |
76 | | - registry.add("hFlattenicityTruth", "Truth flattenicity; 1-#rho; Events", |
| 75 | + |
| 76 | + registry.add("hFlattenicityTruth", "Truth flattenicity; 1-#rho; Events", |
77 | 77 | HistType::kTH1D, {flatBins}); |
78 | | - registry.add("hFlattenicityReco", "Reco flattenicity; 1-#rho; Events", |
| 78 | + registry.add("hFlattenicityReco", "Reco flattenicity; 1-#rho; Events", |
79 | 79 | HistType::kTH1D, {flatBins}); |
80 | 80 | registry.add("hFlattenicityCorrelation", "Truth vs Reco; 1-#rho_{truth}; 1-#rho_{reco}", |
81 | 81 | HistType::kTH2D, {flatBins, flatBins}); |
@@ -104,55 +104,62 @@ struct flattenicityTask { |
104 | 104 | // --- Flattenicity calculation --- |
105 | 105 | float calculateFlattenicity(const std::vector<float>& counts) |
106 | 106 | { |
107 | | - if (counts.size() != N_CELL) return -1; |
108 | | - |
| 107 | + if (counts.size() != N_CELL) |
| 108 | + return -1; |
| 109 | + |
109 | 110 | float total = 0; |
110 | | - for (auto c : counts) total += c; |
111 | | - if (total <= 0) return -1; |
112 | | - |
| 111 | + for (auto c : counts) |
| 112 | + total += c; |
| 113 | + if (total <= 0) |
| 114 | + return -1; |
| 115 | + |
113 | 116 | float mean = total / N_CELL; |
114 | | - if (mean <= 0) return -1; |
115 | | - |
| 117 | + if (mean <= 0) |
| 118 | + return -1; |
| 119 | + |
116 | 120 | float sumSq = 0; |
117 | 121 | for (auto c : counts) { |
118 | 122 | sumSq += (c - mean) * (c - mean); |
119 | 123 | } |
120 | | - |
| 124 | + |
121 | 125 | float rho = std::sqrt(sumSq / (N_CELL * N_CELL)) / mean; |
122 | 126 | return 1.0f - rho; |
123 | 127 | } |
124 | 128 |
|
125 | 129 | // --- Process Data --- |
126 | | - void processData(aod::Collision const& collision, |
| 130 | + void processData(aod::Collision const& collision, |
127 | 131 | soa::Filtered<aod::Tracks> const& tracks, |
128 | 132 | aod::FT0s const& ft0s) |
129 | 133 | { |
130 | 134 | // Event selection (Paola/Jesus) |
131 | | - if (!collision.sel8()) return; |
132 | | - if (std::abs(collision.posZ()) >= 10.0f) return; |
133 | | - |
| 135 | + if (!collision.sel8()) |
| 136 | + return; |
| 137 | + if (std::abs(collision.posZ()) >= 10.0f) |
| 138 | + return; |
| 139 | + |
134 | 140 | // Track loop for Nch |
135 | 141 | int nch = 0; |
136 | 142 | for (auto& track : tracks) { |
137 | | - if (!mySelectionPrim.IsSelected(track)) continue; |
| 143 | + if (!mySelectionPrim.IsSelected(track)) |
| 144 | + continue; |
138 | 145 | nch++; |
139 | 146 | } |
140 | 147 | registry.fill(HIST("hNch"), nch); |
141 | | - |
| 148 | + |
142 | 149 | // FT0 flattenicity |
143 | 150 | auto ft0 = collision.ft0(); |
144 | 151 | if (ft0.hasAmplitudeA() && ft0.hasAmplitudeC()) { |
145 | 152 | auto ampA = ft0.amplitudeA(); |
146 | 153 | auto ampC = ft0.amplitudeC(); |
147 | | - |
| 154 | + |
148 | 155 | std::vector<float> counts(N_CELL, 0.0f); |
149 | 156 | for (int i = 0; i < ampA.size() && i < N_CH_A; ++i) { |
150 | 157 | counts[i] = ampA[i]; |
151 | 158 | } |
152 | 159 | for (int i = 0; i < ampC.size() && i < N_CH_C; ++i) { |
153 | 160 | counts[N_CH_A + i] = ampC[i]; |
154 | 161 | } |
155 | | - |
| 162 | + |
156 | 163 | float flat = calculateFlattenicity(counts); |
157 | 164 | if (flat >= 0) { |
158 | 165 | registry.fill(HIST("hFlattenicityReco"), flat); |
|
0 commit comments