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
7 changes: 3 additions & 4 deletions PWGEM/PhotonMeson/Core/EMNonLin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ using namespace o2::pwgem::nonlin;

float EMNonLin::getCorrectionFactor(float inputCalibValue, PhotonType photonType, float cent)
{

float param0 = 0, param1 = 0, param2 = 0, val = 1.f;
switch (photonType) {
case PhotonType::kEMC:
Expand All @@ -37,9 +36,9 @@ float EMNonLin::getCorrectionFactor(float inputCalibValue, PhotonType photonType
break;
case PhotonType::kPCM:
if (cent >= 0 && cent <= 100) {
param0 = 11.2144f;
param1 = 0.0986184f;
param2 = 10.9302f;
param0 = 10.7203f;
param1 = 0.0383968f;
param2 = 10.6025f;
} else {
param0 = 0.f;
param1 = 0.f;
Expand Down
84 changes: 69 additions & 15 deletions PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "PWGEM/PhotonMeson/Core/EMBitFlags.h"
#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h"
#include "PWGEM/PhotonMeson/Core/EMNonLin.h"
#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h"
#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h"
#include "PWGEM/PhotonMeson/DataModel/GammaTablesRedux.h"
Expand Down Expand Up @@ -68,6 +69,7 @@ using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::soa;
using namespace o2::aod::pwgem::photon;
using namespace o2::pwgem::nonlin;

enum QvecEstimator {
FT0M = 0,
Expand Down Expand Up @@ -218,10 +220,12 @@ struct CalibTaskEmc {

struct : ConfigurableGroup {
std::string prefix = "correctionConfig";
Configurable<bool> cfgEnableNonLin{"cfgEnableNonLin", false, "flag to turn extra non linear energy calibration on/off"};
Configurable<bool> cfgEnableNonLinEMC{"cfgEnableNonLinEMC", false, "flag to turn extra non linear energy calibration for EMCal on/off"};
Configurable<bool> cfgEnableNonLinPCM{"cfgEnableNonLinPCM", false, "flag to turn extra non linear energy calibration for PCM on/off"};
} correctionConfig;

SliceCache cache;
EMNonLin emNonLin;
o2::framework::Service<o2::ccdb::BasicCCDBManager> ccdb;
int runNow = 0;
int runBefore = -1;
Expand Down Expand Up @@ -761,6 +765,9 @@ struct CalibTaskEmc {
// PCM-EMCal same event
void processEMCalPCMC(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
{
float corrNonLin1 = 1.f;
float corrNonLin2 = 1.f;

if (clusters.size() <= 0 && photons.size() <= 0) {
LOG(info) << "Skipping DF because there are not photons!";
return;
Expand Down Expand Up @@ -801,10 +808,21 @@ struct CalibTaskEmc {
}
}

if (correctionConfig.cfgEnableNonLinEMC) {
corrNonLin1 = emNonLin.getCorrectionFactor(g1.e(), o2::pwgem::nonlin::EMNonLin::PhotonType::kEMC, getCentrality(collision));
}

if (correctionConfig.cfgEnableNonLinPCM) {
corrNonLin2 = emNonLin.getCorrectionFactor(g2.pt(), o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, getCentrality(collision));
}

float photon1Pt = corrNonLin1 * g1.pt();
float photon2Pt = corrNonLin2 * g2.pt();

// EMCal photon v1
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v1(photon1Pt, g1.eta(), g1.phi(), 0.);
// PCM photon v2s
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(photon2Pt, g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2;

float dTheta = v1.Theta() - v2.Theta();
Expand All @@ -828,7 +846,7 @@ struct CalibTaskEmc {
registry.fill(HIST("hMesonCuts"), 5);
continue;
}
runFlowAnalysis<0>(collision, vMeson, g1.pt());
runFlowAnalysis<0>(collision, vMeson, corrNonLin1 * g1.e());
}
}
}
Expand All @@ -837,6 +855,9 @@ struct CalibTaskEmc {
// PCM-EMCal mixed event
void processEMCalPCMMixed(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& pcmPhotons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds)
{
float corrNonLin1 = 1.f;
float corrNonLin2 = 1.f;

if (clusters.size() <= 0 && pcmPhotons.size() <= 0) {
LOG(info) << "Skipping DF because there are not photons!";
return;
Expand Down Expand Up @@ -887,8 +908,20 @@ struct CalibTaskEmc {
continue;
}
}
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);

if (correctionConfig.cfgEnableNonLinEMC) {
corrNonLin1 = emNonLin.getCorrectionFactor(g1.e(), o2::pwgem::nonlin::EMNonLin::PhotonType::kEMC, getCentrality(c1));
}

if (correctionConfig.cfgEnableNonLinPCM) {
corrNonLin2 = emNonLin.getCorrectionFactor(g2.pt(), o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, getCentrality(c2));
}

float photon1Pt = corrNonLin1 * g1.pt();
float photon2Pt = corrNonLin2 * g2.pt();

ROOT::Math::PtEtaPhiMVector v1(photon1Pt, g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(photon2Pt, g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2;

float dTheta = v1.Theta() - v2.Theta();
Expand All @@ -914,7 +947,7 @@ struct CalibTaskEmc {
continue;
}
registry.fill(HIST("hMesonCutsMixed"), 6);
runFlowAnalysis<2>(c1, vMeson, g1.pt());
runFlowAnalysis<2>(c1, vMeson, corrNonLin1 * g1.e());
}
}
}
Expand All @@ -923,6 +956,9 @@ struct CalibTaskEmc {
// Pi0 from EMCal
void processPCM(CollsWithQvecs const& collisions, PCMPhotons const& photons, aod::V0Legs const&)
{
float corrNonLin1 = 1.f;
float corrNonLin2 = 1.f;

if (photons.size() <= 0) {
LOG(info) << "Skipping DF because there are not photons!";
return;
Expand All @@ -946,13 +982,21 @@ struct CalibTaskEmc {
continue;
}

float asymmetry = (g1.pt() - g2.pt()) / (g1.pt() + g2.pt());
if (correctionConfig.cfgEnableNonLinPCM) {
corrNonLin1 = emNonLin.getCorrectionFactor(g1.pt(), o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, getCentrality(collision));
corrNonLin2 = emNonLin.getCorrectionFactor(g2.pt(), o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, getCentrality(collision));
}

float photon1Pt = corrNonLin1 * g1.pt();
float photon2Pt = corrNonLin2 * g2.pt();

float asymmetry = (photon1Pt - photon2Pt) / (photon1Pt + photon2Pt);
if (std::fabs(asymmetry) > cfgMaxAsymmetry) { // only use symmetric decays
continue;
}

ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v1(photon1Pt, g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(photon2Pt, g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2;

float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P()));
Expand All @@ -971,7 +1015,7 @@ struct CalibTaskEmc {
registry.fill(HIST("mesonQA/hAlphaPt"), asymmetry, vMeson.Pt());
}
registry.fill(HIST("hMesonCuts"), 6);
runFlowAnalysis<0>(collision, vMeson, g1.pt());
runFlowAnalysis<0>(collision, vMeson, photon1Pt);
}
} // end of loop over collisions
}
Expand All @@ -980,6 +1024,8 @@ struct CalibTaskEmc {
// PCM-EMCal mixed event
void processPCMMixed(FilteredCollsWithQvecs const& collisions, PCMPhotons const& pcmPhotons, aod::V0Legs const&)
{
float corrNonLin1 = 1.f;
float corrNonLin2 = 1.f;
if (pcmPhotons.size() <= 0) {
LOG(info) << "Skipping DF because there are not photons!";
return;
Expand Down Expand Up @@ -1017,13 +1063,21 @@ struct CalibTaskEmc {
continue;
}

float asymmetry = (g1.pt() - g2.pt()) / (g1.pt() + g2.pt());
if (correctionConfig.cfgEnableNonLinPCM) {
corrNonLin1 = emNonLin.getCorrectionFactor(g1.pt(), o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, getCentrality(c1));
corrNonLin2 = emNonLin.getCorrectionFactor(g2.pt(), o2::pwgem::nonlin::EMNonLin::PhotonType::kPCM, getCentrality(c2));
}

float photon1Pt = corrNonLin1 * g1.pt();
float photon2Pt = corrNonLin2 * g2.pt();

float asymmetry = (photon1Pt - photon2Pt) / (photon1Pt + photon2Pt);
if (std::fabs(asymmetry) > cfgMaxAsymmetry) { // only use symmetric decays
continue;
}

ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v1(photon1Pt, g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(photon2Pt, g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2;

float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P()));
Expand All @@ -1042,7 +1096,7 @@ struct CalibTaskEmc {
registry.fill(HIST("mesonQA/hAlphaPtMixed"), asymmetry, vMeson.Pt());
}
registry.fill(HIST("hMesonCutsMixed"), 6);
runFlowAnalysis<2>(c1, vMeson, g1.pt());
runFlowAnalysis<2>(c1, vMeson, photon1Pt);
}
}
}
Expand Down
Loading