Skip to content

Commit e92dc99

Browse files
author
Sabrina Hernandez
committed
added ccdb objects
1 parent bb4736d commit e92dc99

File tree

1 file changed

+83
-18
lines changed

1 file changed

+83
-18
lines changed

PWGCF/Flow/Tasks/flowZdcTask.cxx

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

17+
// o2-analysis-cf-flow-zdc-task --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-track-propagation --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-timestamp --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-event-selection --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-trackselection --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-centrality-table --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-multiplicity-table --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-tracks-extra-v002-converter --aod-file AO2D.root --configuration json://configuration_run3.json -b
18+
1719
#include <CCDB/BasicCCDBManager.h>
1820
#include <cmath>
1921
#include <vector>
@@ -24,6 +26,8 @@
2426
#include "Framework/RunningWorkflowInfo.h"
2527
#include "Framework/HistogramRegistry.h"
2628

29+
#include "Common/CCDB/EventSelectionParams.h"
30+
#include "Common/CCDB/TriggerAliases.h"
2731
#include "Common/DataModel/EventSelection.h"
2832
#include "Common/DataModel/TrackSelectionTables.h"
2933
#include "Common/DataModel/Centrality.h"
@@ -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,13 @@ 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"};
159+
144160

145161
enum EvCutLabel {
146162
All = 1,
@@ -164,8 +180,7 @@ struct FlowZdcTask {
164180
// Begin Histogram Registry
165181

166182
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)};
183+
Service<ccdb::BasicCCDBManager> ccdb;
169184
OutputObj<TProfile> pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
170185
OutputObj<TProfile> pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
171186
OutputObj<TProfile> pZNratiovscent{TProfile("pZNratiovscent", "Ratio ZNC/ZNA vs FT0C Centrality", 100, 0, 100, 0, 5)};
@@ -337,6 +352,24 @@ struct FlowZdcTask {
337352
histos.add("ZNVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA+ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}});
338353
histos.add("ZNDifVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA-ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {100, -50., 50.}}});
339354
}
355+
LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value;
356+
LOG(info) << "\tapplyEff=" << applyEff.value;
357+
LOG(info) << "\tpaTH=" << paTH.value;
358+
LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value;
359+
LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value;
360+
LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value;
361+
LOG(info) << "\tminPt=" << minPt.value;
362+
LOG(info) << "\tmaxPt=" << maxPt.value;
363+
LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value;
364+
365+
ccdb->setURL("http://alice-ccdb.cern.ch");
366+
// Enabling object caching, otherwise each call goes to the CCDB server
367+
ccdb->setCaching(true);
368+
ccdb->setLocalObjectValidityChecking();
369+
ccdb->setFatalWhenNull(false);
370+
// Not later than now, will be replaced by the value of the train creation
371+
// This avoids that users can replace objects **while** a train is running
372+
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
340373
}
341374
template <typename EventCuts>
342375
bool isEventSelected(EventCuts const& col)
@@ -479,7 +512,8 @@ struct FlowZdcTask {
479512
}
480513
histos.fill(HIST("hEventCounter"), EvCutLabel::Zem);
481514
}
482-
515+
516+
const double normT0M{(aT0A + aT0C) / 100.};
483517
float znA = zdc.amplitudeZNA() / cfgCollisionEnergy;
484518
float znC = zdc.amplitudeZNC() / cfgCollisionEnergy;
485519
float zpA = zdc.amplitudeZPA() / cfgCollisionEnergy;
@@ -506,7 +540,50 @@ struct FlowZdcTask {
506540
}
507541
glbTracks++;
508542
}
543+
bool skipEvent{false};
544+
if (useMidRapNchSel) {
545+
auto hMeanNch = ccdb->getForTimeStamp<TH1F>(paTHmeanNch.value, foundBC.timestamp());
546+
auto hSigmaNch = ccdb->getForTimeStamp<TH1F>(paTHsigmaNch.value, foundBC.timestamp());
547+
if (!hMeanNch) {
548+
LOGF(info, "hMeanNch NOT LOADED!");
549+
return;
550+
}
551+
if (!hSigmaNch) {
552+
LOGF(info, "hSigmaNch NOT LOADED!");
553+
return;
554+
}
555+
556+
const int binT0M{hMeanNch->FindBin(normT0M)};
557+
const double meanNch{hMeanNch->GetBinContent(binT0M)};
558+
const double sigmaNch{hSigmaNch->GetBinContent(binT0M)};
559+
const double nSigmaSelection{nSigmaNchCut * sigmaNch};
560+
const double diffMeanNch{meanNch - glbTracks};
561+
562+
if (!(std::abs(diffMeanNch) < nSigmaSelection)) {
563+
histos.fill(HIST("ExcludedEvtVsNch"), glbTracks);
564+
} else {
565+
skipEvent = true;
566+
}
567+
}
568+
if (!skipEvent) {
569+
return;
570+
}
571+
572+
for (const auto& track : tracks) {
573+
// Track Selection
574+
if (!track.isGlobalTrack()) {
575+
continue;
576+
}
577+
if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) {
578+
continue;
579+
}
509580

581+
histos.fill(HIST("ZposVsEta"), collision.posZ(), track.eta());
582+
histos.fill(HIST("EtaVsPhi"), track.eta(), track.phi());
583+
histos.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt());
584+
et += std::sqrt(std::pow(track.pt(), 2.) + std::pow(o2::constants::physics::MassPionCharged, 2.));
585+
meanpt += track.pt();
586+
}
510587
histos.fill(HIST("zPos"), collision.posZ());
511588
histos.fill(HIST("T0Ccent"), collision.centFT0C());
512589

@@ -574,18 +651,13 @@ struct FlowZdcTask {
574651
int globalTracks = tracks.size();
575652
if (globalTracks < 1)
576653
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
581654
int nTot{0}; // Tracks are already filtered with GlobalTrack || GlobalTrackSDD
582655
for (const auto& track : tracks) {
583656
double phi = track.phi();
584657
nTot++;
585658
histos.fill(HIST("etaHistogram"), track.eta());
586659
histos.fill(HIST("phiHistogram"), track.phi());
587660
histos.fill(HIST("ptHistogram"), track.pt());
588-
qTPC += std::complex<double>(std::cos(2.0 * phi), std::sin(2.0 * phi));
589661
} // end track loop 1
590662
double pT{0};
591663
for (const auto& track : tracks) {
@@ -599,16 +671,9 @@ struct FlowZdcTask {
599671
histos.fill(HIST("multvsCent"), cent, nTot);
600672
histos.fill(HIST("hYield"), nTot, pT);
601673
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);
607674

608675
histos.fill(HIST("TPCmultiplicity"), multTPC);
609676
histos.fill(HIST("hGlobalTracks"), globalTracks);
610-
611-
histos.fill(HIST("revsimag"), qTpcReal, qTpcIm);
612677
}
613678
void processZdcCollAssoc(
614679
AodCollisions::iterator const& collision,

0 commit comments

Comments
 (0)