Skip to content

Commit b27bfbd

Browse files
authored
[PWGUD] fix efficiency and cuts (#16001)
1 parent 4a28668 commit b27bfbd

1 file changed

Lines changed: 13 additions & 85 deletions

File tree

PWGUD/Tasks/flowCorrelationsUpc.cxx

Lines changed: 13 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -153,28 +153,20 @@ struct FlowCorrelationsUpc {
153153
O2_DEFINE_CONFIGURABLE(cfgCutMerging, float, 0.02, "Merging cut on track merge")
154154
O2_DEFINE_CONFIGURABLE(cfgRadiusLow, float, 0.8, "Low radius for merging cut")
155155
O2_DEFINE_CONFIGURABLE(cfgRadiusHigh, float, 2.5, "High radius for merging cut")
156-
O2_DEFINE_CONFIGURABLE(cfgIsGoodItsLayers, bool, false, "whether choose itslayers")
157156
O2_DEFINE_CONFIGURABLE(cfgDcaxy, bool, true, "choose dcaxy")
158157
O2_DEFINE_CONFIGURABLE(cfgDcaz, bool, false, "choose dcaz")
159158
O2_DEFINE_CONFIGURABLE(cfgDcazCut, float, 10.0, "dcaz cut")
160-
O2_DEFINE_CONFIGURABLE(cfgItsClusterSize, unsigned int, 5, "ITS cluster size")
161159
O2_DEFINE_CONFIGURABLE(cfgMaxTPCChi2NCl, int, 4, "tpcchi2")
162-
O2_DEFINE_CONFIGURABLE(cfgEvSelOccupancy, bool, true, "Occupancy cut")
160+
O2_DEFINE_CONFIGURABLE(cfgCutOccupancy, bool, true, "Occupancy cut")
163161
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 1000, "High cut on TPC occupancy")
164162
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy")
165163
O2_DEFINE_CONFIGURABLE(cfgCutTPCCrossedRows, float, 70.0f, "minimum number of crossed TPC Rows")
166164
O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 50.0f, "minimum number of found TPC clusters")
167165
O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum number of ITS clusters")
168-
O2_DEFINE_CONFIGURABLE(cfgCutTPCChi2NCl, int, 4, "max chi2 per TPC clusters")
169166
O2_DEFINE_CONFIGURABLE(cfgGlobalTrack, bool, true, "require TPC+ITS track")
170167
O2_DEFINE_CONFIGURABLE(cfgUseNchCorrected, bool, true, "use corrected Nch for X axis")
171-
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights")
172-
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins")
173-
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRunbyRun, bool, false, "NUA weights are filled run-by-run")
174168
O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object")
175-
O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object")
176169
O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event")
177-
O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object")
178170

179171
ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"};
180172
ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"};
@@ -203,25 +195,22 @@ struct FlowCorrelationsUpc {
203195
ConfigurableAxis axisNch{"axisNch", {300, 0, 300}, "N_{ch}"};
204196

205197
// Corrections
206-
TH1D* mEfficiency = nullptr;
207-
GFWWeights* mAcceptance = nullptr;
198+
TH3D* mEfficiency = nullptr;
208199
bool correctionsLoaded = false;
209200

210201
// make the filters and cuts.
211202
Filter trackFilter = (aod::udtrack::isPVContributor == true);
212-
Filter collisionFilter = ((aod::udcollision::gapSide == (uint8_t)1 || aod::udcollision::gapSide == (uint8_t)0) && (cfgIfVertex == false || aod::collision::posZ < cfgZVtxCut) && (aod::udcollision::occupancyInTime > 0 && aod::udcollision::occupancyInTime < cfgCutOccupancyHigh) && (aod::flowcorrupc::truegapside == 1 || aod::flowcorrupc::truegapside == 0));
203+
Filter collisionFilter = ((aod::udcollision::gapSide == (uint8_t)1 || aod::udcollision::gapSide == (uint8_t)0) && (cfgIfVertex == false || aod::collision::posZ < cfgZVtxCut) && (!cfgCutOccupancy || (aod::udcollision::occupancyInTime > 0 && aod::udcollision::occupancyInTime < cfgCutOccupancyHigh)) && (aod::flowcorrupc::truegapside == 1 || aod::flowcorrupc::truegapside == 0));
213204

214205
// Connect to ccdb
215206
Service<ccdb::BasicCCDBManager> ccdb;
216207
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
217208

218209
OutputObj<GFWWeights> fWeights{GFWWeights("weights")};
219-
OutputObj<GFWWeights> fWeightsMc{GFWWeights("weightsMC")};
220210

221211
TAxis* fPtAxis = nullptr;
222212
int lastRunNumber = -1;
223-
std::vector<int> runNumbers;
224-
std::map<int, std::shared_ptr<TH3>> th3sPerRun; // map of TH3 histograms for all runs
213+
std::vector<int> runNumbers; // map of TH3 histograms for all runs
225214
std::vector<float> efficiencyCache;
226215

227216
using UdTracks = soa::Filtered<soa::Join<aod::UDTracks, aod::UDTracksExtra, aod::UDTracksPID>>;
@@ -248,9 +237,6 @@ struct FlowCorrelationsUpc {
248237
registry.add("pT", "pT", {HistType::kTH1D, {axisPtTrigger}});
249238
registry.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}});
250239
registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}});
251-
registry.add("Nch_vs_zVtx", "Nch vs zVtx", {HistType::kTH2D, {axisVertex, axisMultiplicity}});
252-
registry.add("Nch_same", "Nch same event", {HistType::kTH1D, {axisMultiplicity}});
253-
registry.add("Nch_mixed", "Nch mixed event", {HistType::kTH1D, {axisMultiplicity}});
254240
registry.add("EtaCorrected", "Eta corrected", {HistType::kTH1D, {axisEta}});
255241
registry.add("pTCorrected", "pT corrected", {HistType::kTH1D, {axisPtTrigger}});
256242

