Skip to content

Commit deb02c5

Browse files
committed
Add extra corr
1 parent 727959f commit deb02c5

1 file changed

Lines changed: 96 additions & 19 deletions

File tree

PWGCF/Flow/TableProducer/zdcQVectors.cxx

Lines changed: 96 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "Common/CCDB/RCTSelectionFlags.h"
2121
#include "Common/DataModel/Centrality.h"
2222
#include "Common/DataModel/EventSelection.h"
23+
#include "Common/DataModel/TrackSelectionTables.h"
24+
#include "Common/DataModel/Multiplicity.h"
2325

2426
#include <CCDB/BasicCCDBManager.h>
2527
#include <CommonConstants/MathConstants.h>
@@ -155,17 +157,29 @@ struct ZdcQVectors {
155157
O2_DEFINE_CONFIGURABLE(cfgFillNothing, bool, false, "Disable ALL Histograms -> ONLY use to reduce memory");
156158
O2_DEFINE_CONFIGURABLE(cfgNoGain, bool, false, "Do not apply gain correction to ZDC energy calibration");
157159

160+
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCAxy, float, 0.2, "Cut on DCA in the transverse direction (cm)");
161+
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCAz, float, 0.2, "Cut on DCA in the longitudinal direction (cm)");
162+
O2_DEFINE_CONFIGURABLE(cfgTrackSelsPtmin, float, 0.2, "minimum pt (GeV/c)");
163+
O2_DEFINE_CONFIGURABLE(cfgTrackSelsPtmax, float, 10, "maximum pt (GeV/c)");
164+
O2_DEFINE_CONFIGURABLE(cfgTrackSelsEta, float, 0.8, "eta cut");
165+
158166
O2_DEFINE_CONFIGURABLE(cfgCCDBdir_Shift, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/Shift", "CCDB directory for Shift ZDC");
159-
O2_DEFINE_CONFIGURABLE(cfgSelVec, std::vector<bool>, {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1}, "Put 1 for every event selection from SelectionCriteria that is used in flowSP");
167+
Configurable<std::vector<int>> cfgSelVec{"cfgSelVec", std::vector<int>{1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1}, "Put 1 for every event selection from SelectionCriteria that is used in flowSP"};
168+
Configurable<std::vector<double>> cfgEvSelsMultPv{"cfgEvSelsMultPv", std::vector<double>{2223.49, -75.1444, 0.963572, -0.00570399, 1.34877e-05, 3790.99, -137.064, 2.13044, -0.017122, 5.82834e-05}, "Multiplicity cuts (PV) first 5 parameters cutLOW last 5 cutHIGH (Default is +-2sigma pass5) "};
169+
Configurable<std::vector<double>> cfgEvSelsMult{"cfgEvSelsMult", std::vector<double>{1301.56, -41.4615, 0.478224, -0.00239449, 4.46966e-06, 2967.6, -102.927, 1.47488, -0.0106534, 3.28622e-05}, "Multiplicity cuts (Global) first 5 parameters cutLOW last 5 cutHIGH (Default is +-2sigma pass5) "};
160170

161171
// define my.....
162172
// Filter collisionFilter = nabs(aod::collision::posZ) <;
163-
using UsedCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNGlobals>;
173+
174+
using UsedCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNGlobals>;
164175
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
176+
Filter trackFilter = nabs(aod::track::eta) < cfgTrackSelsEta && aod::track::pt > cfgTrackSelsPtmin && aod::track::pt < cfgTrackSelsPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && nabs(aod::track::dcaXY) < cfgTrackSelsDCAxy && nabs(aod::track::dcaZ) < cfgTrackSelsDCAz;
177+
using UnfilteredTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA>;
178+
using UsedTracks = soa::Filtered<UnfilteredTracks>;
165179

166180
enum SelectionCriteria {
167-
FilteredEvent,
168-
BCHasZDC,
181+
evSel_FilteredEvent,
182+
evSel_BCHasZDC,
169183
evSel_isSelectedZDC,
170184
evSel_Zvtx,
171185
evSel_sel8,
@@ -179,6 +193,7 @@ struct ZdcQVectors {
179193
evSel_kIsGoodITSLayer0123,
180194
evSel_RCTFlagsZDC,
181195
evSel_CentCuts,
196+
evSel_MultCut,
182197
nEventSelections
183198
};
184199

@@ -192,6 +207,15 @@ struct ZdcQVectors {
192207
// Define output
193208
HistogramRegistry registry{"Registry"};
194209

210+
// Event selection cuts
211+
std::unique_ptr<TF1> fPhiCutLow = nullptr;
212+
std::unique_ptr<TF1> fPhiCutHigh = nullptr;
213+
std::unique_ptr<TF1> fMultPVCutLow = nullptr;
214+
std::unique_ptr<TF1> fMultPVCutHigh = nullptr;
215+
std::unique_ptr<TF1> fMultCutLow = nullptr;
216+
std::unique_ptr<TF1> fMultCutHigh = nullptr;
217+
std::unique_ptr<TF1> fMultMultPVCut = nullptr;
218+
195219
Service<ccdb::BasicCCDBManager> ccdb;
196220

197221
// keep track of calibration histos for each given step and iteration
@@ -247,6 +271,7 @@ struct ZdcQVectors {
247271
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_CentCuts + 1, "Cenrality range");
248272
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kIsGoodITSLayersAll");
249273
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayer0123 + 1, "kIsGoodITSLayer0123");
274+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_MultCut + 1, "Mult & MultPV");
250275
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected");
251276

252277
int totalTowers = 10;
@@ -381,7 +406,28 @@ struct ZdcQVectors {
381406
registry.addClone("recentering/before/", "recentering/after/");
382407
registry.addClone("QA/before/", "QA/after/");
383408
}
409+
410+
fMultPVCutLow = std::make_unique<TF1>("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
411+
fMultPVCutHigh = std::make_unique<TF1>("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
412+
fMultCutLow = std::make_unique<TF1>("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
413+
fMultCutHigh = std::make_unique<TF1>("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
414+
415+
std::vector<double> paramsMultPVCut = cfgEvSelsMultPv;
416+
std::vector<double> paramsMultCut = cfgEvSelsMult;
417+
418+
uint64_t nParams = 10;
419+
420+
if (paramsMultPVCut.size() < nParams) {
421+
LOGF(fatal, "cfg.cEvSelsMultPv not set properly.. size = %d (should be 10) --> Check your config files!", paramsMultPVCut.size());
422+
} else if (paramsMultCut.size() < nParams) {
423+
LOGF(fatal, "cfg.cEvSelsMult not set properly.. size = %d (should be 10) --> Check your config files!", paramsMultCut.size());
424+
} else {
425+
fMultPVCutLow->SetParameters(paramsMultPVCut[0], paramsMultPVCut[1], paramsMultPVCut[2], paramsMultPVCut[3], paramsMultPVCut[4]);
426+
fMultPVCutHigh->SetParameters(paramsMultPVCut[5], paramsMultPVCut[6], paramsMultPVCut[7], paramsMultPVCut[8], paramsMultPVCut[9]);
427+
fMultCutLow->SetParameters(paramsMultCut[0], paramsMultCut[1], paramsMultCut[2], paramsMultCut[3], paramsMultCut[4]);
428+
fMultCutHigh->SetParameters(paramsMultCut[5], paramsMultCut[6], paramsMultCut[7], paramsMultCut[8], paramsMultCut[9]);
384429
}
430+
}
385431

386432
double rescaleTimestamp(uint64_t timestamp, int runnumber)
387433
{
@@ -444,7 +490,7 @@ struct ZdcQVectors {
444490
}
445491

446492
template <typename TCollision, typename TBunchCrossing>
447-
uint16_t eventSelected(TCollision collision, TBunchCrossing bunchCrossing, bool& isEventSelected)
493+
uint16_t eventSelected(TCollision collision, TBunchCrossing bunchCrossing, bool& isEventSelected, const int& multTrk)
448494
{
449495
uint16_t selectionBits = 0;
450496
bool selected;
@@ -458,15 +504,15 @@ struct ZdcQVectors {
458504
if (selected) {
459505
selectionBits |= static_cast<uint16_t>(0x1u << evSel_Zvtx);
460506
fillCutAnalysis(collision, bunchCrossing, evSel_Zvtx);
461-
} else if(cfgSelVec[evSel_Zvtx]){
507+
} else if(cfgSelVec.value[evSel_Zvtx]){
462508
isEventSelected = false;
463509
}
464510

465511
selected = collision.sel8();
466512
if (selected) {
467513
selectionBits |= static_cast<uint16_t>(0x1u << evSel_sel8);
468514
fillCutAnalysis(collision, bunchCrossing, evSel_sel8);
469-
} else if(cfgSelVec[evSel_sel8]){
515+
} else if(cfgSelVec.value[evSel_sel8]){
470516
isEventSelected = false;
471517
}
472518

@@ -475,77 +521,107 @@ struct ZdcQVectors {
475521
if (selected) {
476522
selectionBits |= static_cast<uint16_t>(0x1u << evSel_occupancy);
477523
fillCutAnalysis(collision, bunchCrossing, evSel_occupancy);
478-
} else if(cfgSelVec[evSel_occupancy]){
524+
} else if(cfgSelVec.value[evSel_occupancy]){
479525
isEventSelected = false;
480526
}
481527

482528
selected = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup);
483529
if (selected) {
484530
selectionBits |= static_cast<uint16_t>(0x1u << evSel_kNoSameBunchPileup);
485531
fillCutAnalysis(collision, bunchCrossing, evSel_kNoSameBunchPileup);
486-
} else if(cfgSelVec[evSel_kNoSameBunchPileup]){
532+
} else if(cfgSelVec.value[evSel_kNoSameBunchPileup]){
487533
isEventSelected = false;
488534
}
489535

490536
selected = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV);
491537
if (selected) {
492538
selectionBits |= static_cast<uint16_t>(0x1u << evSel_kIsGoodZvtxFT0vsPV);
493539
fillCutAnalysis(collision, bunchCrossing, evSel_kIsGoodZvtxFT0vsPV);
494-
} else if(cfgSelVec[evSel_kIsGoodZvtxFT0vsPV]){
540+
} else if(cfgSelVec.value[evSel_kIsGoodZvtxFT0vsPV]){
495541
isEventSelected = false;
496542
}
497543

498544
selected = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard);
499545
if (selected) {
500546
selectionBits |= static_cast<uint16_t>(0x1u << evSel_kNoCollInTimeRangeStandard);
501547
fillCutAnalysis(collision, bunchCrossing, evSel_kNoCollInTimeRangeStandard);
502-
} else if(cfgSelVec[evSel_kNoCollInTimeRangeStandard]){
548+
} else if(cfgSelVec.value[evSel_kNoCollInTimeRangeStandard]){
503549
isEventSelected = false;
504550
}
505551

506552
selected = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow);
507553
if (selected) {
508554
selectionBits |= static_cast<uint16_t>(0x1u << evSel_kNoCollInTimeRangeNarrow);
509555
fillCutAnalysis(collision, bunchCrossing, evSel_kNoCollInTimeRangeNarrow);
510-
} else if(cfgSelVec[evSel_kNoCollInTimeRangeNarrow]){
556+
} else if(cfgSelVec.value[evSel_kNoCollInTimeRangeNarrow]){
511557
isEventSelected = false;
512558
}
513559

514560
selected = collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC);
515561
if (selected) {
516562
selectionBits |= static_cast<uint16_t>(0x1u << evSel_kIsVertexITSTPC);
517563
fillCutAnalysis(collision, bunchCrossing, evSel_kIsVertexITSTPC);
518-
} else if(cfgSelVec[evSel_kIsVertexITSTPC]){
564+
} else if(cfgSelVec.value[evSel_kIsVertexITSTPC]){
519565
isEventSelected = false;
520566
}
521567

522568
selected = collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll);
523569
if (selected) {
524570
selectionBits |= static_cast<uint16_t>(0x1u << evSel_kIsGoodITSLayersAll);
525571
fillCutAnalysis(collision, bunchCrossing, evSel_kIsGoodITSLayersAll);
526-
} else if(cfgSelVec[evSel_kIsGoodITSLayersAll]){
572+
} else if(cfgSelVec.value[evSel_kIsGoodITSLayersAll]){
527573
isEventSelected = false;
528574
}
529575

530576
selected = collision.selection_bit(o2::aod::evsel::kIsGoodITSLayer0123);
531577
if (selected) {
532578
selectionBits |= static_cast<uint16_t>(0x1u << evSel_kIsGoodITSLayer0123);
533579
fillCutAnalysis(collision, bunchCrossing, evSel_kIsGoodITSLayer0123);
534-
} else if(cfgSelVec[evSel_kIsGoodITSLayer0123]){
580+
} else if(cfgSelVec.value[evSel_kIsGoodITSLayer0123]){
535581
isEventSelected = false;
536582
}
537583

538584
selected = rctChecker(collision);
539585
if (selected) {
540586
selectionBits |= static_cast<uint16_t>(0x1u << evSel_RCTFlagsZDC);
541587
fillCutAnalysis(collision, bunchCrossing, evSel_RCTFlagsZDC);
542-
} else if(cfgSelVec[evSel_RCTFlagsZDC]){
588+
} else if(cfgSelVec.value[evSel_RCTFlagsZDC]){
589+
isEventSelected = false;
590+
}
591+
592+
float vtxz = -999;
593+
if (collision.numContrib() > 1) {
594+
vtxz = collision.posZ();
595+
float zRes = std::sqrt(collision.covZZ());
596+
float minzRes = 0.25;
597+
int maxNumContrib = 20;
598+
if (zRes > minzRes && collision.numContrib() < maxNumContrib)
599+
vtxz = -999;
600+
}
601+
602+
auto multNTracksPV = collision.multNTracksPV();
603+
selected = true;
604+
605+
if (vtxz > cfgVtxZ || vtxz < -cfgVtxZ)
606+
selected = false;
607+
if (multNTracksPV < fMultPVCutLow->Eval(collision.centFT0C()))
608+
selected = false;
609+
if (multNTracksPV > fMultPVCutHigh->Eval(collision.centFT0C()))
610+
selected = false;
611+
if (multTrk < fMultCutLow->Eval(collision.centFT0C()))
612+
selected = false;
613+
if (multTrk > fMultCutHigh->Eval(collision.centFT0C()))
614+
selected = false;
615+
616+
if (selected) {
617+
selectionBits |= static_cast<uint16_t>(0x1u << evSel_MultCut);
618+
fillCutAnalysis(collision, bunchCrossing, evSel_MultCut);
619+
} else if(cfgSelVec.value[evSel_MultCut]){
543620
isEventSelected = false;
544621
}
545622

546623
// Fill for centrality estimators!
547624
fillCutAnalysis(collision, bunchCrossing, nEventSelections);
548-
549625
return selectionBits;
550626
}
551627

@@ -733,7 +809,8 @@ struct ZdcQVectors {
733809

734810
void process(UsedCollisions::iterator const& collision,
735811
BCsRun3 const& /*bcs*/,
736-
aod::Zdcs const& /*zdcs*/)
812+
aod::Zdcs const& /*zdcs*/,
813+
UsedTracks const& tracks)
737814
{
738815
// for Q-vector calculation
739816
// A[0] & C[1]
@@ -834,7 +911,7 @@ struct ZdcQVectors {
834911
// Enable plotting only if event would be selected
835912
bool isEventSelected = true;
836913

837-
uint16_t eventSelectionFlags = eventSelected(collision, foundBC.zdc(), isEventSelected);
914+
uint16_t eventSelectionFlags = eventSelected(collision, foundBC.zdc(), isEventSelected, tracks.size());
838915

839916
// ALWAYS use these event selections
840917
if (cent < EvSel.cfgCentMin || cent > EvSel.cfgCentMax || !collision.sel8() || std::abs(collision.posZ()) > cfgVtxZ) {

0 commit comments

Comments
 (0)