Skip to content
Closed
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
42 changes: 38 additions & 4 deletions PWGLF/TableProducer/Common/spvector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <TMath.h>
#include <array>
#include <cmath>
#include <iostream>

Check failure on line 24 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include "Math/Vector4D.h"
#include "TRandom3.h"
#include "TF1.h"
Expand Down Expand Up @@ -67,6 +67,7 @@
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::constants::physics;
using namespace o2::aod::rctsel;

using BCsRun3 = soa::Join<aod::BCsWithTimestamps, aod::Run3MatchedToBCSparse>;

Expand Down Expand Up @@ -133,6 +134,7 @@
Configurable<bool> coarse5{"coarse5", false, "RE5"};
Configurable<bool> fine5{"fine5", false, "REfine5"};
Configurable<bool> coarse6{"coarse6", false, "RE6"};
Configurable<bool> fine6{"fine6", false, "REfine6"};
Configurable<bool> useRecentereSp{"useRecentereSp", false, "use Recentering with Sparse or THn"};
Configurable<bool> useRecenterefineSp{"useRecenterefineSp", false, "use fine Recentering with THn"};
Configurable<std::string> ConfGainPath{"ConfGainPath", "Users/p/prottay/My/Object/NewPbPbpass4_10092024/gaincallib", "Path to gain calibration"};
Expand Down Expand Up @@ -163,6 +165,10 @@
Configurable<std::string> ConfRecenterevxSp5{"ConfRecenterevxSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere5"};
Configurable<std::string> ConfRecenterevySp5{"ConfRecenterevySp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere5"};
Configurable<std::string> ConfRecenterevzSp5{"ConfRecenterevzSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere5"};
Configurable<std::string> ConfRecenterecentSp6{"ConfRecenterecentSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere6"};
Configurable<std::string> ConfRecenterevxSp6{"ConfRecenterevxSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere6"};
Configurable<std::string> ConfRecenterevySp6{"ConfRecenterevySp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vy recentere6"};
Configurable<std::string> ConfRecenterevzSp6{"ConfRecenterevzSp6", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vz recentere6"};
Configurable<std::string> ConfShiftC{"ConfShiftC", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift C"};
Configurable<std::string> ConfShiftA{"ConfShiftA", "Users/p/prottay/My/Object/Testinglocaltree/shiftcallib2", "Path to shift A"};

Expand All @@ -187,9 +193,21 @@
return 1;
}
*/

struct : ConfigurableGroup {
Configurable<bool> requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"};
Configurable<std::string> cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"};
Configurable<bool> cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", true, "Evt sel: RCT flag checker ZDC check"};
Configurable<bool> cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"};
} rctCut;

RCTFlagsChecker rctChecker;

void init(o2::framework::InitContext&)
{

rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, rctCut.cfgEvtRCTFlagCheckerZDCCheck, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad);

AxisSpec channelZDCAxis = {8, 0.0, 8.0, "ZDC tower"};
AxisSpec qxZDCAxis = {QxyNbins, lbinQxy, hbinQxy, "Qx"};
AxisSpec phiAxis = {PhiNbins, -6.28, 6.28, "phi"};
Expand Down Expand Up @@ -279,16 +297,16 @@
TH2F* hrecenterevySp;
TH2F* hrecenterevzSp;*/
std::array<THnF*, 6> hrecentereSpA; // Array of 6 histograms
std::array<TH2F*, 5> hrecenterecentSpA; // Array of 5 histograms
std::array<TH2F*, 5> hrecenterevxSpA; // Array of 5 histograms
std::array<TH2F*, 5> hrecenterevySpA; // Array of 5 histograms
std::array<TH2F*, 5> hrecenterevzSpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterecentSpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterevxSpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterevySpA; // Array of 5 histograms
std::array<TH2F*, 6> hrecenterevzSpA; // Array of 5 histograms
TProfile3D* shiftprofileA;
TProfile3D* shiftprofileC;

// Bool_t Correctcoarse(int64_t ts, Configurable<std::string>& ConfRecentereSpp, bool useRecentereSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
//{
Bool_t Correctcoarse(const THnF* hrecentereSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)

Check failure on line 309 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
{

/*
Expand Down Expand Up @@ -339,7 +357,7 @@

// Bool_t Correctfine(int64_t ts, Configurable<std::string>& ConfRecenterecentSpp, Configurable<std::string>& ConfRecenterevxSpp, Configurable<std::string>& ConfRecenterevySpp, Configurable<std::string>& ConfRecenterevzSpp, bool useRecenterefineSp, int currentRunNumber, int lastRunNumber, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
//{
Bool_t Correctfine(TH2F* hrecenterecentSp, TH2F* hrecenterevxSp, TH2F* hrecenterevySp, TH2F* hrecenterevzSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)

Check failure on line 360 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
{

if (!hrecenterecentSp || !hrecenterevxSp || !hrecenterevySp || !hrecenterevzSp) {
Expand Down Expand Up @@ -440,8 +458,14 @@
return;
}

if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) {
triggerevent = false;
spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, znaEnergycommon, zncEnergycommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3], zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3], qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA);
return;
}

// if (collision.sel8() && centrality > cfgCutCentralityMin && centrality < cfgCutCentralityMax && TMath::Abs(vz) < cfgCutVertex && collision.has_foundFT0() && eventSelected(collision, centrality) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
if (collision.sel8() && centrality > cfgCutCentralityMin && centrality < cfgCutCentralityMax && TMath::Abs(vz) < cfgCutVertex && collision.has_foundFT0() && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {

Check failure on line 468 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
triggerevent = true;
if (useGainCallib && (currentRunNumber != lastRunNumber)) {
gainprofile = ccdb->getForTimeStamp<TH2D>(ConfGainPath.value, bc.timestamp());
Expand Down Expand Up @@ -470,7 +494,7 @@
} else {
double ampl = gainequal * znaEnergy[iChA];
if (followpub) {
ampl = TMath::Power(ampl, alphaZDC);

Check failure on line 497 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
}
qxZDCA = qxZDCA - ampl * x[iChA];
qyZDCA = qyZDCA + ampl * y[iChA];
Expand All @@ -485,7 +509,7 @@
} else {
double ampl = gainequal * zncEnergy[iChA - 4];
if (followpub) {
ampl = TMath::Power(ampl, alphaZDC);

Check failure on line 512 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
}
qxZDCC = qxZDCC + ampl * x[iChA - 4];
qyZDCC = qyZDCC + ampl * y[iChA - 4];
Expand Down Expand Up @@ -529,9 +553,9 @@
vy = vy - gainprofilevxy->GetBinContent(2);
}

Bool_t res = 0;

Check failure on line 556 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
Bool_t resfine = 0;

Check failure on line 557 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
Int_t check = 1;

Check failure on line 558 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.

if (coarse1) {
if (useRecentereSp && (currentRunNumber != lastRunNumber)) {
Expand Down Expand Up @@ -626,10 +650,20 @@
res = Correctcoarse(hrecentereSpA[5], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (fine6) {
if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) {
hrecenterecentSpA[5] = ccdb->getForTimeStamp<TH2F>(ConfRecenterecentSp6.value, bc.timestamp());
hrecenterevxSpA[5] = ccdb->getForTimeStamp<TH2F>(ConfRecenterevxSp6.value, bc.timestamp());
hrecenterevySpA[5] = ccdb->getForTimeStamp<TH2F>(ConfRecenterevySp6.value, bc.timestamp());
hrecenterevzSpA[5] = ccdb->getForTimeStamp<TH2F>(ConfRecenterevzSp6.value, bc.timestamp());
}
resfine = Correctfine(hrecenterecentSpA[5], hrecenterevxSpA[5], hrecenterevySpA[5], hrecenterevzSpA[5], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (res == 0 && resfine == 0 && check == 0) {
LOG(info) << "Histograms are null";
}
psiZDCC = 1.0 * TMath::ATan2(qyZDCC, qxZDCC);

Check failure on line 666 in PWGLF/TableProducer/Common/spvector.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
psiZDCA = 1.0 * TMath::ATan2(qyZDCA, qxZDCA);

int nshift = 10; // no. of iterations
Expand Down
Loading