Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PWGEM/PhotonMeson/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,8 @@ o2physics_add_dpl_workflow(emcal-mc-task
SOURCES emcalMcTask.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(event-normalization-task
SOURCES eventNormalizationTask.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
85 changes: 85 additions & 0 deletions PWGEM/PhotonMeson/Tasks/eventNormalizationTask.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file eventNormalizationTask.cxx
/// \brief task to produce histogram with event counter information
/// \author Joshua Konig, joshua.konig@cern.ch

#include "PWGEM/PhotonMeson/DataModel/EventTables.h"

#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisTask.h>
#include <Framework/Configurable.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>
#include <Framework/InitContext.h>
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>

#include <TH1.h>

#include <cstddef>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::soa;

struct EventNormalizationTask {

HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};

void init(InitContext& /*context*/)
{
// Names derived from EventAcceptance bits in EventTables.h
std::vector<std::string> vecLabelNames = {
"all",
"has MC coll",
"good zVtx",
"is FT0AND",
"No TFB",
"ITS ROFB",
"Same bunch Pileup",
"ZVtxFT0PV",
"No coll in time range",
"good track occi",
"Good FT0 occupancy",
"kTVXinEMC",
"Good centrality",
"Good RCT",
"Good Sel8"};
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);
for (size_t i = 0; i < vecLabelNames.size(); ++i) {
fRegistry.get<TH1>(HIST("EventNormalization/hEventCounter"))->GetXaxis()->SetBinLabel(i + 1, vecLabelNames[i].c_str());
}
}

// Process function only takes the entries and fills them into the histogram. This is done per DF and not per collision
void processNorm(o2::aod::PMEvSelBit const& evSelBit)
{

auto vecEvSelBits = evSelBit.eventSelectionBit();
for (size_t i = 0; i < vecEvSelBits.size(); ++i) {
fRegistry.fill(HIST("EventNormalization/hEventCounter"), i, vecEvSelBits[i]);
}
}

PROCESS_SWITCH(EventNormalizationTask, processNorm, "run event normalization task", true);
};

WorkflowSpec defineDataProcessing(ConfigContext const& context)
{
return WorkflowSpec{
adaptAnalysisTask<EventNormalizationTask>(context, TaskName{"event-normalization-task"})};
}
Loading