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
6 changes: 4 additions & 2 deletions PWGEM/PhotonMeson/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# or submit itself to any jurisdiction.

o2physics_add_library(PWGEMPhotonMesonCore
SOURCES V0PhotonCut.cxx
SOURCES EMEventCut.cxx
V0PhotonCut.cxx
PHOSPhotonCut.cxx
DalitzEECut.cxx
EMCPhotonCut.cxx
Expand All @@ -20,7 +21,8 @@ o2physics_add_library(PWGEMPhotonMesonCore
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore)

o2physics_target_root_dictionary(PWGEMPhotonMesonCore
HEADERS V0PhotonCut.h
HEADERS EMEventCut.h
V0PhotonCut.h
DalitzEECut.h
PHOSPhotonCut.h
EMCPhotonCut.h
Expand Down
36 changes: 31 additions & 5 deletions PWGEM/PhotonMeson/Core/CutsLibrary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,33 @@
//
#include "PWGEM/PhotonMeson/Core/CutsLibrary.h"

V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName)
EMEventCut* o2::aod::pwgem::photon::eventcuts::GetCut(const char* cutName)
{
EMEventCut* cut = new EMEventCut(cutName, cutName);
std::string nameStr = cutName;

if (!nameStr.compare("minbias")) {
cut->SetRequireFT0AND(true);
cut->SetZvtxRange(-10.f, +10.f);
cut->SetRequireNoTFB(true);
cut->SetRequireNoITSROFB(false);
return cut;
}

if (!nameStr.compare("nocut")) {
cut->SetRequireFT0AND(false);
cut->SetZvtxRange(-1e+10, +1e+10);
cut->SetRequireNoTFB(false);
cut->SetRequireNoITSROFB(false);
return cut;
}

delete cut;
LOGF(info, Form("Did not find cut %s", cutName));
return nullptr;
}

V0PhotonCut* o2::aod::pwgem::photon::pcmcuts::GetCut(const char* cutName)
{
V0PhotonCut* cut = new V0PhotonCut(cutName, cutName);
std::string nameStr = cutName;
Expand Down Expand Up @@ -351,7 +377,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName)
return nullptr;
}

DalitzEECut* o2::aod::dalitzeecuts::GetCut(const char* cutName)
DalitzEECut* o2::aod::pwgem::photon::dalitzeecuts::GetCut(const char* cutName)
{
DalitzEECut* cut = new DalitzEECut(cutName, cutName);
std::string nameStr = cutName;
Expand Down Expand Up @@ -1269,7 +1295,7 @@ DalitzEECut* o2::aod::dalitzeecuts::GetCut(const char* cutName)
return nullptr;
}

PHOSPhotonCut* o2::aod::phoscuts::GetCut(const char* cutName)
PHOSPhotonCut* o2::aod::pwgem::photon::phoscuts::GetCut(const char* cutName)
{
PHOSPhotonCut* cut = new PHOSPhotonCut(cutName, cutName);
std::string nameStr = cutName;
Expand Down Expand Up @@ -1304,7 +1330,7 @@ PHOSPhotonCut* o2::aod::phoscuts::GetCut(const char* cutName)
return nullptr;
}

EMCPhotonCut* o2::aod::emccuts::GetCut(const char* cutName)
EMCPhotonCut* o2::aod::pwgem::photon::emccuts::GetCut(const char* cutName)
{
EMCPhotonCut* cut = new EMCPhotonCut(cutName, cutName);
std::string nameStr = cutName;
Expand Down Expand Up @@ -1363,7 +1389,7 @@ EMCPhotonCut* o2::aod::emccuts::GetCut(const char* cutName)
return nullptr;
}

