Skip to content

Commit fc1ff0a

Browse files
authored
[PWGEM/Dilepton] add BC info (#10832)
1 parent 5c53903 commit fc1ff0a

File tree

10 files changed

+284
-153
lines changed

10 files changed

+284
-153
lines changed

PWGEM/Dilepton/Core/Dilepton.h

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ struct Dilepton {
317317
if (ConfVtxBins.value[0] == VARIABLE_WIDTH) {
318318
zvtx_bin_edges = std::vector<float>(ConfVtxBins.value.begin(), ConfVtxBins.value.end());
319319
zvtx_bin_edges.erase(zvtx_bin_edges.begin());
320-
for (auto& edge : zvtx_bin_edges) {
320+
for (const auto& edge : zvtx_bin_edges) {
321321
LOGF(info, "VARIABLE_WIDTH: zvtx_bin_edges = %f", edge);
322322
}
323323
} else {
@@ -334,7 +334,7 @@ struct Dilepton {
334334
if (ConfCentBins.value[0] == VARIABLE_WIDTH) {
335335
cent_bin_edges = std::vector<float>(ConfCentBins.value.begin(), ConfCentBins.value.end());
336336
cent_bin_edges.erase(cent_bin_edges.begin());
337-
for (auto& edge : cent_bin_edges) {
337+
for (const auto& edge : cent_bin_edges) {
338338
LOGF(info, "VARIABLE_WIDTH: cent_bin_edges = %f", edge);
339339
}
340340
} else {
@@ -351,7 +351,7 @@ struct Dilepton {
351351
if (ConfEPBins.value[0] == VARIABLE_WIDTH) {
352352
ep_bin_edges = std::vector<float>(ConfEPBins.value.begin(), ConfEPBins.value.end());
353353
ep_bin_edges.erase(ep_bin_edges.begin());
354-
for (auto& edge : ep_bin_edges) {
354+
for (const auto& edge : ep_bin_edges) {
355355
LOGF(info, "VARIABLE_WIDTH: ep_bin_edges = %f", edge);
356356
}
357357
} else {
@@ -369,7 +369,7 @@ struct Dilepton {
369369
if (ConfOccupancyBins.value[0] == VARIABLE_WIDTH) {
370370
occ_bin_edges = std::vector<float>(ConfOccupancyBins.value.begin(), ConfOccupancyBins.value.end());
371371
occ_bin_edges.erase(occ_bin_edges.begin());
372-
for (auto& edge : occ_bin_edges) {
372+
for (const auto& edge : occ_bin_edges) {
373373
LOGF(info, "VARIABLE_WIDTH: occ_bin_edges = %f", edge);
374374
}
375375
} else {
@@ -406,6 +406,13 @@ struct Dilepton {
406406
if (doprocessTriggerAnalysis) {
407407
fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true);
408408
}
409+
if (doprocessBC) {
410+
auto hTVXCounter = fRegistry.add<TH1>("BC/hTVXCounter", "TVX counter", kTH1D, {{4, -0.5f, 3.5f}});
411+
hTVXCounter->GetXaxis()->SetBinLabel(1, "TVX");
412+
hTVXCounter->GetXaxis()->SetBinLabel(2, "TVX && NoTFB");
413+
hTVXCounter->GetXaxis()->SetBinLabel(3, "TVX && NoITSROFB");
414+
hTVXCounter->GetXaxis()->SetBinLabel(4, "TVX && NoTFB && NoITSROFB");
415+
}
409416
}
410417

411418
template <bool isTriggerAnalysis, typename TCollision>
@@ -737,7 +744,7 @@ struct Dilepton {
737744
bool isGoodQvector(TQvectors const& qvectors)
738745
{
739746
bool is_good = true;
740-
for (auto& qn : qvectors[nmod]) {
747+
for (const auto& qn : qvectors[nmod]) {
741748
if (std::fabs(qn[0]) > 20.f || std::fabs(qn[1]) > 20.f) {
742749
is_good = false;
743750
break;
@@ -1122,7 +1129,7 @@ struct Dilepton {
11221129
template <bool isTriggerAnalysis, typename TCollisions, typename TLeptons, typename TPresilce, typename TCut, typename TAllTracks>
11231130
void runPairing(TCollisions const& collisions, TLeptons const& posTracks, TLeptons const& negTracks, TPresilce const& perCollision, TCut const& cut, TAllTracks const& tracks)
11241131
{
1125-
for (auto& collision : collisions) {
1132+
for (const auto& collision : collisions) {
11261133
initCCDB<isTriggerAnalysis>(collision);
11271134
const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()};
11281135
float centrality = centralities[cfgCentEstimator];
@@ -1196,19 +1203,19 @@ struct Dilepton {
11961203
// LOGF(info, "collision.globalIndex() = %d , collision.posZ() = %f , collision.numContrib() = %d, centrality = %f , posTracks_per_coll.size() = %d, negTracks_per_coll.size() = %d", collision.globalIndex(), collision.posZ(), collision.numContrib(), centralities[cfgCentEstimator], posTracks_per_coll.size(), negTracks_per_coll.size());
11971204

11981205
int nuls = 0, nlspp = 0, nlsmm = 0;
1199-
for (auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS
1206+
for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS
12001207
bool is_pair_ok = fillPairInfo<0>(collision, pos, neg, cut, tracks);
12011208
if (is_pair_ok) {
12021209
nuls++;
12031210
}
12041211
}
1205-
for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++
1212+
for (const auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++
12061213
bool is_pair_ok = fillPairInfo<0>(collision, pos1, pos2, cut, tracks);
12071214
if (is_pair_ok) {
12081215
nlspp++;
12091216
}
12101217
}
1211-
for (auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS--
1218+
for (const auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS--
12121219
bool is_pair_ok = fillPairInfo<0>(collision, neg1, neg2, cut, tracks);
12131220
if (is_pair_ok) {
12141221
nlsmm++;
@@ -1269,7 +1276,7 @@ struct Dilepton {
12691276
auto collisionIds_in_mixing_pool = emh_pos->GetCollisionIdsFromEventPool(key_bin); // pos/neg does not matter.
12701277
// LOGF(info, "collisionIds_in_mixing_pool.size() = %d", collisionIds_in_mixing_pool.size());
12711278

1272-
for (auto& mix_dfId_collisionId : collisionIds_in_mixing_pool) {
1279+
for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool) {
12731280
int mix_dfId = mix_dfId_collisionId.first;
12741281
int mix_collisionId = mix_dfId_collisionId.second;
12751282
if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection.
@@ -1287,26 +1294,26 @@ struct Dilepton {
12871294
auto negTracks_from_event_pool = emh_neg->GetTracksPerCollision(mix_dfId_collisionId);
12881295
// LOGF(info, "Do event mixing: current event (%d, %d) | event pool (%d, %d), npos = %d , nneg = %d", ndf, collision.globalIndex(), mix_dfId, mix_collisionId, posTracks_from_event_pool.size(), negTracks_from_event_pool.size());
12891296

1290-
for (auto& pos : selected_posTracks_in_this_event) { // ULS mix
1291-
for (auto& neg : negTracks_from_event_pool) {
1297+
for (const auto& pos : selected_posTracks_in_this_event) { // ULS mix
1298+
for (const auto& neg : negTracks_from_event_pool) {
12921299
fillPairInfo<1>(collision, pos, neg, cut, tracks);
12931300
}
12941301
}
12951302

1296-
for (auto& neg : selected_negTracks_in_this_event) { // ULS mix
1297-
for (auto& pos : posTracks_from_event_pool) {
1303+
for (const auto& neg : selected_negTracks_in_this_event) { // ULS mix
1304+
for (const auto& pos : posTracks_from_event_pool) {
12981305
fillPairInfo<1>(collision, neg, pos, cut, tracks);
12991306
}
13001307
}
13011308

1302-
for (auto& pos1 : selected_posTracks_in_this_event) { // LS++ mix
1303-
for (auto& pos2 : posTracks_from_event_pool) {
1309+
for (const auto& pos1 : selected_posTracks_in_this_event) { // LS++ mix
1310+
for (const auto& pos2 : posTracks_from_event_pool) {
13041311
fillPairInfo<1>(collision, pos1, pos2, cut, tracks);
13051312
}
13061313
}
13071314

1308-
for (auto& neg1 : selected_negTracks_in_this_event) { // LS-- mix
1309-
for (auto& neg2 : negTracks_from_event_pool) {
1315+
for (const auto& neg1 : selected_negTracks_in_this_event) { // LS-- mix
1316+
for (const auto& neg2 : negTracks_from_event_pool) {
13101317
fillPairInfo<1>(collision, neg1, neg2, cut, tracks);
13111318
}
13121319
}
@@ -1367,7 +1374,7 @@ struct Dilepton {
13671374
std::vector<std::pair<int, int>> passed_pairIds;
13681375
passed_pairIds.reserve(posTracks.size() * negTracks.size());
13691376

1370-
for (auto& collision : collisions) {
1377+
for (const auto& collision : collisions) {
13711378
initCCDB<isTriggerAnalysis>(collision);
13721379
const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()};
13731380
if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) {
@@ -1411,32 +1418,32 @@ struct Dilepton {
14111418
auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache);
14121419
auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache);
14131420

1414-
for (auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS
1421+
for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS
14151422
if (isPairOK(collision, pos, neg, cut, tracks)) {
14161423
passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), neg.globalIndex()));
14171424
}
14181425
}
1419-
for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++
1426+
for (const auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++
14201427
if (isPairOK(collision, pos1, pos2, cut, tracks)) {
14211428
passed_pairIds.emplace_back(std::make_pair(pos1.globalIndex(), pos2.globalIndex()));
14221429
}
14231430
}
1424-
for (auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS--
1431+
for (const auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS--
14251432
if (isPairOK(collision, neg1, neg2, cut, tracks)) {
14261433
passed_pairIds.emplace_back(std::make_pair(neg1.globalIndex(), neg2.globalIndex()));
14271434
}
14281435
}
14291436
} // end of collision loop
14301437

14311438
if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) {
1432-
for (auto& pairId : passed_pairIds) {
1439+
for (const auto& pairId : passed_pairIds) {
14331440
auto t1 = tracks.rawIteratorAt(std::get<0>(pairId));
14341441
auto t2 = tracks.rawIteratorAt(std::get<1>(pairId));
14351442
// LOGF(info, "std::get<0>(pairId) = %d, std::get<1>(pairId) = %d, t1.globalIndex() = %d, t2.globalIndex() = %d", std::get<0>(pairId), std::get<1>(pairId), t1.globalIndex(), t2.globalIndex());
14361443

14371444
float n = 1.f; // include myself.
1438-
for (auto& ambId1 : t1.ambiguousElectronsIds()) {
1439-
for (auto& ambId2 : t2.ambiguousElectronsIds()) {
1445+
for (const auto& ambId1 : t1.ambiguousElectronsIds()) {
1446+
for (const auto& ambId2 : t2.ambiguousElectronsIds()) {
14401447
if (std::find(passed_pairIds.begin(), passed_pairIds.end(), std::make_pair(ambId1, ambId2)) != passed_pairIds.end()) {
14411448
n += 1.f;
14421449
}
@@ -1445,13 +1452,13 @@ struct Dilepton {
14451452
map_weight[pairId] = 1.f / n;
14461453
} // end of passed_pairIds loop
14471454
} else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) {
1448-
for (auto& pairId : passed_pairIds) {
1455+
for (const auto& pairId : passed_pairIds) {
14491456
auto t1 = tracks.rawIteratorAt(std::get<0>(pairId));
14501457
auto t2 = tracks.rawIteratorAt(std::get<1>(pairId));
14511458

14521459
float n = 1.f; // include myself.
1453-
for (auto& ambId1 : t1.ambiguousMuonsIds()) {
1454-
for (auto& ambId2 : t2.ambiguousMuonsIds()) {
1460+
for (const auto& ambId1 : t1.ambiguousMuonsIds()) {
1461+
for (const auto& ambId2 : t2.ambiguousMuonsIds()) {
14551462
if (std::find(passed_pairIds.begin(), passed_pairIds.end(), std::make_pair(ambId1, ambId2)) != passed_pairIds.end()) {
14561463
n += 1.f;
14571464
}
@@ -1510,7 +1517,7 @@ struct Dilepton {
15101517

15111518
void processNorm(FilteredNormInfos const& collisions)
15121519
{
1513-
for (auto& collision : collisions) {
1520+
for (const auto& collision : collisions) {
15141521
if (collision.centFT0C() < cfgCentMin || cfgCentMax < collision.centFT0C()) {
15151522
continue;
15161523
}
@@ -1578,6 +1585,25 @@ struct Dilepton {
15781585
}
15791586
PROCESS_SWITCH(Dilepton, processNorm, "process normalization info", false);
15801587

1588+
void processBC(aod::EMBCs const& bcs)
1589+
{
1590+
for (const auto& bc : bcs) {
1591+
if (bc.isTriggerTVX()) {
1592+
fRegistry.fill(HIST("BC/hTVXCounter"), 0.f);
1593+
if (bc.isNoTimeFrameBorder()) {
1594+
fRegistry.fill(HIST("BC/hTVXCounter"), 1.f);
1595+
}
1596+
if (bc.isNoITSROFrameBorder()) {
1597+
fRegistry.fill(HIST("BC/hTVXCounter"), 2.f);
1598+
}
1599+
if (bc.isNoTimeFrameBorder() && bc.isNoITSROFrameBorder()) {
1600+
fRegistry.fill(HIST("BC/hTVXCounter"), 3.f);
1601+
}
1602+
}
1603+
}
1604+
}
1605+
PROCESS_SWITCH(Dilepton, processBC, "process BC counter", false);
1606+
15811607
void processDummy(MyCollisions const&) {}
15821608
PROCESS_SWITCH(Dilepton, processDummy, "Dummy function", false);
15831609
};

0 commit comments

Comments
 (0)