Skip to content
Open
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
25 changes: 25 additions & 0 deletions PWGLF/DataModel/ZDCCalTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
DECLARE_SOA_COLUMN(QyC, qyC, float);
} // namespace zdccaltable
DECLARE_SOA_TABLE(ZDCCalTables, "AOD", "ZDCCALTABLE",
o2::soa::Index<>,
zdccaltable::TriggerEventZDC,
zdccaltable::TriggerEventRunNo,
zdccaltable::Cent,
Expand All @@ -54,19 +55,19 @@
// This table does NOT duplicate cent, vx, vy, vz, run number, trigger, etc.
// It only stores the ZDC energies and links back to ZDCCalTables.
namespace zdcenergytable
{

Check failure on line 58 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_INDEX_COLUMN(ZDCCalTable, zdcCalTable);

Check failure on line 60 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNACommon, znaCommon, float);

Check failure on line 61 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNCCommon, zncCommon, float);

Check failure on line 63 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNA0, zna0, float);

Check failure on line 64 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNA1, zna1, float);

Check failure on line 65 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNA2, zna2, float);

Check failure on line 66 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNA3, zna3, float);

Check failure on line 68 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNC0, znc0, float);

Check failure on line 69 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNC1, znc1, float);

Check failure on line 70 in PWGLF/DataModel/ZDCCalTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(ZNC2, znc2, float);
DECLARE_SOA_COLUMN(ZNC3, znc3, float);
} // namespace zdcenergytable
Expand Down Expand Up @@ -102,5 +103,29 @@
zdctimetable::TimeMin);

using ZDCTimeTable = ZDCTimeTables::iterator;

// charged-track linked table comes here

namespace zdcchargedtrack
{
DECLARE_SOA_INDEX_COLUMN(ZDCCalTable, zdcCalTable);

DECLARE_SOA_COLUMN(Px, px, float);
DECLARE_SOA_COLUMN(Py, py, float);
DECLARE_SOA_COLUMN(Pz, pz, float);
DECLARE_SOA_COLUMN(Sign, sign, int8_t);
} // namespace zdcchargedtrack

DECLARE_SOA_TABLE(ZDCChargedTracks,
"AOD",
"ZDCCHTRK",
zdcchargedtrack::ZDCCalTableId,
zdcchargedtrack::Px,
zdcchargedtrack::Py,
zdcchargedtrack::Pz,
zdcchargedtrack::Sign);