PairCut* o2::aod::paircuts::GetCut(const char* cutName)
PairCut* o2::aod::pwgem::photon::paircuts::GetCut(const char* cutName)
{
PairCut* cut = new PairCut(cutName, cutName);
std::string nameStr = cutName;
Expand Down
15 changes: 15 additions & 0 deletions PWGEM/PhotonMeson/Core/CutsLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define PWGEM_PHOTONMESON_CORE_CUTSLIBRARY_H_

#include <string>
#include "PWGEM/PhotonMeson/Core/EMEventCut.h"
#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h"
#include "PWGEM/PhotonMeson/Core/DalitzEECut.h"
#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h"
Expand All @@ -24,10 +25,23 @@

namespace o2::aod
{
namespace pwgem::photon
{
namespace eventcuts
{
EMEventCut* GetCut(const char* cutName);
} // namespace eventcuts

namespace pcmcuts
{
V0PhotonCut* GetCut(const char* cutName);
} // namespace pcmcuts

namespace pcmcuts
{
V0PhotonCut* GetCut(const char* cutName);
} // namespace pcmcuts

namespace dalitzeecuts
{
DalitzEECut* GetCut(const char* cutName);
Expand All @@ -48,5 +62,6 @@ namespace paircuts
PairCut* GetCut(const char* cutName);
} // namespace paircuts

} // namespace pwgem::photon
} // namespace o2::aod
#endif // PWGEM_PHOTONMESON_CORE_CUTSLIBRARY_H_
70 changes: 70 additions & 0 deletions PWGEM/PhotonMeson/Core/EMEventCut.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// 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.

//
// Class for em event selection
//

#include "Framework/Logger.h"
#include "PWGEM/PhotonMeson/Core/EMEventCut.h"

ClassImp(EMEventCut);

const char* EMEventCut::mCutNames[static_cast<int>(EMEventCut::EMEventCuts::kNCuts)] = {"RequireFT0AND", "Zvtx", "RequireNoTFB", "RequireNoITSROFB"};

void EMEventCut::SetRequireFT0AND(bool flag)
{
mRequireFT0AND = flag;
LOG(info) << "EM Event Cut, require FT0AND: " << mRequireFT0AND;
}

void EMEventCut::SetZvtxRange(float min, float max)
{
mMinZvtx = min;
mMaxZvtx = max;
LOG(info) << "EM Event Cut, set z vtx range: " << mMinZvtx << " - " << mMaxZvtx;
}

void EMEventCut::SetRequireNoTFB(bool flag)
{
mRequireNoTFB = flag;
LOG(info) << "EM Event Cut, require No TF border: " << mRequireNoTFB;
}

void EMEventCut::SetRequireNoITSROFB(bool flag)
{
mRequireNoITSROFB = flag;
LOG(info) << "EM Event Cut, require No ITS ROF border: " << mRequireNoITSROFB;
}

void EMEventCut::print() const
{
LOG(info) << "EM Event Cut:";
for (int i = 0; i < static_cast<int>(EMEventCuts::kNCuts); i++) {
switch (static_cast<EMEventCuts>(i)) {
case EMEventCuts::kFT0AND:
LOG(info) << mCutNames[i] << " = " << mRequireFT0AND;
break;
case EMEventCuts::kZvtx:
LOG(info) << mCutNames[i] << " in [" << mMinZvtx << ", " << mMaxZvtx << "]";
break;
case EMEventCuts::kNoTFB:
LOG(info) << mCutNames[i] << " = " << mRequireNoTFB;
break;
case EMEventCuts::kNoITSROFB:
LOG(info) << mCutNames[i] << " = " << mRequireNoITSROFB;
break;

default:
LOG(fatal) << "Cut unknown!";
}
}
}
99 changes: 99 additions & 0 deletions PWGEM/PhotonMeson/Core/EMEventCut.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// 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.

//
// Class for em photon event selection
//

#ifndef PWGEM_PHOTONMESON_CORE_EMEVENTCUT_H_
#define PWGEM_PHOTONMESON_CORE_EMEVENTCUT_H_

#include "TNamed.h"
#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/TriggerAliases.h"

using namespace std;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not pollute the global namespace!


class EMEventCut : public TNamed
{
public:
EMEventCut() = default;
EMEventCut(const char* name, const char* title) : TNamed(name, title) {}

enum class EMEventCuts : int {
kFT0AND, // i.e. sel8
kZvtx,
kNoTFB, // no time frame border
kNoITSROFB, // no ITS read out frame border
kNCuts
};

static const char* mCutNames[static_cast<int>(EMEventCuts::kNCuts)];

template <typename T>
bool IsSelected(T const& collision) const
{
if (!IsSelected(collision, EMEventCuts::kFT0AND)) {
return false;
}
if (!IsSelected(collision, EMEventCuts::kZvtx)) {
return false;
}
if (!IsSelected(collision, EMEventCuts::kNoTFB)) {
return false;
}
if (!IsSelected(collision, EMEventCuts::kNoITSROFB)) {
return false;
}
return true;
}

template <typename T>
bool IsSelected(T const& collision, const EMEventCuts& cut) const
{
switch (cut) {
case EMEventCuts::kFT0AND:
return collision.sel8();
// return collision.selection_bit(o2::aod::evsel::kIsTriggerTVX); // alternative way.

case EMEventCuts::kZvtx:
return mMinZvtx < collision.posZ() && collision.posZ() < mMaxZvtx;

case EMEventCuts::kNoTFB:
return collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder);

case EMEventCuts::kNoITSROFB:
return collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder);

default:
return false;
}
}

