Skip to content

Commit 646fe1f

Browse files
authored
Update longrangeMaker.cxx
1 parent 2324799 commit 646fe1f

1 file changed

Lines changed: 52 additions & 8 deletions

File tree

PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ using namespace o2::constants::math;
7575

7676
auto static constexpr CintZero = 0;
7777
auto static constexpr KminFt0cCell = 96;
78+
auto static constexpr TotFt0Channels = 208;
7879
AxisSpec axisEvent{15, 0.5, 15.5, "#Event", "EventAxis"};
7980
auto static constexpr KminCharge = 3.0f;
8081
static constexpr std::string_view species[] = {"Pi", "Ka", "Pr", "K0s", "L0s"};
@@ -141,6 +142,8 @@ struct LongrangeMaker {
141142
Configurable<float> cfigFt0aEtaMin{"cfigFt0aEtaMin", 3.5f, "Minimum FT0A eta cut"};
142143
Configurable<float> cfigFt0cEtaMax{"cfigFt0cEtaMax", -2.1f, "Maximum FT0C eta cut"};
143144
Configurable<float> cfigFt0cEtaMin{"cfigFt0cEtaMin", -3.3f, "Minimum FT0C eta cut"};
145+
Configurable<bool> useGainCallib{"useGainCallib", true, "use gain calibration"};
146+
Configurable<std::string> ConfGainPath{"ConfGainPath", "Analysis/EventPlane/GainEq/FT0", "Path to gain calibration"};
144147
} cfgfittrksel;
145148

146149
struct : ConfigurableGroup {
@@ -303,6 +306,9 @@ struct LongrangeMaker {
303306
using MftTrkTable = aod::MFTTracks;
304307
using BCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
305308

309+
int currentRunNumber = -999;
310+
int lastRunNumber = -999;
311+
std::vector<float> ft0gainvalues{};
306312
void processData(CollTable::iterator const& col, TrksTable const& tracks,
307313
aod::FT0s const&, MftTrkTable const& mfttracks,
308314
soa::SmallGroups<aod::BestCollisionsFwd3d> const& besttracks,
@@ -311,11 +317,20 @@ struct LongrangeMaker {
311317
if (!isEventSelected(col)) {
312318
return;
313319
}
314-
315320
auto multiplicity = countNTracks(tracks);
316321
auto centrality = selColCent(col);
317322
auto bc = col.bc_as<aod::BCsWithTimestamps>();
318-
323+
currentRunNumber = bc.runNumber();
324+
if (cfgfittrksel.useGainCallib && (currentRunNumber != lastRunNumber)) {
325+
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.ConfGainPath.value, bc.timestamp());
326+
if (!ft0GainObj) {
327+
for (auto i{0u}; i < TotFt0Channels; i++) {
328+
ft0gainvalues.push_back(1.);
329+
}
330+
} else {
331+
ft0gainvalues = *(ft0GainObj);
332+
}
333+
}
319334
lrcollision(bc.runNumber(), col.posZ(), multiplicity, centrality, bc.timestamp());
320335

321336
// track loop
@@ -339,14 +354,22 @@ struct LongrangeMaker {
339354
float ampl = ft0.amplitudeA()[iCh];
340355
auto phi = getPhiFT0(chanelid, 0);
341356
auto eta = getEtaFT0(chanelid, 0);
342-
lrft0atracks(lrcollision.lastIndex(), chanelid, ampl, eta, phi);
357+
auto gainampl = 1.0;
358+
if (cfgfittrksel.useGainCallib) {
359+
gainampl = ampl / ft0gainvalues[chanelid];
360+
}
361+
lrft0atracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
343362
}
344363
for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) {
345364
auto chanelid = ft0.channelC()[iCh] + KminFt0cCell;
346365
float ampl = ft0.amplitudeC()[iCh];
347366
auto phi = getPhiFT0(chanelid, 1);
348367
auto eta = getEtaFT0(chanelid, 1);
349-
lrft0ctracks(lrcollision.lastIndex(), chanelid, ampl, eta, phi);
368+
auto gainampl = 1.0;
369+
if (cfgfittrksel.useGainCallib) {
370+
gainampl = ampl / ft0gainvalues[chanelid];
371+
}
372+
lrft0ctracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
350373
}
351374
}
352375

@@ -404,6 +427,7 @@ struct LongrangeMaker {
404427
v0.pt(), v0.eta(), v0.phi(), massV0, aod::lrcorrtrktable::kSpALambda);
405428
} // end of Lambda and Anti-Lambda processing
406429
}
430+
lastRunNumber = currentRunNumber;
407431
} // process function
408432

