Skip to content
Closed
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
82 changes: 73 additions & 9 deletions PWGDQ/Core/VarManager.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,8 +8,8 @@
// 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.
#include <cmath>

Check failure on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

Check failure on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 11 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#include <iostream>

Check failure on line 12 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <vector>
#include <map>
#include "PWGDQ/Core/VarManager.h"
Expand All @@ -28,15 +28,15 @@
bool VarManager::fgUsedKF = false;
float VarManager::fgMagField = 0.5;
float VarManager::fgValues[VarManager::kNVars] = {0.0f};
float VarManager::fgCenterOfMassEnergy = 13600; // GeV
float VarManager::fgMassofCollidingParticle = 9.382720; // GeV
float VarManager::fgTPCInterSectorBoundary = 1.0; // cm
int VarManager::fgITSROFbias = 0;
int VarManager::fgITSROFlength = 100;
int VarManager::fgITSROFBorderMarginLow = 0;
int VarManager::fgITSROFBorderMarginHigh = 0;
uint64_t VarManager::fgSOR = 0;
uint64_t VarManager::fgEOR = 0;
ROOT::Math::PxPyPzEVector VarManager::fgBeamA(0, 0, 6799.99, 6800); // GeV, beam from A-side 4-momentum vector
ROOT::Math::PxPyPzEVector VarManager::fgBeamC(0, 0, -6799.99, 6800); // GeV, beam from C-side 4-momentum vector
o2::vertexing::DCAFitterN<2> VarManager::fgFitterTwoProngBarrel;
o2::vertexing::DCAFitterN<3> VarManager::fgFitterThreeProngBarrel;
o2::vertexing::DCAFitterN<4> VarManager::fgFitterFourProngBarrel;
Expand All @@ -59,7 +59,7 @@
VarManager::~VarManager() = default;

//__________________________________________________________________
void VarManager::SetVariableDependencies()

Check failure on line 62 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
{
//
// Set as used variables on which other variables calculation depends
Expand Down Expand Up @@ -103,7 +103,7 @@
if (!values) {
values = fgValues;
}
for (Int_t i = startValue; i < endValue; ++i) {

Check failure on line 106 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
values[i] = -9999.;
}
}
Expand All @@ -114,15 +114,79 @@
//
// Set the collision system and the center of mass energy
//
fgCenterOfMassEnergy = energy;