// Setters
void SetRequireFT0AND(bool flag);
void SetZvtxRange(float min, float max);
void SetRequireNoTFB(bool flag);
void SetRequireNoITSROFB(bool flag);

/// @brief Print the track selection
void print() const;

private:
bool mRequireFT0AND{true};
float mMinZvtx{-10.f}, mMaxZvtx{+10.f}; // range in pT
bool mRequireNoTFB{true};
bool mRequireNoITSROFB{true};

ClassDef(EMEventCut, 1);
};

#endif // PWGEM_PHOTONMESON_CORE_EMEVENTCUT_H_
17 changes: 12 additions & 5 deletions PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ using namespace std;
#include "Framework/Logger.h"
#include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h"

void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* histClass, const char* subGroup)
void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const char* histClass, const char* subGroup)
{
if (TString(histClass) == "Event") {
list->Add(new TH1F("hCollisionCounter", "hCollisionCounter", 5, 0.5f, 5.5f));
list->Add(new TH1F("hZvtx_before", "vertex z; Zvtx (cm)", 100, -50, +50));
list->Add(new TH1F("hZvtx_after", "vertex z; Zvtx (cm)", 100, -50, +50));
list->Add(new TH1F("hCollisionCounter", "hCollisionCounter", 10, 0.5f, 10.5f));
reinterpret_cast<TH1F*>(list->FindObject("hCollisionCounter"))->GetXaxis()->SetBinLabel(1, "all");
reinterpret_cast<TH1F*>(list->FindObject("hCollisionCounter"))->GetXaxis()->SetBinLabel(2, "No TF border");
reinterpret_cast<TH1F*>(list->FindObject("hCollisionCounter"))->GetXaxis()->SetBinLabel(3, "No ITS ROF border");
reinterpret_cast<TH1F*>(list->FindObject("hCollisionCounter"))->GetXaxis()->SetBinLabel(4, "FT0AND");
reinterpret_cast<TH1F*>(list->FindObject("hCollisionCounter"))->GetXaxis()->SetBinLabel(5, "N_{contrib}^{PV} > 0");
reinterpret_cast<TH1F*>(list->FindObject("hCollisionCounter"))->GetXaxis()->SetBinLabel(6, "|Z_{vtx}| < 10 cm");
reinterpret_cast<TH1F*>(list->FindObject("hCollisionCounter"))->GetXaxis()->SetBinLabel(7, "accepted");

list->Add(new TH1F("hZvtx", "vertex z; Z_{vtx} (cm)", 100, -50, +50));
list->Add(new TH1F("hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", 6001, -0.5, 6000.5));
list->Add(new TH1F("hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", 6001, -0.5, 6000.5));
list->Add(new TH2F("hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", 300, 0, 6000, 300, 0, 6000));
Expand Down Expand Up @@ -592,7 +599,7 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char*
}
}
}
THashList* o2::aod::emphotonhistograms::AddHistClass(THashList* list, const char* histClass)
THashList* o2::aod::pwgem::photon::histogram::AddHistClass(THashList* list, const char* histClass)
{
if (list->FindObject(histClass)) {
LOGF(info, "HistogramsLibrary::AddHistClass(): Cannot add histogram class %s because it already exists.", histClass);
Expand Down
7 changes: 4 additions & 3 deletions PWGEM/PhotonMeson/Core/HistogramsLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ enum class EMHistType : int {

namespace o2::aod
{
namespace emphotonhistograms
namespace pwgem::photon::histogram
{
void DefineHistograms(THashList* list, const char* histClass, const char* subGroup = "");
THashList* AddHistClass(THashList* list, const char* histClass);

template <EMHistType htype, typename T>
void FillHistClass(THashList* list, const char* subGroup, T const& obj)
void FillHistClass(THashList* list, const char* subGroup, T const& obj, const float weight = 1.f)
{
if constexpr (htype == EMHistType::kEvent) {
reinterpret_cast<TH1F*>(list->FindObject("hZvtx"))->Fill(obj.posZ());
reinterpret_cast<TH1F*>(list->FindObject("hMultNTracksPV"))->Fill(obj.multNTracksPV());
reinterpret_cast<TH1F*>(list->FindObject("hMultNTracksPVeta1"))->Fill(obj.multNTracksPVeta1());
reinterpret_cast<TH2F*>(list->FindObject("hMultFT0"))->Fill(obj.multFT0A(), obj.multFT0C());
Expand Down Expand Up @@ -164,7 +165,7 @@ void FillHistClass(THashList* list, const char* subGroup, T const& obj)
}
}
}
} // namespace emphotonhistograms
} // namespace pwgem::photon::histogram
} // namespace o2::aod

#endif // PWGEM_PHOTONMESON_CORE_HISTOGRAMSLIBRARY_H_
1 change: 1 addition & 0 deletions PWGEM/PhotonMeson/Core/PWGEMPhotonMesonCoreLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class EMEventCut + ;
#pragma link C++ class V0PhotonCut + ;
#pragma link C++ class DalitzEECut + ;
#pragma link C++ class PHOSPhotonCut + ;
Expand Down
8 changes: 4 additions & 4 deletions PWGEM/PhotonMeson/Tasks/CheckMCV0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,17 @@ struct CheckMCV0 {
}

registry.add("V0Counter", "V0 counter", HistType::kTH1F, {{cutsBinLabels.size(), 0.5, 0.5 + cutsBinLabels.size()}});
for (int iBin = 0; iBin < cutsBinLabels.size(); ++iBin) {
for (size_t iBin = 0; iBin < cutsBinLabels.size(); ++iBin) {
registry.get<TH1>(HIST("V0Counter"))->GetXaxis()->SetBinLabel(iBin + 1, cutsBinLabels[iBin].data());
}

registry.add("V0TypeCounter", "V0 Type counter", HistType::kTH1F, {{v0Types.size(), 0.5, 0.5 + v0Types.size()}});
for (int iBin = 0; iBin < v0Types.size(); ++iBin) {
for (size_t iBin = 0; iBin < v0Types.size(); ++iBin) {
registry.get<TH1>(HIST("V0TypeCounter"))->GetXaxis()->SetBinLabel(iBin + 1, v0Types[iBin].data());
}

registry.add("CheckV0Leg", "CheckV0Leg", HistType::kTH1F, {{checkV0legLabels.size(), 0.5, 0.5 + checkV0legLabels.size()}});
for (int iBin = 0; iBin < checkV0legLabels.size(); ++iBin) {
for (size_t iBin = 0; iBin < checkV0legLabels.size(); ++iBin) {
registry.get<TH1>(HIST("CheckV0Leg"))->GetXaxis()->SetBinLabel(iBin + 1, checkV0legLabels[iBin].data());
}
}
Expand Down Expand Up @@ -455,7 +455,7 @@ struct CheckMCV0 {
v0TypesPassed[3] = isITSTPC_TPConly(track0, track1);
v0TypesPassed[4] = isITSTPC_ITSonly(track0, track1);
v0TypesPassed[5] = isTPConly_ITSonly(track0, track1);
for (int i = 0; i < v0TypesPassed.size(); ++i) {
for (size_t i = 0; i < v0TypesPassed.size(); ++i) {
if (v0TypesPassed[i]) {
registry.fill(HIST("V0TypeCounter"), i + 1);
}
Expand Down
Loading