409433
void processUpc(CollTable::iterator const& col, BCs const& bcs,
@@ -468,14 +492,14 @@ struct LongrangeMaker {
468492
float ampl = ft0.amplitudeA()[iCh];
469493
auto phi = getPhiFT0(chanelid, 0);
470494
auto eta = getEtaFT0(chanelid, 0);
471-
upclrft0atracks(upclrcollision.lastIndex(), chanelid, ampl, eta, phi);
495+
upclrft0atracks(upclrcollision.lastIndex(), chanelid, ampl, ampl, eta, phi);
472496
}
473497
for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) {
474498
auto chanelid = ft0.channelC()[iCh] + KminFt0cCell;
475499
float ampl = ft0.amplitudeC()[iCh];
476500
auto phi = getPhiFT0(chanelid, 1);
477501
auto eta = getEtaFT0(chanelid, 1);
478-
upclrft0ctracks(upclrcollision.lastIndex(), chanelid, ampl, eta, phi);
502+
upclrft0ctracks(upclrcollision.lastIndex(), chanelid, ampl, ampl, eta, phi);
479503
}
480504
}
481505

@@ -567,6 +591,17 @@ struct LongrangeMaker {
567591
auto multiplicity = countNTracks(recTracksPart);
568592
auto centrality = selColCent(RecCol);
569593
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+
if (!ft0GainObj) {
598+
for (auto i{0u}; i < TotFt0Channels; i++) {
599+
ft0gainvalues.push_back(1.);
600+
}
601+
} else {
602+
ft0gainvalues = *(ft0GainObj);
603+
}
604+
}
570605
lrcollision(bc.runNumber(), RecCol.posZ(), multiplicity, centrality, bc.timestamp());
571606
lrcollisionMcLabel(RecCol.mcCollisionId());
572607

@@ -596,14 +631,22 @@ struct LongrangeMaker {
596631
float ampl = ft0.amplitudeA()[iCh];
597632
auto phi = getPhiFT0(chanelid, 0);
598633
auto eta = getEtaFT0(chanelid, 0);
599-
lrft0atracks(lrcollision.lastIndex(), chanelid, ampl, eta, phi);
634+
auto gainampl = 1.0;
635+
if (cfgfittrksel.useGainCallib) {
636+
gainampl = ampl / ft0gainvalues[chanelid];
637+
}
638+
lrft0atracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
600639
}
601640
for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) {
602641
auto chanelid = ft0.channelC()[iCh] + KminFt0cCell;
603642
float ampl = ft0.amplitudeC()[iCh];
604643
auto phi = getPhiFT0(chanelid, 1);
605644
auto eta = getEtaFT0(chanelid, 1);
606-
lrft0ctracks(lrcollision.lastIndex(), chanelid, ampl, eta, phi);
645+
auto gainampl = 1.0;
646+
if (cfgfittrksel.useGainCallib) {
647+
gainampl = ampl / ft0gainvalues[chanelid];
648+
}
649+
lrft0ctracks(lrcollision.lastIndex(), chanelid, ampl, gainampl, eta, phi);
607650
}
608651
}
609652

@@ -653,6 +696,7 @@ struct LongrangeMaker {
653696
if (cfgmfttrksel.cfigMftEtaMin < particle.eta() && particle.eta() < cfgmfttrksel.cfigMftEtaMax)
654697
lrmftmctracks(lrmccollision.lastIndex(), particle.pt(), particle.eta(), particle.phi());
655698
}
699+
lastRunNumber = currentRunNumber;
656700
}
657701
}
658702

0 commit comments

Comments
 (0)