if (system.Contains("PbPb")) {
fgMassofCollidingParticle = MassProton * 208;
}
if (system.Contains("pp")) {
fgMassofCollidingParticle = MassProton;
int NumberOfNucleonsA = 1; // default value for pp collisions
int NumberOfNucleonsC = 1; // default value for pp collisions
int NumberOfProtonsA = 1; // default value for pp collisions
int NumberOfProtonsC = 1; // default value for pp collisions
if (system.EqualTo("PbPb")) {
NumberOfNucleonsA = 208;
NumberOfNucleonsC = 208;
NumberOfProtonsA = 82; // Pb has 82 protons
NumberOfProtonsC = 82; // Pb has 82 protons
} else if (system.EqualTo("pp")) {
NumberOfNucleonsA = 1;
NumberOfNucleonsC = 1;
NumberOfProtonsA = 1; // proton has 1 proton
NumberOfProtonsC = 1; // proton has 1 proton
} else if (system.EqualTo("XeXe")) {
NumberOfNucleonsA = 129;
NumberOfNucleonsC = 129;
NumberOfProtonsA = 54; // Xe has 54 protons
NumberOfProtonsC = 54; // Xe has 54 protons
} else if (system.EqualTo("pPb")) {
NumberOfNucleonsA = 1;
NumberOfNucleonsC = 208;
NumberOfProtonsA = 1; // proton has 1 proton
NumberOfProtonsC = 82; // Pb has 82 protons
} else if (system.EqualTo("Pbp")) {
NumberOfNucleonsA = 208;
NumberOfNucleonsC = 1;
NumberOfProtonsA = 82; // Pb has 82 protons
NumberOfProtonsC = 1; // proton has 1 proton
} else if (system.EqualTo("OO")) {
NumberOfNucleonsA = 16;
NumberOfNucleonsC = 16;
NumberOfProtonsA = 8; // O has 8 protons
NumberOfProtonsC = 8; // O has 8 protons
} else if (system.EqualTo("pO")) {
NumberOfNucleonsA = 1;
NumberOfNucleonsC = 16;
NumberOfProtonsA = 1; // proton has 1 proton
NumberOfProtonsC = 8; // O has 8 protons
} else if (system.EqualTo("NeNe")) {
NumberOfNucleonsA = 20;
NumberOfNucleonsC = 20;
NumberOfProtonsA = 10; // Ne has 5 protons
NumberOfProtonsC = 10; // Ne has 5 protons
} else {
LOGF(WARNING, "Unknown collision system %s, using default pp", system.Data());
}
// TO Do: add more systems

// set the beam 4-momentum vectors
float beamAEnergy = energy / 2.0 * sqrt(NumberOfProtonsA * NumberOfProtonsC / NumberOfProtonsC / NumberOfProtonsA); // GeV

Check failure on line 167 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float beamCEnergy = energy / 2.0 * sqrt(NumberOfProtonsC * NumberOfProtonsA / NumberOfProtonsA / NumberOfProtonsC); // GeV

Check failure on line 168 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float beamAMomentum = std::sqrt(beamAEnergy * beamAEnergy - NumberOfNucleonsA * NumberOfNucleonsA * MassProton * MassProton);
float beamCMomentum = std::sqrt(beamCEnergy * beamCEnergy - NumberOfNucleonsC * NumberOfNucleonsC * MassProton * MassProton);
fgBeamA.SetPxPyPzE(0, 0, beamAMomentum, beamAEnergy);
fgBeamC.SetPxPyPzE(0, 0, -beamCMomentum, beamCEnergy);
}

//__________________________________________________________________
void VarManager::SetCollisionSystem(o2::parameters::GRPLHCIFData* grplhcif)
{
//
// Set the collision system and the center of mass energy from the GRP information
double beamAEnergy = grplhcif->getBeamEnergyPerNucleonInGeV(o2::constants::lhc::BeamDirection::BeamA);
double beamCEnergy = grplhcif->getBeamEnergyPerNucleonInGeV(o2::constants::lhc::BeamDirection::BeamC);
double beamANucleons = grplhcif->getBeamA(o2::constants::lhc::BeamDirection::BeamA);
double beamCNucleons = grplhcif->getBeamA(o2::constants::lhc::BeamDirection::BeamC);
double beamAMomentum = std::sqrt(beamAEnergy * beamAEnergy - beamANucleons * beamANucleons * MassProton * MassProton);
double beamCMomentum = std::sqrt(beamCEnergy * beamCEnergy - beamCNucleons * beamCNucleons * MassProton * MassProton);
fgBeamA.SetPxPyPzE(0, 0, beamAMomentum, beamAEnergy);
fgBeamC.SetPxPyPzE(0, 0, -beamCMomentum, beamCEnergy);
LOGF(INFO, "Beam A energy = %.2f GeV, beam C energy = %.2f GeV", beamAEnergy, beamCEnergy);
LOGF(INFO, "Beam A with %.0f nucleons, beam C with %.0f nucleons", beamANucleons, beamCNucleons);
}

//__________________________________________________________________
Expand Down Expand Up @@ -155,7 +219,7 @@
//
// Set default variable names
//
for (Int_t ivar = 0; ivar < kNVars; ++ivar) {

Check failure on line 222 in PWGDQ/Core/VarManager.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
fgVariableNames[ivar] = "DEFAULT NOT DEFINED";
fgVariableUnits[ivar] = "n/a";
}
Expand Down
86 changes: 38 additions & 48 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,49 @@
#define HomogeneousField
#endif

#include <vector>
#include <map>
#include <cmath>
#include <iostream>
#include <utility>
#include <complex>
#include <algorithm>

#include <TObject.h>
#include <TString.h>
#include "TRandom.h"
#include "TH3F.h"
#include "Math/Vector4D.h"
#include "Math/Vector3D.h"
#include "Math/GenVector/Boost.h"
#include "Math/VectorUtil.h"

