Skip to content

Commit f07e805

Browse files
author
Sabrina Hernandez
committed
added ccdb objects
1 parent 025cbfe commit f07e805

1 file changed

Lines changed: 81 additions & 18 deletions

File tree

PWGCF/Flow/Tasks/flowZdcTask.cxx

Lines changed: 81 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include "Framework/RunningWorkflowInfo.h"
2525
#include "Framework/HistogramRegistry.h"
2626

27+
#include "Common/CCDB/EventSelectionParams.h"
28+
#include "Common/CCDB/TriggerAliases.h"
2729
#include "Common/DataModel/EventSelection.h"
2830
#include "Common/DataModel/TrackSelectionTables.h"
2931
#include "Common/DataModel/Centrality.h"
@@ -98,14 +100,22 @@ struct FlowZdcTask {
98100
Configurable<bool> isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut?"};
99101
Configurable<bool> isTDCcut{"isTDCcut", false, "Use TDC cut?"};
100102
Configurable<bool> isZEMcut{"isZEMcut", true, "Use ZEM cut?"};
103+
Configurable<bool> useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"};
104+
Configurable<bool> applyEff{"applyEff", true, "Apply track-by-track efficiency correction"};
101105

106+
Configurable<float> nSigmaNchCut{"nSigmaNchCut", 1., "nSigma Nch selection"};
102107
Configurable<double> minNchSel{"minNchSel", 5., "min Nch Selection"};
103108
Configurable<float> znBasedCut{"znBasedCut", 100, "ZN-based cut"};
104109
Configurable<float> zemCut{"zemCut", 1000., "ZEM cut"};
105110
Configurable<float> tdcCut{"tdcCut", 1., "TDC cut"};
106111
Configurable<float> minOccCut{"minOccCut", 0, "min Occu cut"};
107112
Configurable<float> maxOccCut{"maxOccCut", 500, "max Occu cut"};
108113
Configurable<int> minITSnCls{"minITSnCls", 5, "min ITSnCls"};
114+
Configurable<float> minPt{"minPt", 0.1, "minimum pt of the tracks"};
115+
Configurable<float> maxPt{"maxPt", 3., "maximum pt of the tracks"};
116+
Configurable<float> maxPtSpectra{"maxPtSpectra", 50., "maximum pt of the tracks"};
117+
Configurable<float> minEta{"minEta", -0.8, "minimum eta"};
118+
Configurable<float> maxEta{"maxEta", +0.8, "maximum eta"};
109119
// axis configs
110120
ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"};
111121
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
@@ -138,9 +148,13 @@ struct FlowZdcTask {
138148
using CollisionDataTable = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms>;
139149
using TrackDataTable = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection>;
140150
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
151+
152+
// CCDB paths
153+
Configurable<std::string> paTH{"paTH", "Users/s/sahernan/test", "base path to the ccdb object"};
154+
Configurable<std::string> paTHmeanNch{"paTHmeanNch", "Users/s/shernan/test", "base path to the ccdb object"};
155+
Configurable<std::string> paTHsigmaNch{"paTHsigmaNch", "Users/s/shernan/testSigma", "base path to the ccdb object"};
156+
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"};
157+
144158

145159
enum EvCutLabel {
146160
All = 1,
@@ -164,8 +178,7 @@ struct FlowZdcTask {
164178
// Begin Histogram Registry
165179

166180
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)};
181+
Service<ccdb::BasicCCDBManager> ccdb;
169182
OutputObj<TProfile> pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
170183
OutputObj<TProfile> pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
171184
OutputObj<TProfile> pZNratiovscent{TProfile("pZNratiovscent", "Ratio ZNC/ZNA vs FT0C Centrality", 100, 0, 100, 0, 5)};
@@ -337,6 +350,24 @@ struct FlowZdcTask {
337350
histos.add("ZNVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA+ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}});
338351
histos.add("ZNDifVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA-ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {100, -50., 50.}}});
339352
}
353+
LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value;
354+
LOG(info) << "\tapplyEff=" << applyEff.value;
355+
LOG(info) << "\tpaTH=" << paTH.value;
356+
LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value;
357+
LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value;
358+
LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value;
359+
LOG(info) << "\tminPt=" << minPt.value;
360+
LOG(info) << "\tmaxPt=" << maxPt.value;
361+
LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value;
362+
363+
ccdb->setURL("http://alice-ccdb.cern.ch");
364+
// Enabling object caching, otherwise each call goes to the CCDB server
365+
ccdb->setCaching(true);
366+
ccdb->setLocalObjectValidityChecking();
367+
ccdb->setFatalWhenNull(false);
368+
// Not later than now, will be replaced by the value of the train creation
369+
// This avoids that users can replace objects **while** a train is running
370+
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
340371
}
341372
template <typename EventCuts>
342373
bool isEventSelected(EventCuts const& col)
@@ -479,7 +510,8 @@ struct FlowZdcTask {
479510
}
480511
histos.fill(HIST("hEventCounter"), EvCutLabel::Zem);
481512
}
482-
513+
514+
const double normT0M{(aT0A + aT0C) / 100.};
483515
float znA = zdc.amplitudeZNA() / cfgCollisionEnergy;
484516
float znC = zdc.amplitudeZNC() / cfgCollisionEnergy;
485517
float zpA = zdc.amplitudeZPA() / cfgCollisionEnergy;
@@ -506,7 +538,50 @@ struct FlowZdcTask {
506538
}
507539
glbTracks++;
508540
}
541+
bool skipEvent{false};
542+
if (useMidRapNchSel) {
543+
auto hMeanNch = ccdb->getForTimeStamp<TH1F>(paTHmeanNch.value, foundBC.timestamp());
544+
auto hSigmaNch = ccdb->getForTimeStamp<TH1F>(paTHsigmaNch.value, foundBC.timestamp());
545+
if (!hMeanNch) {
546+
LOGF(info, "hMeanNch NOT LOADED!");
547+
return;
548+
}
549+
if (!hSigmaNch) {
550+
LOGF(info, "hSigmaNch NOT LOADED!");
551+
return;
552+
}
553+
554+
const int binT0M{hMeanNch->FindBin(normT0M)};
555+
const double meanNch{hMeanNch->GetBinContent(binT0M)};
556+
const double sigmaNch{hSigmaNch->GetBinContent(binT0M)};
557+
const double nSigmaSelection{nSigmaNchCut * sigmaNch};
558+
const double diffMeanNch{meanNch - glbTracks};
559+
560+
if (!(std::abs(diffMeanNch) < nSigmaSelection)) {
561+
histos.fill(HIST("ExcludedEvtVsNch"), glbTracks);
562+
} else {
563+
skipEvent = true;
564+
}
565+
}
566+
if (!skipEvent) {
567+
return;
568+
}
509569

570+
for (const auto& track : tracks) {
571+
// Track Selection
572+
if (!track.isGlobalTrack()) {
573+
continue;
574+
}
575+
if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) {
576+
continue;
577+
}
578+
579+
histos.fill(HIST("ZposVsEta"), collision.posZ(), track.eta());
580+
histos.fill(HIST("EtaVsPhi"), track.eta(), track.phi());
581+
histos.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt());
582+
et += std::sqrt(std::pow(track.pt(), 2.) + std::pow(o2::constants::physics::MassPionCharged, 2.));
583+
meanpt += track.pt();
584+
}
510585
histos.fill(HIST("zPos"), collision.posZ());
511586
histos.fill(HIST("T0Ccent"), collision.centFT0C());
512587

@@ -574,18 +649,13 @@ struct FlowZdcTask {
574649
int globalTracks = tracks.size();
575650
if (globalTracks < 1)
576651
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
581652
int nTot{0}; // Tracks are already filtered with GlobalTrack || GlobalTrackSDD
582653
for (const auto& track : tracks) {
583654
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)