using ZDCChargedTrack = ZDCChargedTracks::iterator;

} // namespace o2::aod
#endif // PWGLF_DATAMODEL_ZDCCALTABLES_H_
46 changes: 33 additions & 13 deletions PWGLF/TableProducer/Common/spvector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ struct spvector {
Configurable<bool> useCallibvertex{"useCallibvertex", false, "use calibration for vxy"};
Configurable<bool> coarse1{"coarse1", false, "RE1"};
Configurable<bool> fine1{"fine1", false, "REfine1"};
Configurable<bool> finetime1{"finetime1", false, "REfinetime1"};
Configurable<bool> coarse2{"coarse2", false, "RE2"};
Configurable<bool> fine2{"fine2", false, "REfine2"};
Configurable<bool> finetime2{"finetime2", false, "REfinetime2"};
Configurable<bool> coarse3{"coarse3", false, "RE3"};
Configurable<bool> fine3{"fine3", false, "REfine3"};
Configurable<bool> finetime3{"finetime3", false, "REfinetime3"};
Configurable<bool> coarse4{"coarse4", false, "RE4"};
Configurable<bool> fine4{"fine4", false, "REfine4"};
Configurable<bool> coarse5{"coarse5", false, "RE5"};
Expand All @@ -139,6 +142,7 @@ struct spvector {
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<bool> useTimeRecentering{"useTimeRecentering", false, "Use residual time recentering"};
Configurable<std::string> ConfGainPath{"ConfGainPath", "Users/p/prottay/My/Object/NewPbPbpass4_10092024/gaincallib", "Path to gain calibration"};
Configurable<std::string> ConfGainPathvxy{"ConfGainPathvxy", "Users/p/prottay/My/Object/swapcoords/PbPbpass4_20112024/recentervert", "Path to gain calibration for vxy"};
Configurable<std::string> ConfRecentereSp{"ConfRecentereSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere"};
Expand Down Expand Up @@ -173,8 +177,9 @@ struct spvector {
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"};
Configurable<bool> useTimeRecentering{"useTimeRecentering", false, "Use residual time recentering"};
Configurable<std::string> confRecentereTimeSp{"confRecentereTimeSp", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast2", "Path to time recentering map"};
Configurable<std::string> confRecentereTimeSp1{"confRecentereTimeSp1", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast2", "Path to time recentering map 1"};
Configurable<std::string> confRecentereTimeSp2{"confRecentereTimeSp2", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast2", "Path to time recentering map 2"};
Configurable<std::string> confRecentereTimeSp3{"confRecentereTimeSp3", "Users/p/prottay/My/Object/GCwithoutcfactorgoodVztimedep/From676541/TestDDlocal/2024PbPbpass3_23062026/recenterlast3", "Path to time recentering map 3"};

// Event selection cuts - Alex
/*
Expand Down Expand Up @@ -314,7 +319,9 @@ struct spvector {
std::array<TH2F*, 6> hrecenterevzSpA; // Array of 5 histograms
TProfile3D* shiftprofileA;
TProfile3D* shiftprofileC;
TH2F* hrecentereTimeSp = nullptr;
TH2F* hrecentereTimeSp1 = nullptr;
TH2F* hrecentereTimeSp2 = nullptr;
TH2F* hrecentereTimeSp3 = nullptr;

Bool_t Correctcoarse(const THnF* hrecentereSp, auto centrality, auto vx, auto vy, auto vz, auto& qxZDCA, auto& qyZDCA, auto& qxZDCC, auto& qyZDCC)
{
Expand Down Expand Up @@ -652,6 +659,14 @@ struct spvector {
resfine = Correctfine(hrecenterecentSpA[0], hrecenterevxSpA[0], hrecenterevySpA[0], hrecenterevzSpA[0], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (finetime1 && (currentRunNumber != lastRunNumber)) {
hrecentereTimeSp1 = ccdb->getForTimeStamp<TH2F>(confRecentereTimeSp1.value, bc.timestamp());
}
bool restime = false;
if (useTimeRecentering) {
restime = Correcttime(hrecentereTimeSp1, timeMin, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (coarse2) {
if (useRecentereSp && (currentRunNumber != lastRunNumber)) {
hrecentereSpA[1] = ccdb->getForTimeStamp<THnF>(ConfRecentereSp2.value, bc.timestamp());
Expand All @@ -669,6 +684,13 @@ struct spvector {
resfine = Correctfine(hrecenterecentSpA[1], hrecenterevxSpA[1], hrecenterevySpA[1], hrecenterevzSpA[1], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (finetime2 && (currentRunNumber != lastRunNumber)) {
hrecentereTimeSp2 = ccdb->getForTimeStamp<TH2F>(confRecentereTimeSp2.value, bc.timestamp());
}
if (useTimeRecentering) {
restime = Correcttime(hrecentereTimeSp2, timeMin, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (coarse3) {
if (useRecentereSp && (currentRunNumber != lastRunNumber)) {
hrecentereSpA[2] = ccdb->getForTimeStamp<THnF>(ConfRecentereSp3.value, bc.timestamp());
Expand All @@ -686,6 +708,13 @@ struct spvector {
resfine = Correctfine(hrecenterecentSpA[2], hrecenterevxSpA[2], hrecenterevySpA[2], hrecenterevzSpA[2], centrality, vx, vy, vz, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (finetime3 && (currentRunNumber != lastRunNumber)) {
hrecentereTimeSp3 = ccdb->getForTimeStamp<TH2F>(confRecentereTimeSp3.value, bc.timestamp());
}
if (useTimeRecentering) {
restime = Correcttime(hrecentereTimeSp3, timeMin, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (coarse4) {
if (useRecentereSp && (currentRunNumber != lastRunNumber)) {
hrecentereSpA[3] = ccdb->getForTimeStamp<THnF>(ConfRecentereSp4.value, bc.timestamp());
Expand Down Expand Up @@ -741,16 +770,7 @@ struct spvector {
LOG(info) << "Histograms are null";
}

if (useTimeRecentering && (currentRunNumber != lastRunNumber)) {
hrecentereTimeSp = ccdb->getForTimeStamp<TH2F>(confRecentereTimeSp.value, bc.timestamp());
}

bool restime = false;
if (useTimeRecentering) {
restime = Correcttime(hrecentereTimeSp, timeMin, qxZDCA, qyZDCA, qxZDCC, qyZDCC);
}

if (restime == 0) {
if (useTimeRecentering && restime == 0 && check == 0) {
LOG(info) << "Histograms are null";
}

Expand Down
79 changes: 71 additions & 8 deletions PWGLF/TableProducer/Common/zdcvector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct zdcvector {
Produces<aod::ZDCCalTables> zdccaltable;
Produces<aod::ZDCEnergyTables> zdcenergytable;
Produces<aod::ZDCTimeTables> zdctimetable;
Produces<aod::ZDCChargedTracks> zdcchargedtracks;

// Configurables.
struct : ConfigurableGroup {
Expand All @@ -80,6 +81,12 @@ struct zdcvector {
Configurable<bool> usemem{"usemem", true, "usemem"};
Configurable<bool> usecfactor{"usecfactor", false, "use c factor"};

Configurable<float> cfgTrackPtMin{"cfgTrackPtMin", 0.2f, "Minimum charged-track pT"};
Configurable<float> cfgTrackPtMax{"cfgTrackPtMax", 10.0f, "Maximum charged-track pT"};
Configurable<float> cfgTrackEtaMax{"cfgTrackEtaMax", 0.8f, "Maximum absolute eta"};
Configurable<bool> cfgUseGlobalTracks{"cfgUseGlobalTracks", true, "Use global tracks"};
Configurable<bool> storeChargedTracks{"storeChargedTracks", true, "Store selected charged tracks in a linked extra table"};

struct : ConfigurableGroup {
Configurable<int> vzFineNbins{"vzFineNbins", 20, "Number of bins in Vz fine histograms"};
Configurable<float> lfinebinVz{"lfinebinVz", -10.0, "lower bin value in Vz fine histograms"};
Expand Down Expand Up @@ -143,13 +150,35 @@ struct zdcvector {
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
}

template <typename T>
bool selectionTrack(const T& candidate)
{
if (!(candidate.isGlobalTrack() &&
candidate.isPVContributor() &&
candidate.itsNCls() > 3 &&
candidate.tpcNClsFound() > 50.0 &&
candidate.itsNClsInnerBarrel() >= 1)) {
return false;
}

if (std::abs(candidate.dcaXY()) >= 0.1) {
return false;
}

if (std::abs(candidate.dcaZ()) >= 0.1) {
return false;
}

return true;
}

int currentRunNumber = -999;
int lastRunNumber = -999;
TH2D* gainprofile = nullptr;
TProfile* gainprofilevxy = nullptr;

// int lastRunNumberTimeRec = -999;
// for time since start of run
// for time since start of run
// int runForStartTime = -999;
// uint64_t runStartTime = 0;

Expand Down Expand Up @@ -217,7 +246,7 @@ struct zdcvector {
float qxA,
float qxC,
float qyA,
float qyC) {
float qyC) -> int32_t {
zdccaltable(trigger,
currentRunNumber,
centrality,
Expand All @@ -229,7 +258,7 @@ struct zdcvector {
qyA,
qyC);

auto zdcCalIndex = zdccaltable.lastIndex();
const auto zdcCalIndex = static_cast<int32_t>(zdccaltable.lastIndex());

if (storeZdcEnergy) {
zdcenergytable(zdcCalIndex,
Expand All @@ -244,11 +273,14 @@ struct zdcvector {
znc2,
znc3);
}

if (storeZdcTime) {
zdctimetable(zdcCalIndex,
timestampzdc,
timeInMinutes);
}

return zdcCalIndex;
};

if (!bc.has_zdc()) {
Expand Down Expand Up @@ -439,11 +471,42 @@ struct zdcvector {
lastRunNumber = currentRunNumber;
}
// zdccaltable(triggerevent, currentRunNumber, centrality, vx, vy, vz, qxZDCA, qxZDCC, qyZDCA, qyZDCC);
fillTables(triggerevent,
qxZDCA,
qxZDCC,
qyZDCA,
qyZDCC);
const auto zdcCalIndex = fillTables(triggerevent,
qxZDCA,
qxZDCC,
qyZDCA,
qyZDCC);

// Do not write tracks for events rejected by your ZDC/event selection
if (!triggerevent || !storeChargedTracks) {
return;
}

// In this process signature, "tracks" are the tracks associated with
// the current collision.
for (const auto& track : tracks) {
if (!selectionTrack(track)) {
continue;
}

if (track.pt() < cfgTrackPtMin || track.pt() > cfgTrackPtMax) {
continue;
}

if (track.sign() == 0) {
continue;
}

if (std::abs(track.eta()) > cfgTrackEtaMax) {
continue;
}

zdcchargedtracks(zdcCalIndex,
track.px(),
track.py(),
track.pz(),
static_cast<int8_t>(track.sign()));
}
}
};

Expand Down
Loading