#include "Framework/DataTypes.h"
#include "TGeoGlobalMagField.h"
#include "Field/MagneticField.h"
#include "ReconstructionDataFormats/Track.h"
#include "ReconstructionDataFormats/Vertex.h"
#include "DCAFitter/DCAFitterN.h"
#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/TriggerAliases.h"
#include "ReconstructionDataFormats/DCA.h"
#include "DetectorsBase/Propagator.h"
#include "Common/Core/CollisionTypeHelper.h"
#include "Common/Core/EventPlaneHelper.h"
#include "Common/Core/trackUtilities.h"

#include "Math/SMatrix.h"
#include "ReconstructionDataFormats/TrackFwd.h"
#include "CommonConstants/LHCConstants.h"
#include "CommonConstants/PhysicsConstants.h"
#include "DCAFitter/DCAFitterN.h"
#include "DCAFitter/FwdDCAFitterN.h"
#include "DetectorsBase/Propagator.h"
#include "Field/MagneticField.h"
#include "Framework/DataTypes.h"
#include "GlobalTracking/MatchGlobalFwd.h"
#include "CommonConstants/PhysicsConstants.h"
#include "CommonConstants/LHCConstants.h"
#include "ReconstructionDataFormats/DCA.h"
#include "ReconstructionDataFormats/Track.h"
#include "ReconstructionDataFormats/TrackFwd.h"
#include "ReconstructionDataFormats/Vertex.h"

#include "Math/GenVector/Boost.h"
#include "Math/SMatrix.h"
#include "Math/Vector3D.h"
#include "Math/Vector4D.h"
#include "Math/VectorUtil.h"
#include "TGeoGlobalMagField.h"
#include "TH3F.h"
#include "TRandom.h"
#include <TObject.h>
#include <TString.h>

#include "KFParticle.h"
#include "KFPTrack.h"
#include "KFPVertex.h"
#include "KFParticle.h"
#include "KFParticleBase.h"
#include "KFVertex.h"

#include "Common/Core/EventPlaneHelper.h"
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <utility>
#include <vector>

using std::complex;
using std::cout;
Expand Down Expand Up @@ -927,6 +927,7 @@ class VarManager : public TObject

// Setup the collision system
static void SetCollisionSystem(TString system, float energy);
static void SetCollisionSystem(o2::parameters::GRPLHCIFData* grplhcif);

