Skip to content

Commit d050eed

Browse files
authored
[PWGCF] Bug fix in FT0 gain equalization (#15928)
1 parent ed36b44 commit d050eed

2 files changed

Lines changed: 36 additions & 32 deletions

File tree

PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ struct LongrangeMaker {
142142
Configurable<float> cfigFt0aEtaMin{"cfigFt0aEtaMin", 3.5f, "Minimum FT0A eta cut"};
143143
Configurable<float> cfigFt0cEtaMax{"cfigFt0cEtaMax", -2.1f, "Maximum FT0C eta cut"};
144144
Configurable<float> cfigFt0cEtaMin{"cfigFt0cEtaMin", -3.3f, "Minimum FT0C eta cut"};
145-
Configurable<bool> useGainCallib{"useGainCallib", true, "use gain calibration"};
145+
Configurable<int> cfigVerbosity{"cfigVerbosity", 0, "print statement"};
146+
Configurable<bool> useGainCalib{"useGainCalib", true, "use gain calibration"};
146147
Configurable<std::string> ConfGainPath{"ConfGainPath", "Analysis/EventPlane/GainEq/FT0", "Path to gain calibration"};
147148
} cfgfittrksel;
148149

@@ -306,8 +307,6 @@ struct LongrangeMaker {
306307
using MftTrkTable = aod::MFTTracks;
307308
using BCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
308309

309-
int currentRunNumber = -999;
310-
int lastRunNumber = -999;
311310
std::vector<float> ft0gainvalues{};
312311
void processData(CollTable::iterator const& col, TrksTable const& tracks,
313312
aod::FT0s const&, MftTrkTable const& mfttracks,
@@ -320,16 +319,21 @@ struct LongrangeMaker {
320319
auto multiplicity = countNTracks(tracks);
321320
auto centrality = selColCent(col);
322321
auto bc = col.bc_as<aod::BCsWithTimestamps>();
323-
currentRunNumber = bc.runNumber();
324-
if (cfgfittrksel.useGainCallib && (currentRunNumber != lastRunNumber)) {
325-
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.ConfGainPath.value, bc.timestamp());
322+
ft0gainvalues.clear();
323+
ft0gainvalues = {};
324+
if (cfgfittrksel.useGainCalib) {
325+
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.ConfGainPath, bc.timestamp());
326326
if (!ft0GainObj) {
327327
for (auto i{0u}; i < TotFt0Channels; i++) {
328328
ft0gainvalues.push_back(1.);
329329
}
330330
} else {
331331
ft0gainvalues = *(ft0GainObj);
332332
}
333+
} else {
334+
for (auto i{0u}; i < TotFt0Channels; i++) {
335+
ft0gainvalues.push_back(1.);
336+
}
333337
}
334338
lrcollision(bc.runNumber(), col.posZ(), multiplicity, centrality, bc.timestamp());
335339

@@ -354,9 +358,9 @@ struct LongrangeMaker {
354358
float ampl = ft0.amplitudeA()[iCh];
355359
auto phi = getPhiFT0(chanelid, 0);
356360
auto eta = getEtaFT0(chanelid, 0);
357-
auto gainampl = 1.0;
358-
if (cfgfittrksel.useGainCallib) {
359-
gainampl = ampl / ft0gainvalues[chanelid];
361+
auto gainampl = ampl / ft0gainvalues[chanelid];
362+
if (cfgfittrksel.cfigVerbosity > 0) {
363+
LOGF(info, "FT0A info: Channel = %d | indexchannel = %d | %f | %f", chanelid, iCh, ft0gainvalues[chanelid], ft0gainvalues[iCh]);
360364
}
361365
lrft0atracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
362366
}
@@ -365,9 +369,9 @@ struct LongrangeMaker {
365369
float ampl = ft0.amplitudeC()[iCh];
366370
auto phi = getPhiFT0(chanelid, 1);
367371
auto eta = getEtaFT0(chanelid, 1);
368-
auto gainampl = 1.0;
369-
if (cfgfittrksel.useGainCallib) {
370-
gainampl = ampl / ft0gainvalues[chanelid];
372+
auto gainampl = ampl / ft0gainvalues[chanelid];
373+
if (cfgfittrksel.cfigVerbosity > 0) {
374+
LOGF(info, "FT0C info: Channel = %d | indexchannel = %d | %f | %f", chanelid, iCh, ft0gainvalues[chanelid], ft0gainvalues[iCh]);
371375
}
372376
lrft0ctracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
373377
}
@@ -427,7 +431,6 @@ struct LongrangeMaker {
427431
v0.pt(), v0.eta(), v0.phi(), massV0, aod::lrcorrtrktable::kSpALambda);
428432
} // end of Lambda and Anti-Lambda processing
429433
}
430-
lastRunNumber = currentRunNumber;
431434
} // process function
432435

433436
void processUpc(CollTable::iterator const& col, BCs const& bcs,
@@ -591,16 +594,21 @@ struct LongrangeMaker {
591594
auto multiplicity = countNTracks(recTracksPart);
592595
auto centrality = selColCent(RecCol);
593596
auto bc = RecCol.bc_as<aod::BCsWithTimestamps>();
594-
currentRunNumber = bc.runNumber();
595-
if (cfgfittrksel.useGainCallib && (currentRunNumber != lastRunNumber)) {
596-
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.ConfGainPath.value, bc.timestamp());
597+
ft0gainvalues.clear();
598+
ft0gainvalues = {};
599+
if (cfgfittrksel.useGainCalib) {
600+
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.ConfGainPath, bc.timestamp());
597601
if (!ft0GainObj) {
598602
for (auto i{0u}; i < TotFt0Channels; i++) {
599603
ft0gainvalues.push_back(1.);
600604
}
601605
} else {
602606
ft0gainvalues = *(ft0GainObj);
603607
}
608+
} else {
609+
for (auto i{0u}; i < TotFt0Channels; i++) {
610+
ft0gainvalues.push_back(1.);
611+
}
604612
}
605613
lrcollision(bc.runNumber(), RecCol.posZ(), multiplicity, centrality, bc.timestamp());
606614
lrcollisionMcLabel(RecCol.mcCollisionId());
@@ -631,21 +639,15 @@ struct LongrangeMaker {
631639
float ampl = ft0.amplitudeA()[iCh];
632640
auto phi = getPhiFT0(chanelid, 0);
633641
auto eta = getEtaFT0(chanelid, 0);
634-
auto gainampl = 1.0;
635-
if (cfgfittrksel.useGainCallib) {
636-
gainampl = ampl / ft0gainvalues[chanelid];
637-
}
642+
auto gainampl = ampl / ft0gainvalues[chanelid];
638643
lrft0atracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
639644
}
640645
for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) {
641646
auto chanelid = ft0.channelC()[iCh] + KminFt0cCell;
642647
float ampl = ft0.amplitudeC()[iCh];
643648
auto phi = getPhiFT0(chanelid, 1);
644649
auto eta = getEtaFT0(chanelid, 1);
645-
auto gainampl = 1.0;
646-
if (cfgfittrksel.useGainCallib) {
647-
gainampl = ampl / ft0gainvalues[chanelid];
648-
}
650+
auto gainampl = ampl / ft0gainvalues[chanelid];
649651
lrft0ctracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
650652
}
651653
}
@@ -696,7 +698,6 @@ struct LongrangeMaker {
696698
if (cfgmfttrksel.cfigMftEtaMin < particle.eta() && particle.eta() < cfgmfttrksel.cfigMftEtaMax)
697699
lrmftmctracks(lrmccollision.lastIndex(), particle.pt(), particle.eta(), particle.phi());
698700
}
699-
lastRunNumber = currentRunNumber;
700701
}
701702
}
702703

PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,20 @@ struct LongrangecorrDerived {
259259
template <CorrelationContainer::CFStep step, typename TTarget, typename TTriggers, typename TAssocs>
260260
void fillCorrHist(TTarget target, TTriggers const& triggers, TAssocs const& assocs, bool mixing, float vz, float multiplicity, float eventWeight)
261261
{
262-
auto trigAmpl = 1.0f;
263262
for (auto const& triggerTrack : triggers) {
263+
auto trigAmpl = 1.0f;
264+
if constexpr (std::experimental::is_detected<HasFt0, typename TTriggers::iterator>::value) {
265+
trigAmpl = triggerTrack.gainAmplitude();
266+
} else {
267+
trigAmpl = 1.0;
268+
}
264269
if constexpr (std::experimental::is_detected<HasTpcTrack, typename TTriggers::iterator>::value) {
265270
if (cfgPidMask != 0 && (cfgPidMask & (1u << static_cast<uint32_t>(triggerTrack.trackType()))) == 0u)
266271
continue;
267272
} else if constexpr (std::experimental::is_detected<HasV0Track, typename TTriggers::iterator>::value) {
268273
if (cfgV0Mask != 0 && (cfgV0Mask & (1u << static_cast<uint32_t>(triggerTrack.v0Type()))) == 0u)
269274
continue;
270275
}
271-
if constexpr (std::experimental::is_detected<HasFt0, typename TTriggers::iterator>::value) {
272-
trigAmpl *= triggerTrack.gainAmplitude();
273-
}
274276
if (!mixing) {
275277
fillTrigTrackQA(triggerTrack);
276278
if constexpr (std::experimental::is_detected<HasFt0, typename TTriggers::iterator>::value) {
@@ -281,10 +283,12 @@ struct LongrangecorrDerived {
281283
histos.fill(HIST("Trig_hist"), vz, multiplicity, triggerTrack.pt(), 1.0, eventWeight * trigAmpl);
282284
}
283285
}
284-
auto assoAmpl = 1.0f;
285286
for (auto const& assoTrack : assocs) {
287+
auto assoAmpl = 1.0f;
286288
if constexpr (std::experimental::is_detected<HasFt0, typename TAssocs::iterator>::value) {
287-
assoAmpl *= assoTrack.gainAmplitude();
289+
assoAmpl = assoTrack.gainAmplitude();
290+
} else {
291+
assoAmpl = 1.0f;
288292
}
289293
float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - assoTrack.phi(), -PIHalf);
290294
float deltaEta = triggerTrack.eta() - assoTrack.eta();
@@ -294,7 +298,6 @@ struct LongrangecorrDerived {
294298
} else {
295299
histos.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * trigAmpl * assoAmpl);
296300
}
297-
298301
if constexpr (std::experimental::is_detected<HasFt0, typename TTriggers::iterator>::value) {
299302
target->getPairHist()->Fill(step, vz, multiplicity, 1.0, 1.0, deltaPhi, deltaEta, 1.0, eventWeight * trigAmpl * assoAmpl);
300303
} else if constexpr (std::experimental::is_detected<HasInvMass, typename TTriggers::iterator>::value) {

0 commit comments

Comments
 (0)