Skip to content

Commit 11065a1

Browse files
author
jokonig
committed
[PWGEM] PhotonMeson: Add task for event normalization on derived data
- If only events with a certain number of photons (or any other kind of selection) are stored in the derived data, the table "PMEvSelBits" in the event selection task can store the event selection bits. Hence, the number of selected events before the specific selection on the number of photons etc. can be retrieved. - This new task just loops over these event-selection bits and stores them in a histogram. - For future: Also store it as a function of multiplicity etc.
1 parent a95e57f commit 11065a1

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

PWGEM/PhotonMeson/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,8 @@ o2physics_add_dpl_workflow(emcal-mc-task
190190
SOURCES emcalMcTask.cxx
191191
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore
192192
COMPONENT_NAME Analysis)
193+
194+
o2physics_add_dpl_workflow(event-normalization-task
195+
SOURCES eventNormalizationTask.cxx
196+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
197+
COMPONENT_NAME Analysis)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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 eventNormalizationTask.cxx
13+
/// \brief task to produce histogram with event counter information
14+
/// \author Joshua Konig, joshua.konig@cern.ch
15+
16+
#include "PWGEM/PhotonMeson/DataModel/EventTables.h"
17+
18+
#include <Framework/AnalysisDataModel.h>
19+
#include <Framework/AnalysisTask.h>
20+
#include <Framework/HistogramRegistry.h>
21+
#include <Framework/HistogramSpec.h>
22+
#include <Framework/InitContext.h>
23+
#include <Framework/runDataProcessing.h>
24+
25+
#include <TH1D.h>
26+
27+
#include <string_view>
28+
29+
using namespace o2;
30+
using namespace o2::aod;
31+
using namespace o2::framework;
32+
using namespace o2::framework::expressions;
33+
using namespace o2::soa;
34+
35+
struct EventNormalizationTask {
36+
37+
HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
38+
39+
void init(InitContext& /*context*/)
40+
{
41+
// Names derived from EventAcceptance bits in EventTables.h
42+
std::vector<std::string> vecLabelNames = {
43+
"all",
44+
"has MC coll",
45+
"good zVtx",
46+
"is FT0AND",
47+
"No TFB",
48+
"ITS ROFB",
49+
"Same bunch Pileup",
50+
"ZVtxFT0PV",
51+
"No coll in time range",
52+
"good track occi",
53+
"Good FT0 occupancy",
54+
"kTVXinEMC",
55+
"Good centrality",
56+
"Good RCT",
57+
"Good Sel8"};
58+
fRegistry.add("EventNormalization/hEventCounter", "Event Counter;category;#it{N}_{evt}", kTH1D, {{static_cast<int>(vecLabelNames.size()), -0.5, -0.5 + static_cast<int>(vecLabelNames.size())}}, false);
59+
for (size_t i = 0; i < vecLabelNames.size(); ++i) {
60+
fRegistry.get<TH1>(HIST("EventNormalization/hEventCounter"))->GetXaxis()->SetBinLabel(i + 1, vecLabelNames[i].c_str());
61+
}
62+
}
63+
64+
// Process function only takes the entries and fills them into the histogram. This is done per DF and not per collision
65+
void processNorm(o2::aod::PMEvSelBit const& evSelBit)
66+
{
67+
68+
auto vecEvSelBits = evSelBit.eventSelectionBit();
69+
for (size_t i = 0; i < vecEvSelBits.size(); ++i) {
70+
fRegistry.fill(HIST("EventNormalization/hEventCounter"), i, vecEvSelBits[i]);
71+
}
72+
}
73+
74+
PROCESS_SWITCH(EventNormalizationTask, processNorm, "run event normalization task", true);
75+
};
76+
77+
WorkflowSpec defineDataProcessing(ConfigContext const& context)
78+
{
79+
return WorkflowSpec{
80+
adaptAnalysisTask<EventNormalizationTask>(context, TaskName{"event-normalization-task"})};
81+
}

0 commit comments

Comments
 (0)