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
10 changes: 5 additions & 5 deletions PWGCF/Core/CorrelationContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
#include "TF1.h"
#include "THn.h"
#include "Framework/HistogramSpec.h"
#include "CommonConstants/MathConstants.h"

using namespace o2;
using namespace o2::framework;
using namespace o2::constants::math;

ClassImp(CorrelationContainer);

Expand Down Expand Up @@ -486,9 +489,6 @@ TH2* CorrelationContainer::getPerTriggerYield(CorrelationContainer::CFStep step,
THnBase* trackSameAll = nullptr;
TH2* eventSameAll = nullptr;

Long64_t totalEvents = 0;
Int_t nCorrelationFunctions = 0;

getHistsZVtxMult(step, ptTriggerMin, ptTriggerMax, &trackSameAll, &eventSameAll);

TAxis* multAxis = trackSameAll->GetAxis(3);
Expand Down Expand Up @@ -1498,8 +1498,8 @@ void CorrelationContainer::symmetrizepTBins()
for (Int_t i4 = 1; i4 <= target->GetAxis(4)->GetNbins(); i4++) {
Int_t binEta = target->GetAxis(0)->FindBin(-target->GetAxis(0)->GetBinCenter(i0));
Double_t phi = -target->GetAxis(4)->GetBinCenter(i4);
if (phi < -M_PI / 2) {
phi += M_PI * 2;
if (phi < -PIHalf) {
phi += TwoPI;
}
Int_t binPhi = target->GetAxis(4)->FindBin(phi);

Expand Down
52 changes: 27 additions & 25 deletions PWGCF/Core/PairCuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

#include "Framework/Logger.h"
#include "Framework/HistogramRegistry.h"
#include "CommonConstants/MathConstants.h"

// Functions which cut on particle pairs (decays, conversions, two-track cuts)
//
// Author: Jan Fiete Grosse-Oetringhaus

using namespace o2;
using namespace o2::framework;
using namespace constants::math;

class PairCuts
{
Expand Down Expand Up @@ -266,41 +268,41 @@ double PairCuts::getInvMassSquaredFast(T const& track1, double m0_1, T const& tr
const float pt1 = track1.pt();
const float pt2 = track2.pt();

float tantheta1 = 1e10;
float tantheta1 = 1e10f;

if (eta1 < -1e-10 || eta1 > 1e-10) {
float expTmp = 1.0 - eta1 + eta1 * eta1 / 2 - eta1 * eta1 * eta1 / 6 + eta1 * eta1 * eta1 * eta1 / 24;
tantheta1 = 2.0 * expTmp / (1.0 - expTmp * expTmp);
if (eta1 < -1e-10f || eta1 > 1e-10f) {
float expTmp = 1.0f - eta1 + eta1 * eta1 / 2.0f - eta1 * eta1 * eta1 / 6.0f + eta1 * eta1 * eta1 * eta1 / 24.0f;
tantheta1 = 2.0f * expTmp / (1.0f - expTmp * expTmp);
}

float tantheta2 = 1e10;
if (eta2 < -1e-10 || eta2 > 1e-10) {
float expTmp = 1.0 - eta2 + eta2 * eta2 / 2 - eta2 * eta2 * eta2 / 6 + eta2 * eta2 * eta2 * eta2 / 24;
tantheta2 = 2.0 * expTmp / (1.0 - expTmp * expTmp);
float tantheta2 = 1e10f;
if (eta2 < -1e-10f || eta2 > 1e-10f) {
float expTmp = 1.0f - eta2 + eta2 * eta2 / 2.0f - eta2 * eta2 * eta2 / 6.0f + eta2 * eta2 * eta2 * eta2 / 24.0f;
tantheta2 = 2.0f * expTmp / (1.0f - expTmp * expTmp);
}

float e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
float e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
float e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0f + 1.0f / tantheta1 / tantheta1);
float e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0f + 1.0f / tantheta2 / tantheta2);

// fold onto 0...pi
float deltaPhi = std::fabs(phi1 - phi2);
while (deltaPhi > M_PI * 2) {
deltaPhi -= M_PI * 2;
while (deltaPhi > TwoPI) {
deltaPhi -= TwoPI;
}
if (deltaPhi > M_PI) {
deltaPhi = M_PI * 2 - deltaPhi;
if (deltaPhi > PI) {
deltaPhi = TwoPI - deltaPhi;
}

float cosDeltaPhi = 0;
if (deltaPhi < M_PI / 3) {
if (deltaPhi < PI / 3.0f) {
cosDeltaPhi = 1.0 - deltaPhi * deltaPhi / 2 + deltaPhi * deltaPhi * deltaPhi * deltaPhi / 24;
} else if (deltaPhi < 2 * M_PI / 3) {
cosDeltaPhi = -(deltaPhi - M_PI / 2) + 1.0 / 6 * std::pow((deltaPhi - M_PI / 2), 3);
} else if (deltaPhi < 2.0f * PI / 3.0f) {
cosDeltaPhi = -(deltaPhi - PI / 2) + 1.0 / 6 * std::pow((deltaPhi - PI / 2), 3);
} else {
cosDeltaPhi = -1.0 + 1.0 / 2.0 * (deltaPhi - M_PI) * (deltaPhi - M_PI) - 1.0 / 24.0 * std::pow(deltaPhi - M_PI, 4);
cosDeltaPhi = -1.0f + 1.0f / 2.0f * (deltaPhi - PI) * (deltaPhi - PI) - 1.0f / 24.0f * std::pow(deltaPhi - PI, 4.0f);
}

double mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * (std::sqrt(e1squ * e2squ) - (pt1 * pt2 * (cosDeltaPhi + 1.0 / tantheta1 / tantheta2)));
double mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2.0f * (std::sqrt(e1squ * e2squ) - (pt1 * pt2 * (cosDeltaPhi + 1.0f / tantheta1 / tantheta2)));

//LOGF(debug, "%f %f %f %f %f %f %f %f %f", pt1, eta1, phi1, pt2, eta2, phi2, m0_1, m0_2, mass2);

Expand All @@ -324,14 +326,14 @@ float PairCuts::getDPhiStar(T const& track1, T const& track2, float radius, int

float dphistar = phi1 - phi2 - charge1 * std::asin(0.015 * magField * radius / pt1) + charge2 * std::asin(0.015 * magField * radius / pt2);

if (dphistar > M_PI) {
dphistar = M_PI * 2 - dphistar;
if (dphistar > PI) {
dphistar = TwoPI - dphistar;
}
if (dphistar < -M_PI) {
dphistar = -M_PI * 2 - dphistar;
if (dphistar < -PI) {
dphistar = -TwoPI - dphistar;
}
if (dphistar > M_PI) { // might look funny but is needed
dphistar = M_PI * 2 - dphistar;
if (dphistar > PI) { // might look funny but is needed
dphistar = TwoPI - dphistar;
}

return dphistar;
Expand Down
20 changes: 11 additions & 9 deletions PWGCF/Tasks/correlations.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Framework/StepTHn.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/RunningWorkflowInfo.h"
#include "CommonConstants/MathConstants.h"

#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/TrackSelectionTables.h"
Expand Down Expand Up @@ -44,6 +45,7 @@ using Hash = Hashes::iterator;
using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace constants::math;

#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};

Expand Down Expand Up @@ -73,7 +75,7 @@ struct CorrelationTask {
O2_DEFINE_CONFIGURABLE(cfgNoMixedEvents, int, 5, "Number of mixed events per event")

ConfigurableAxis axisVertex{"axisVertex", {7, -7, 7}, "vertex axis for histograms"};
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -M_PI / 2, M_PI / 2 * 3}, "delta phi axis for histograms"};
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"};
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"};
ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"};
ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"};
Expand Down Expand Up @@ -254,11 +256,11 @@ struct CorrelationTask {
}

float deltaPhi = track1.phi() - track2.phi();
if (deltaPhi > 1.5 * M_PI) {
deltaPhi -= M_PI * 2;
if (deltaPhi > 1.5f * PI) {
deltaPhi -= TwoPI;
}
if (deltaPhi < -0.5 * M_PI) {
deltaPhi += M_PI * 2;
if (deltaPhi < -PIHalf) {
deltaPhi += TwoPI;
}

target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed,
Expand Down Expand Up @@ -454,11 +456,11 @@ struct CorrelationTask {
}

float deltaPhi = track1.phi() - track2.phi();
if (deltaPhi > 1.5 * M_PI) {
deltaPhi -= M_PI * 2;
if (deltaPhi > 1.5f * PI) {
deltaPhi -= TwoPI;
}
if (deltaPhi < -0.5 * M_PI) {
deltaPhi += M_PI * 2;
if (deltaPhi < -PIHalf) {
deltaPhi += TwoPI;
}

same->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed,
Expand Down
15 changes: 9 additions & 6 deletions Tutorials/src/mcHistograms.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "CommonConstants/MathConstants.h"

#include "Common/Core/MC.h"

using namespace o2;
using namespace o2::framework;
using namespace constants::math;

// Simple access to collision
struct VertexDistribution {
Expand All @@ -34,7 +37,7 @@ struct VertexDistribution {

// Grouping between MC particles and collisions
struct AccessMcData {
OutputObj<TH1F> phiH{TH1F("phi", "phi", 100, 0., 2. * M_PI)};
OutputObj<TH1F> phiH{TH1F("phi", "phi", 100, 0., TwoPI)};
OutputObj<TH1F> etaH{TH1F("eta", "eta", 102, -2.01, 2.01)};

// group according to McCollisions
Expand All @@ -58,7 +61,7 @@ struct AccessMcData {
// Access from tracks to MC particle
struct AccessMcTruth {
OutputObj<TH1F> etaDiff{TH1F("etaDiff", ";eta_{MC} - eta_{Rec}", 100, -2, 2)};
OutputObj<TH1F> phiDiff{TH1F("phiDiff", ";phi_{MC} - phi_{Rec}", 100, -M_PI, M_PI)};
OutputObj<TH1F> phiDiff{TH1F("phiDiff", ";phi_{MC} - phi_{Rec}", 100, -PI, PI)};

// group according to reconstructed Collisions
void process(soa::Join<aod::Collisions, aod::McCollisionLabels>::iterator const& collision, soa::Join<aod::Tracks, aod::McTrackLabels> const& tracks,
Expand All @@ -75,11 +78,11 @@ struct AccessMcTruth {
if (MC::isPhysicalPrimary(particle)) {
etaDiff->Fill(particle.eta() - track.eta());
auto delta = particle.phi() - track.phi();
if (delta > M_PI) {
delta -= 2 * M_PI;
if (delta > PI) {
delta -= TwoPI;
}
if (delta < -M_PI) {
delta += 2 * M_PI;
if (delta < -PI) {
delta += TwoPI;
}
phiDiff->Fill(delta);
}
Expand Down