Skip to content

Commit e17cbd5

Browse files
authored
PWGUD: Analysis in photonuclear events (#5095)
* PWGUD: Analysis in photonuclear events * formatting issues * update with process switch * ; * Update * format issue * new changes * new changes * new changes * new changes * new changes * new changes * new changes * new changes * new changes * new changes
1 parent e7a971c commit e17cbd5

4 files changed

Lines changed: 530 additions & 42 deletions

File tree

PWGMM/Lumi/Tasks/lumiStability.cxx

Lines changed: 165 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@
1616
#include "Framework/runDataProcessing.h"
1717
#include "Framework/AnalysisTask.h"
1818
#include "Framework/AnalysisDataModel.h"
19+
#include "Common/DataModel/EventSelection.h"
1920
#include "Common/DataModel/TrackSelectionTables.h"
2021
#include "Framework/ASoAHelpers.h"
2122
#include "DataFormatsFDD/Digit.h"
2223
#include "Framework/ASoA.h"
2324

2425
using namespace o2;
2526
using namespace o2::framework;
27+
using namespace o2::aod::evsel;
28+
2629
using BCsWithTimestamps = soa::Join<aod::BCs, aod::Timestamps>;
30+
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
2731

2832
int nBCsPerOrbit = 3564;
2933

@@ -33,39 +37,42 @@ struct lumiStabilityTask {
3337

3438
void init(InitContext const&)
3539
{
36-
const AxisSpec axisFDDTriggger{nBCsPerOrbit, -0.5f, nBCsPerOrbit - 0.5f};
37-
const AxisSpec axisFT0Triggger{nBCsPerOrbit, -0.5f, nBCsPerOrbit - 0.5f};
38-
const AxisSpec axisFV0Triggger{nBCsPerOrbit, -0.5f, nBCsPerOrbit - 0.5f};
40+
const AxisSpec axisTriggger{nBCsPerOrbit, -0.5f, nBCsPerOrbit - 0.5f};
3941

4042
// histo about triggers
41-
histos.add("FDD/bcVertexTrigger", "vertex trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisFDDTriggger});
42-
histos.add("FDD/bcVertexTriggerCoincidence", "vertex trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisFDDTriggger});
43-
histos.add("FDD/bcSCentralTrigger", "scentral trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisFDDTriggger});
44-
histos.add("FDD/bcSCentralTriggerCoincidence", "scentral trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisFDDTriggger});
45-
histos.add("FDD/bcVSCTrigger", "vertex and scentral trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisFDDTriggger});
46-
histos.add("FDD/bcVSCTriggerCoincidence", "vertex and scentral trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisFDDTriggger});
47-
histos.add("FDD/bcCentralTrigger", "central trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisFDDTriggger});
48-
histos.add("FDD/bcCentralTriggerCoincidence", "central trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisFDDTriggger});
49-
histos.add("FDD/bcVCTrigger", "vertex and central trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisFDDTriggger});
50-
histos.add("FDD/bcVCTriggerCoincidence", "vertex and central trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisFDDTriggger});
51-
52-
histos.add("FT0/bcVertexTrigger", "vertex trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisFT0Triggger});
53-
histos.add("FT0/bcSCentralTrigger", "Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisFT0Triggger});
54-
histos.add("FT0/bcVSCTrigger", "vertex and Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisFT0Triggger});
55-
histos.add("FT0/bcCentralTrigger", "central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisFT0Triggger});
56-
histos.add("FT0/bcVCTrigger", "vertex and central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisFT0Triggger});
57-
histos.add("FT0/bcSCentralCentralTrigger", "Scentral and central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisFT0Triggger});
58-
59-
histos.add("FV0/bcOutTrigger", "Out trigger per BC (FV0);BC in V0; counts", kTH1F, {axisFV0Triggger});
60-
histos.add("FV0/bcInTrigger", "In trigger per BC (FV0);BC in V0; counts", kTH1F, {axisFV0Triggger});
61-
histos.add("FV0/bcSCenTrigger", "SCen trigger per BC (FV0);BC in V0; counts", kTH1F, {axisFV0Triggger});
62-
histos.add("FV0/bcCenTrigger", "Out trigger per BC (FV0);BC in V0; counts", kTH1F, {axisFV0Triggger});
63-
histos.add("FV0/bcSCenCenTrigger", "SCen and Cen trigger per BC (FV0);BC in V0; counts", kTH1F, {axisFV0Triggger});
43+
histos.add("FDD/bcVertexTrigger", "vertex trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger});
44+
histos.add("FDD/bcVertexTriggerCoincidence", "vertex trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger});
45+
histos.add("FDD/bcSCentralTrigger", "scentral trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger});
46+
histos.add("FDD/bcSCentralTriggerCoincidence", "scentral trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger});
47+
histos.add("FDD/bcVSCTrigger", "vertex and scentral trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger});
48+
histos.add("FDD/bcVSCTriggerCoincidence", "vertex and scentral trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger});
49+
histos.add("FDD/bcCentralTrigger", "central trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger});
50+
histos.add("FDD/bcCentralTriggerCoincidence", "central trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger});
51+
histos.add("FDD/bcVCTrigger", "vertex and central trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger});
52+
histos.add("FDD/bcVCTriggerCoincidence", "vertex and central trigger per BC (FDD) with coincidences;BC in FDD; counts", kTH1F, {axisTriggger});
53+
54+
histos.add("FT0/bcVertexTrigger", "vertex trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger});
55+
histos.add("FT0/bcSCentralTrigger", "Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger});
56+
histos.add("FT0/bcVSCTrigger", "vertex and Scentral trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger});
57+
histos.add("FT0/bcCentralTrigger", "central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger});
58+
histos.add("FT0/bcVCTrigger", "vertex and central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger});
59+
histos.add("FT0/bcSCentralCentralTrigger", "Scentral and central trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger});
60+
61+
histos.add("FV0/bcOutTrigger", "Out trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger});
62+
histos.add("FV0/bcInTrigger", "In trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger});
63+
histos.add("FV0/bcSCenTrigger", "SCen trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger});
64+
histos.add("FV0/bcCenTrigger", "Out trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger});
65+
histos.add("FV0/bcSCenCenTrigger", "SCen and Cen trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger});
6466
}
6567

6668
bool checkAnyCoincidence(const std::vector<int>& channels)
6769
{
68-
std::map<int, int> channelPairs = {{0, 4}, {1, 5}, {2, 6}, {4, 7}};
70+
constexpr std::pair<int, int> pair0 = {0, 4};
71+
constexpr std::pair<int, int> pair1 = {1, 5};
72+
constexpr std::pair<int, int> pair2 = {2, 6};
73+
constexpr std::pair<int, int> pair3 = {3, 7};
74+
constexpr std::array<std::pair<int, int>, 4> channelPairs = {pair0, pair1, pair2, pair3};
75+
// std::map<int, int> channelPairs = {{0, 4}, {1, 5}, {2, 6}, {3, 7}};
6976
for (const auto& pair : channelPairs) {
7077
if (std::find(channels.begin(), channels.end(), pair.first) != channels.end() &&
7178
std::find(channels.begin(), channels.end(), pair.second) != channels.end()) {
@@ -75,17 +82,59 @@ struct lumiStabilityTask {
7582
return false;
7683
}
7784

78-
void processFDDFT0(aod::FT0s const& ft0s, aod::FDDs const& fdds, aod::BCsWithTimestamps const&)
85+
void processMain(aod::FT0s const& ft0s, aod::FDDs const& fdds, aod::FV0As const& fv0s, BCsRun3 const& bcs)
7986
{
87+
int CountNormal(0), CountPastProtec(0);
8088
for (auto const& fdd : fdds) {
81-
auto bc = fdd.bc_as<BCsWithTimestamps>();
82-
if (bc.timestamp() == false) {
89+
auto bc = fdd.bc_as<BCsRun3>();
90+
if (bc.timestamp() == 0) {
8391
continue;
8492
}
8593

8694
Long64_t globalBC = bc.globalBC();
8795
int localBC = globalBC % nBCsPerOrbit;
8896

97+
int deltaIndex = 0; // backward move counts
98+
int deltaBC = 0; // current difference wrt globalBC
99+
int maxDeltaBC = 5; // maximum difference
100+
bool pastActivityFDD = false;
101+
while (deltaBC < maxDeltaBC) {
102+
deltaIndex++;
103+
if (bc.globalIndex() - deltaIndex < 0) {
104+
break;
105+
}
106+
const auto& bc_past = bcs.iteratorAt(bc.globalIndex() - deltaIndex);
107+
deltaBC = globalBC - bc_past.globalBC();
108+
if (deltaBC < maxDeltaBC) {
109+
pastActivityFDD |= bc_past.has_fdd();
110+
}
111+
}
112+
deltaIndex = 0;
113+
deltaBC = 0;
114+
115+
bool futureActivityFDD = false;
116+
while (deltaBC < maxDeltaBC) {
117+
deltaIndex++;
118+
if (bc.globalIndex() + deltaIndex >= bcs.size()) {
119+
break;
120+
}
121+
const auto& bc_future = bcs.iteratorAt(bc.globalIndex() + deltaIndex);
122+
deltaBC = bc_future.globalBC() - globalBC;
123+
if (deltaBC < maxDeltaBC) {
124+
futureActivityFDD |= bc_future.has_fdd();
125+
}
126+
}
127+
128+
CountNormal++;
129+
if (pastActivityFDD == true || futureActivityFDD == true) {
130+
CountPastProtec++;
131+
continue;
132+
}
133+
/*if (pastActivityFDD == true) {
134+
CountPastProtec++;
135+
continue;
136+
}*/
137+
89138
std::bitset<8> fddTriggers = fdd.triggerMask();
90139
bool vertex = fddTriggers[o2::fdd::Triggers::bitVertex];
91140
bool scentral = fddTriggers[o2::fdd::Triggers::bitSCen];
@@ -144,14 +193,52 @@ struct lumiStabilityTask {
144193
} // loop over FDD events
145194

146195
for (auto const& ft0 : ft0s) {
147-
auto bc = ft0.bc_as<BCsWithTimestamps>();
148-
if (bc.timestamp() == false) {
196+
auto bc = ft0.bc_as<BCsRun3>();
197+
if (bc.timestamp() == 0) {
149198
continue;
150199
}
151200

152201
Long64_t globalBC = bc.globalBC();
153202
int localBC = globalBC % nBCsPerOrbit;
154203

204+
int deltaIndex = 0; // backward move counts
205+
int deltaBC = 0; // current difference wrt globalBC
206+
int maxDeltaBC = 5; // maximum difference
207+
bool pastActivityFT0 = false;
208+
while (deltaBC < maxDeltaBC) {
209+
deltaIndex++;
210+
if (bc.globalIndex() - deltaIndex < 0) {
211+
break;
212+
}
213+
const auto& bc_past = bcs.iteratorAt(bc.globalIndex() - deltaIndex);
214+
deltaBC = globalBC - bc_past.globalBC();
215+
if (deltaBC < maxDeltaBC) {
216+
pastActivityFT0 |= bc_past.has_ft0();
217+
}
218+
}
219+
deltaIndex = 0;
220+
deltaBC = 0;
221+
222+
bool futureActivityFT0 = false;
223+
while (deltaBC < maxDeltaBC) {
224+
deltaIndex++;
225+
if (bc.globalIndex() + deltaIndex >= bcs.size()) {
226+
break;
227+
}
228+
const auto& bc_future = bcs.iteratorAt(bc.globalIndex() + deltaIndex);
229+
deltaBC = bc_future.globalBC() - globalBC;
230+
if (deltaBC < maxDeltaBC) {
231+
futureActivityFT0 |= bc_future.has_ft0();
232+
}
233+
}
234+
235+
if (pastActivityFT0 == true || futureActivityFT0 == true) {
236+
continue;
237+
}
238+
/*if (pastActivityFT0 == true) {
239+
continue;
240+
}*/
241+
155242
std::bitset<8> fT0Triggers = ft0.triggerMask();
156243
bool vertex = fT0Triggers[o2::fdd::Triggers::bitVertex];
157244

@@ -179,21 +266,55 @@ struct lumiStabilityTask {
179266
}
180267
}
181268
} // loop over FT0 events
182-
} // end processFDDFT0
183-
184-
PROCESS_SWITCH(lumiStabilityTask, processFDDFT0, "Process FDD and FT0 to lumi stability analysis", true);
185269

186-
void processV0(aod::FV0As const& fv0s, aod::BCsWithTimestamps const&)
187-
{
188270
for (auto const& fv0 : fv0s) {
189-
auto bc = fv0.bc_as<BCsWithTimestamps>();
190-
if (bc.timestamp() == false) {
271+
auto bc = fv0.bc_as<BCsRun3>();
272+
if (bc.timestamp() == 0) {
191273
continue;
192274
}
193275

194276
Long64_t globalBC = bc.globalBC();
195277
int localBC = globalBC % nBCsPerOrbit;
196278

279+
int deltaIndex = 0; // backward move counts
280+
int deltaBC = 0; // current difference wrt globalBC
281+
int maxDeltaBC = 5; // maximum difference
282+
bool pastActivityV0A = false;
283+
while (deltaBC < maxDeltaBC) {
284+
deltaIndex++;
285+
if (bc.globalIndex() - deltaIndex < 0) {
286+
break;
287+
}
288+
const auto& bc_past = bcs.iteratorAt(bc.globalIndex() - deltaIndex);
289+
deltaBC = globalBC - bc_past.globalBC();
290+
if (deltaBC < maxDeltaBC) {
291+
pastActivityV0A |= bc_past.has_fv0a();
292+
}
293+
}
294+
deltaIndex = 0;
295+
deltaBC = 0;
296+
297+
bool futureActivityV0A = false;
298+
while (deltaBC < maxDeltaBC) {
299+
deltaIndex++;
300+
if (bc.globalIndex() + deltaIndex >= bcs.size()) {
301+
break;
302+
}
303+
const auto& bc_future = bcs.iteratorAt(bc.globalIndex() + deltaIndex);
304+
deltaBC = bc_future.globalBC() - globalBC;
305+
if (deltaBC < maxDeltaBC) {
306+
futureActivityV0A |= bc_future.has_fv0a();
307+
}
308+
}
309+
310+
if (pastActivityV0A == true || futureActivityV0A == true) {
311+
continue;
312+
}
313+
314+
/*if (pastActivityV0A == true) {
315+
continue;
316+
}*/
317+
197318
std::bitset<8> fv0Triggers = fv0.triggerMask();
198319
bool aOut = fv0Triggers[o2::fdd::Triggers::bitAOut];
199320
bool aIn = fv0Triggers[o2::fdd::Triggers::bitAIn];
@@ -219,9 +340,12 @@ struct lumiStabilityTask {
219340
}
220341
}
221342
} // loop over V0 events
222-
} // end processV0
343+
std::cout << "************ >>>>>>>>>>>>>> "
344+
<< "Whithout Past Protection: " << CountNormal << " "
345+
<< "Avoided Whith Past Protection: " << CountPastProtec << "<<<<<<<<<<<< ********************" << std::endl;
346+
} // end processMain
223347

224-
PROCESS_SWITCH(lumiStabilityTask, processV0, "Process V0 to lumi stability analysis", true);
348+
PROCESS_SWITCH(lumiStabilityTask, processMain, "Process FDD and FT0 to lumi stability analysis", true);
225349
};
226350

227351
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

PWGMM/Mult/DataModel/ReducedTables.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#ifndef PWGMM_MULT_DATAMODEL_REDUCEDTABLES_H_
1313
#define PWGMM_MULT_DATAMODEL_REDUCEDTABLES_H_
14+
#include <vector>
15+
1416
#include "Framework/AnalysisDataModel.h"
1517
#include "Common/DataModel/Multiplicity.h"
1618
#include "Common/DataModel/Centrality.h"
@@ -34,7 +36,7 @@ namespace rcol
3436
{
3537
DECLARE_SOA_INDEX_COLUMN(RBC, rbc);
3638
DECLARE_SOA_COLUMN(MapEtaPhi, mapetaphi, std::vector<int>);
37-
}
39+
} // namespace rcol
3840

3941
#define Ccols o2::soa::Index<>, \
4042
rcol::RBCId, \

PWGUD/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,8 @@ o2physics_add_dpl_workflow(exclusive-phi
107107
SOURCES exclusivePhi.cxx
108108
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector
109109
COMPONENT_NAME Analysis)
110+
111+
o2physics_add_dpl_workflow(upc-photonuclear-jmg
112+
SOURCES upcPhotonuclearAnalysisJMG.cxx
113+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsBase O2::DetectorsCommonDataFormats
114+
COMPONENT_NAME Analysis)

0 commit comments

Comments
 (0)