@@ -273,13 +259,6 @@ struct FlowCorrelationsUpc {
273259
double* ptBins = &(axis.binEdges)[0];
274260
fPtAxis = new TAxis(nPtBins, ptBins);
275261

276-
if (cfgOutputNUAWeights) {
277-
fWeights->setPtBins(nPtBins, ptBins);
278-
fWeights->init(true, false);
279-
fWeightsMc->setPtBins(nPtBins, ptBins);
280-
fWeightsMc->init(true, false);
281-
}
282-
283262
std::vector<AxisSpec> corrAxis = {{axisSample, "Sample"},
284263
{axisVertex, "z-vtx (cm)"},
285264
{axisIndependent, "Independent (N_{ch} corrected)"},
@@ -333,6 +312,9 @@ struct FlowCorrelationsUpc {
333312
if (track.pt() < cfgPtCutMin || track.pt() > cfgPtCutMax) {
334313
return false;
335314
}
315+
if (cfgGlobalTrack && !(track.hasITS() && track.hasTPC())) {
316+
return false;
317+
}
336318
// registry.fill(HIST("hTrackCount"), 1.5);
337319
if (cfgDcaz && !(std::fabs(track.dcaZ()) < cfgDcazCut)) {
338320
return false;
@@ -361,28 +343,13 @@ struct FlowCorrelationsUpc {
361343
return true;
362344
}
363345

364-
void createOutputObjectsForRun(int runNumber)
365-
{
366-
const AxisSpec axisPhi{60, 0.0, constants::math::TwoPI, "#varphi"};
367-
std::shared_ptr<TH3> histPhiEtaVtxz = registry.add<TH3>(Form("%d/hPhiEtaVtxz", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, {64, -1.8, 1.8}, {40, -10, 10}}});
368-
th3sPerRun.insert(std::make_pair(runNumber, histPhiEtaVtxz));
369-
}
370-
371346
void loadCorrections(uint64_t timestamp)
372347
{
373348
if (correctionsLoaded) {
374349
return;
375350
}
376-
if (cfgAcceptance.value.empty() == false) {
377-
mAcceptance = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance, timestamp);
378-
if (mAcceptance) {
379-
LOGF(info, "Loaded acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
380-
} else {
381-
LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
382-
}
383-
}
384351
if (cfgEfficiency.value.empty() == false) {
385-
mEfficiency = ccdb->getForTimeStamp<TH1D>(cfgEfficiency, timestamp);
352+
mEfficiency = ccdb->getForTimeStamp<TH3D>(cfgEfficiency, timestamp);
386353
if (mEfficiency == nullptr) {
387354
LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str());
388355
}
@@ -408,7 +375,7 @@ struct FlowCorrelationsUpc {
408375
return true;
409376
}
410377

411-
bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float phi, float eta, float pt, float vtxz)
378+
bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float pt)
412379
{
413380
float eff = 1.;
414381
if (mEfficiency)
@@ -418,17 +385,13 @@ struct FlowCorrelationsUpc {
418385
if (eff == 0)
419386
return false;
420387
weight_nue = 1. / eff;
421-
422-
if (mAcceptance)
423-
weight_nua = mAcceptance->getNUA(phi, eta, vtxz);
424-
else
425-
weight_nua = 1;
388+
weight_nua = 1.; // Set to 1 as NUA weight is not being used
426389
return true;
427390
}
428391

429392
// fill multiple histograms
430393
template <typename TCollision, typename TTracks>
431-
void fillYield(TCollision collision, TTracks tracks, int runNumber, float vtxz) // function to fill the yield and etaphi histograms.
394+
void fillYield(TCollision collision, TTracks tracks, float vtxz) // function to fill the yield and etaphi histograms.
432395
{
433396
registry.fill(HIST("Nch"), tracks.size());
434397
registry.fill(HIST("zVtx"), collision.posZ());
@@ -449,20 +412,6 @@ struct FlowCorrelationsUpc {
449412
registry.fill(HIST("pT"), pt);
450413
registry.fill(HIST("EtaCorrected"), eta, weff);
451414
registry.fill(HIST("pTCorrected"), pt, weff);
452-
453-
if (cfgOutputNUAWeights) {
454-
if (cfgOutputNUAWeightsRefPt) {
455-
if (pt > cfgPtCutMin && pt < cfgPtCutMax) {
456-
fWeights->fill(phi, eta, vtxz, pt, 0., 0);
457-
if (cfgOutputNUAWeightsRunbyRun)
458-
th3sPerRun[runNumber]->Fill(phi, eta, vtxz);
459-
}
460-
} else {
461-
fWeights->fill(phi, eta, vtxz, pt, 0., 0);
462-
if (cfgOutputNUAWeightsRunbyRun)
463-
th3sPerRun[runNumber]->Fill(phi, eta, vtxz);
464-
}
465-
}
466415
}
467416
}
468417

@@ -497,7 +446,7 @@ struct FlowCorrelationsUpc {
497446

498447
// 计算track1的权重
499448
float weff1 = 1., wacc1 = 1.;
500-
if (!setCurrentParticleWeights(weff1, wacc1, phi1, eta1, pt1, vtxz))
449+
if (!setCurrentParticleWeights(weff1, wacc1, pt1))
501450
continue;
502451

503452
if (system == SameEvent) {
@@ -520,24 +469,16 @@ struct FlowCorrelationsUpc {
520469
double phi2 = RecoDecay::phi(momentum);
521470
double eta2 = RecoDecay::eta(momentum);
522471

523-
// 计算track2的权重
524472
float weff2 = 1., wacc2 = 1.;
525473
if (mEfficiency) {
526474
weff2 = efficiencyCache[track2.filteredIndex()];
527475
} else {
528476
getEfficiencyCorrection(weff2, eta2, pt2, vtxz);
529477
}
530478

531-
if (mAcceptance) {
532-
wacc2 = mAcceptance->getNUA(phi2, eta2, vtxz);
533-
} else {
534-
wacc2 = 1;
535-
}
536-
537479
float deltaPhi = RecoDecay::constrainAngle(phi1 - phi2, -PIHalf);
538480
float deltaEta = eta1 - eta2;
539481

540-
// 计算组合权重
541482
float weight = eventWeight * weff1 * weff2 * wacc1 * wacc2;
542483

543484
// Merging cut
@@ -585,19 +526,6 @@ struct FlowCorrelationsUpc {
585526

586527
loadCorrections(runDuration.first);
587528

588-
if (cfgOutputNUAWeightsRunbyRun && currentRunNumber != lastRunNumber) {
589-
lastRunNumber = currentRunNumber;
590-
if (std::find(runNumbers.begin(), runNumbers.end(), currentRunNumber) == runNumbers.end()) {
591-
createOutputObjectsForRun(currentRunNumber);
592-
runNumbers.push_back(currentRunNumber);
593-
}
594-
595-
if (th3sPerRun.find(currentRunNumber) == th3sPerRun.end()) {
596-
LOGF(fatal, "RunNumber %d not found in th3sPerRun", currentRunNumber);
597-
return;
598-
}
599-
}
600-
601529
registry.fill(HIST("eventcont"), 3.5);
602530

603531
//-----------independent---------------
@@ -628,7 +556,7 @@ struct FlowCorrelationsUpc {
628556
independent = nTracksCorrected;
629557
}
630558

631-
fillYield(collision, tracks, currentRunNumber, vtxz);
559+
fillYield(collision, tracks, vtxz);
632560

633561
fillCorrelations<CorrelationContainer::kCFStepReconstructed>(
634562
tracks, tracks, collision.posZ(), SameEvent,

0 commit comments

Comments
 (0)