static void SetMagneticField(float magField)
{
Expand Down Expand Up @@ -1197,6 +1198,8 @@ class VarManager : public TObject
static int fgITSROFBorderMarginHigh; // ITS ROF border high margin
static uint64_t fgSOR; // Timestamp for start of run
static uint64_t fgEOR; // Timestamp for end of run
static ROOT::Math::PxPyPzEVector fgBeamA; // beam from A-side 4-momentum vector
static ROOT::Math::PxPyPzEVector fgBeamC; // beam from C-side 4-momentum vector

// static void FillEventDerived(float* values = nullptr);
static void FillTrackDerived(float* values = nullptr);
Expand Down Expand Up @@ -2866,16 +2869,11 @@ void VarManager::FillPair(T1 const& t1, T2 const& t2, float* values)
bool useRM = fgUsedVars[kCosThetaRM]; // Random frame

if (useHE || useCS || usePP || useRM) {
// TO DO: get the correct values from CCDB
double BeamMomentum = TMath::Sqrt(fgCenterOfMassEnergy * fgCenterOfMassEnergy / 4 - fgMassofCollidingParticle * fgMassofCollidingParticle); // GeV
ROOT::Math::PxPyPzEVector Beam1(0., 0., -BeamMomentum, fgCenterOfMassEnergy / 2);
ROOT::Math::PxPyPzEVector Beam2(0., 0., BeamMomentum, fgCenterOfMassEnergy / 2);

ROOT::Math::Boost boostv12{v12.BoostToCM()};
ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()};
ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam1_CM{(boostv12(Beam1).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam2_CM{(boostv12(Beam2).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam1_CM{(boostv12(fgBeamA).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam2_CM{(boostv12(fgBeamC).Vect()).Unit()};

// using positive sign convention for the first track
ROOT::Math::XYZVectorF v_CM = (t1.sign() > 0 ? v1_CM : v2_CM);
Expand Down Expand Up @@ -3381,16 +3379,11 @@ void VarManager::FillPairMC(T1 const& t1, T2 const& t2, float* values)
bool useRM = fgUsedVars[kMCCosThetaRM]; // Random frame

if (useHE || useCS || usePP || useRM) {
// TO DO: get the correct values from CCDB
double BeamMomentum = TMath::Sqrt(fgCenterOfMassEnergy * fgCenterOfMassEnergy / 4 - fgMassofCollidingParticle * fgMassofCollidingParticle); // GeV
ROOT::Math::PxPyPzEVector Beam1(0., 0., -BeamMomentum, fgCenterOfMassEnergy / 2);
ROOT::Math::PxPyPzEVector Beam2(0., 0., BeamMomentum, fgCenterOfMassEnergy / 2);

ROOT::Math::Boost boostv12{v12.BoostToCM()};
ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()};
ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam1_CM{(boostv12(Beam1).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam2_CM{(boostv12(Beam2).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam1_CM{(boostv12(fgBeamA).Vect()).Unit()};
ROOT::Math::XYZVectorF Beam2_CM{(boostv12(fgBeamC).Vect()).Unit()};

// using positive sign convention for the first track
ROOT::Math::XYZVectorF v_CM = (t1.pdgCode() > 0 ? v1_CM : v2_CM);
Expand Down Expand Up @@ -4848,9 +4841,6 @@ void VarManager::FillPairVn(T1 const& t1, T2 const& t2, float* values)
// global polarization parameters
bool useGlobalPolarizatiobSpinOne = fgUsedVars[kCosThetaStarTPC] || fgUsedVars[kCosThetaStarFT0A] || fgUsedVars[kCosThetaStarFT0C];
if (useGlobalPolarizatiobSpinOne) {
double BeamMomentum = TMath::Sqrt(fgCenterOfMassEnergy * fgCenterOfMassEnergy / 4 - fgMassofCollidingParticle * fgMassofCollidingParticle); // GeV
ROOT::Math::PxPyPzEVector Beam1(0., 0., -BeamMomentum, fgCenterOfMassEnergy / 2);

ROOT::Math::Boost boostv12{v12.BoostToCM()};
ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()};
ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()};
Expand Down
7 changes: 7 additions & 0 deletions PWGDQ/Tasks/tableReader_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@ struct AnalysisSameEventPairing {
Configurable<std::string> grpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
Configurable<std::string> geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
Configurable<std::string> GrpLhcIfPath{"grplhcif", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};
} fConfigCCDB;

struct : ConfigurableGroup {
Expand All @@ -1231,6 +1232,7 @@ struct AnalysisSameEventPairing {
Configurable<std::string> collisionSystem{"syst", "pp", "Collision system, pp or PbPb"};
Configurable<float> centerMassEnergy{"energy", 13600, "Center of mass energy in GeV"};
Configurable<bool> propTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"};
Configurable<bool> useRemoteCollisionInfo{"cfgUseRemoteCollisionInfo", false, "Use remote collision information from CCDB"};
} fConfigOptions;

Service<o2::ccdb::BasicCCDBManager> fCCDB;
Expand Down Expand Up @@ -1551,6 +1553,11 @@ struct AnalysisSameEventPairing {
uint64_t sor = std::atol(header["SOR"].c_str());
uint64_t eor = std::atol(header["EOR"].c_str());
VarManager::SetSORandEOR(sor, eor);

if (fConfigOptions.useRemoteCollisionInfo) {
o2::parameters::GRPLHCIFData* grpo = fCCDB->getForTimeStamp<o2::parameters::GRPLHCIFData>(fConfigCCDB.GrpLhcIfPath, timestamp);
VarManager::SetCollisionSystem(grpo);
}
}

// Template function to run same event pairing (barrel-barrel, muon-muon, barrel-muon)
Expand Down
Loading