Skip to content

Commit e6cfe89

Browse files
hernasabSabrina Hernandez
andauthored
[PWGCF] added ccdb objects (AliceO2Group#11568)
Co-authored-by: Sabrina Hernandez <[email protected]>
1 parent 19e2187 commit e6cfe89

File tree

1 file changed

+97
-34
lines changed

1 file changed

+97
-34
lines changed

PWGCF/Flow/Tasks/flowZdcTask.cxx

Lines changed: 97 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,34 @@
1414
/// \since 10/01/2024
1515
/// \brief task to evaluate flow and neutron skin with information from ZDC
1616

17-
#include <CCDB/BasicCCDBManager.h>
18-
#include <cmath>
19-
#include <vector>
20-
#include <complex>
21-
#include "Framework/runDataProcessing.h"
22-
#include "Framework/AnalysisTask.h"
23-
#include "Framework/ASoAHelpers.h"
24-
#include "Framework/RunningWorkflowInfo.h"
25-
#include "Framework/HistogramRegistry.h"
26-
27-
#include "Common/DataModel/EventSelection.h"
28-
#include "Common/DataModel/TrackSelectionTables.h"
17+
#include "Common/CCDB/EventSelectionParams.h"
18+
#include "Common/CCDB/TriggerAliases.h"
2919
#include "Common/DataModel/Centrality.h"
20+
#include "Common/DataModel/EventSelection.h"
3021
#include "Common/DataModel/Multiplicity.h"
3122
#include "Common/DataModel/PIDResponse.h"
23+
#include "Common/DataModel/TrackSelectionTables.h"
24+
25+
#include "Framework/ASoAHelpers.h"
26+
#include "Framework/AnalysisTask.h"
27+
#include "Framework/HistogramRegistry.h"
28+
#include "Framework/RunningWorkflowInfo.h"
29+
#include "Framework/runDataProcessing.h"
30+
#include <CCDB/BasicCCDBManager.h>
3231

3332
#include "TList.h"
34-
#include <TProfile.h>
35-
#include <TRandom3.h>
33+
#include <TComplex.h>
3634
#include <TF1.h>
35+
#include <TMath.h>
36+
#include <TProfile.h>
3737
#include <TProfile2D.h>
3838
#include <TRandom3.h>
39-
#include <TMath.h>
40-
#include <TComplex.h>
39+
40+
#include <cmath>
41+
#include <complex>
42+
#include <string>
43+
#include <vector>
44+
4145
using namespace o2;
4246
using namespace o2::framework;
4347
using namespace o2::framework::expressions;
@@ -98,14 +102,22 @@ struct FlowZdcTask {
98102
Configurable<bool> isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut?"};
99103
Configurable<bool> isTDCcut{"isTDCcut", false, "Use TDC cut?"};
100104
Configurable<bool> isZEMcut{"isZEMcut", true, "Use ZEM cut?"};
105+
Configurable<bool> useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"};
106+
Configurable<bool> applyEff{"applyEff", true, "Apply track-by-track efficiency correction"};
101107

108+
Configurable<float> nSigmaNchCut{"nSigmaNchCut", 1., "nSigma Nch selection"};
102109
Configurable<double> minNchSel{"minNchSel", 5., "min Nch Selection"};
103110
Configurable<float> znBasedCut{"znBasedCut", 100, "ZN-based cut"};
104111
Configurable<float> zemCut{"zemCut", 1000., "ZEM cut"};
105112
Configurable<float> tdcCut{"tdcCut", 1., "TDC cut"};
106113
Configurable<float> minOccCut{"minOccCut", 0, "min Occu cut"};
107114
Configurable<float> maxOccCut{"maxOccCut", 500, "max Occu cut"};
108115
Configurable<int> minITSnCls{"minITSnCls", 5, "min ITSnCls"};
116+
Configurable<float> minPt{"minPt", 0.1, "minimum pt of the tracks"};
117+
Configurable<float> maxPt{"maxPt", 3., "maximum pt of the tracks"};
118+
Configurable<float> maxPtSpectra{"maxPtSpectra", 50., "maximum pt of the tracks"};
119+
Configurable<float> minEta{"minEta", -0.8, "minimum eta"};
120+
Configurable<float> maxEta{"maxEta", +0.8, "maximum eta"};
109121
// axis configs
110122
ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"};
111123
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
@@ -138,9 +150,12 @@ struct FlowZdcTask {
138150
using CollisionDataTable = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms>;
139151
using TrackDataTable = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection>;
140152
using FilTrackDataTable = soa::Filtered<TrackDataTable>;
141-
std::complex<double> qTPC; // init q TPC
142-
std::complex<double> qZNA{0, 0}; // init qZNA
143-
std::complex<double> qZNC{0, 0}; // init qZNC
153+
154+
// CCDB paths
155+
Configurable<std::string> paTH{"paTH", "Users/s/sahernan/test", "base path to the ccdb object"};
156+
Configurable<std::string> paTHmeanNch{"paTHmeanNch", "Users/s/shernan/test", "base path to the ccdb object"};
157+
Configurable<std::string> paTHsigmaNch{"paTHsigmaNch", "Users/s/shernan/testSigma", "base path to the ccdb object"};
158+
Configurable<int64_t> ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
144159

145160
enum EvCutLabel {
146161
All = 1,
@@ -164,8 +179,7 @@ struct FlowZdcTask {
164179
// Begin Histogram Registry
165180

166181
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
167-
OutputObj<TProfile> pCosPsiDifferences{TProfile("pCosPsiDifferences", "Differences in cos(psi) vs Centrality;Centrality;Mean cos(psi) Difference", 200, 0, 100, -1, 1)};
168-
OutputObj<TProfile> pSinPsiDifferences{TProfile("pSinPsiDifferences", "Differences in sin(psi) vs Centrality;Centrality;Mean sin(psi) Difference", 200, 0, 100, -1, 1)};
182+
Service<ccdb::BasicCCDBManager> ccdb;
169183
OutputObj<TProfile> pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
170184
OutputObj<TProfile> pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
171185
OutputObj<TProfile> pZNratiovscent{TProfile("pZNratiovscent", "Ratio ZNC/ZNA vs FT0C Centrality", 100, 0, 100, 0, 5)};
@@ -337,6 +351,24 @@ struct FlowZdcTask {
337351
histos.add("ZNVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA+ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}});
338352
histos.add("ZNDifVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA-ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {100, -50., 50.}}});
339353
}
354+
LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value;
355+
LOG(info) << "\tapplyEff=" << applyEff.value;
356+
LOG(info) << "\tpaTH=" << paTH.value;
357+
LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value;
358+
LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value;
359+
LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value;
360+
LOG(info) << "\tminPt=" << minPt.value;
361+
LOG(info) << "\tmaxPt=" << maxPt.value;
362+
LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value;
363+
364+
ccdb->setURL("http://alice-ccdb.cern.ch");
365+
// Enabling object caching, otherwise each call goes to the CCDB server
366+
ccdb->setCaching(true);
367+
ccdb->setLocalObjectValidityChecking();
368+
ccdb->setFatalWhenNull(false);
369+
// Not later than now, will be replaced by the value of the train creation
370+
// This avoids that users can replace objects **while** a train is running
371+
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
340372
}
341373
template <typename EventCuts>
342374
bool isEventSelected(EventCuts const& col)
@@ -480,6 +512,7 @@ struct FlowZdcTask {
480512
histos.fill(HIST("hEventCounter"), EvCutLabel::Zem);
481513
}
482514

515+
const double normT0M{(aT0A + aT0C) / 100.};
483516
float znA = zdc.amplitudeZNA() / cfgCollisionEnergy;
484517
float znC = zdc.amplitudeZNC() / cfgCollisionEnergy;
485518
float zpA = zdc.amplitudeZPA() / cfgCollisionEnergy;
@@ -506,7 +539,50 @@ struct FlowZdcTask {
506539
}
507540
glbTracks++;
508541
}
542+
bool skipEvent{false};
543+
if (useMidRapNchSel) {
544+
auto hMeanNch = ccdb->getForTimeStamp<TH1F>(paTHmeanNch.value, foundBC.timestamp());
545+
auto hSigmaNch = ccdb->getForTimeStamp<TH1F>(paTHsigmaNch.value, foundBC.timestamp());
546+
if (!hMeanNch) {
547+
LOGF(info, "hMeanNch NOT LOADED!");
548+
return;
549+
}
550+
if (!hSigmaNch) {
551+
LOGF(info, "hSigmaNch NOT LOADED!");
552+
return;
553+
}
509554

555+
const int binT0M{hMeanNch->FindBin(normT0M)};
556+
const double meanNch{hMeanNch->GetBinContent(binT0M)};
557+
const double sigmaNch{hSigmaNch->GetBinContent(binT0M)};
558+
const double nSigmaSelection{nSigmaNchCut * sigmaNch};
559+
const double diffMeanNch{meanNch - glbTracks};
560+
561+
if (!(std::abs(diffMeanNch) < nSigmaSelection)) {
562+
histos.fill(HIST("ExcludedEvtVsNch"), glbTracks);
563+
} else {
564+
skipEvent = true;
565+
}
566+
}
567+
if (!skipEvent) {
568+
return;
569+
}
570+
571+
for (const auto& track : tracks) {
572+
// Track Selection
573+
if (!track.isGlobalTrack()) {
574+
continue;
575+
}
576+
if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) {
577+
continue;
578+
}
579+
580+
histos.fill(HIST("ZposVsEta"), collision.posZ(), track.eta());
581+
histos.fill(HIST("EtaVsPhi"), track.eta(), track.phi());
582+
histos.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt());
583+
et += std::sqrt(std::pow(track.pt(), 2.) + std::pow(o2::constants::physics::MassPionCharged, 2.));
584+
meanpt += track.pt();
585+
}
510586
histos.fill(HIST("zPos"), collision.posZ());
511587
histos.fill(HIST("T0Ccent"), collision.centFT0C());
512588

@@ -574,18 +650,12 @@ struct FlowZdcTask {
574650
int globalTracks = tracks.size();
575651
if (globalTracks < 1)
576652
return;
577-
// this is the q vector for the TPC data. it is a complex function
578-
double qTpcReal = 0.0; // Initialize qTPC_real
579-
double qTpcIm = 0.0; // init qTPC_imaginary
580-
std::complex<double> qTPC(0, 0); // Starting with a q-vector of zero
581653
int nTot{0}; // Tracks are already filtered with GlobalTrack || GlobalTrackSDD
582654
for (const auto& track : tracks) {
583-
double phi = track.phi();
584655
nTot++;
585656
histos.fill(HIST("etaHistogram"), track.eta());
586657
histos.fill(HIST("phiHistogram"), track.phi());
587658
histos.fill(HIST("ptHistogram"), track.pt());
588-
qTPC += std::complex<double>(std::cos(2.0 * phi), std::sin(2.0 * phi));
589659
} // end track loop 1
590660
double pT{0};
591661
for (const auto& track : tracks) {
@@ -599,16 +669,9 @@ struct FlowZdcTask {
599669
histos.fill(HIST("multvsCent"), cent, nTot);
600670
histos.fill(HIST("hYield"), nTot, pT);
601671
histos.fill(HIST("multHistogram"), nTot);
602-
qTpcReal = qTPC.real() / nTot; // normalize these vectors by the total number of particles
603-
qTpcIm = qTPC.imag() / nTot;
604-
605-
histos.fill(HIST("REqHistogram"), qTpcReal);
606-
histos.fill(HIST("IMqHistogram"), qTpcIm);
607672

608673
histos.fill(HIST("TPCmultiplicity"), multTPC);
609674
histos.fill(HIST("hGlobalTracks"), globalTracks);
610-
611-
histos.fill(HIST("revsimag"), qTpcReal, qTpcIm);
612675
}
613676
void processZdcCollAssoc(
614677
AodCollisions::iterator const& collision,

0 commit comments

Comments
 (0)