Skip to content

Commit 02b5816

Browse files
authored
[PWGLF] Omegahm: downscaling HBs (pileup study) (#15372)
1 parent 1f98829 commit 02b5816

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed

PWGLF/Tasks/Strangeness/nonPromptCascade.cxx

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
#include "PWGLF/DataModel/LFNonPromptCascadeTables.h"
13+
#include "PWGLF/DataModel/LFStrangenessTables.h"
14+
1215
#include "Common/Core/RecoDecay.h"
1316
#include "Common/Core/Zorro.h"
1417
#include "Common/Core/ZorroSummary.h"
@@ -34,6 +37,8 @@
3437
#include "Framework/O2DatabasePDGPlugin.h"
3538
#include "Framework/runDataProcessing.h"
3639
#include "MathUtils/BetheBlochAleph.h"
40+
#include "ReconstructionDataFormats/DCA.h"
41+
#include "ReconstructionDataFormats/Track.h"
3742
#include "ReconstructionDataFormats/Vertex.h"
3843

3944
#include "Math/Vector4D.h"
@@ -42,16 +47,12 @@
4247
#include "TParticlePDG.h"
4348
#include "TTree.h"
4449

50+
#include <algorithm>
4551
#include <cmath>
52+
#include <map>
4653
#include <memory>
4754
#include <string>
4855
#include <vector>
49-
// #include "PWGHF/Core/PDG.h"
50-
#include "PWGLF/DataModel/LFNonPromptCascadeTables.h"
51-
#include "PWGLF/DataModel/LFStrangenessTables.h"
52-
53-
#include "ReconstructionDataFormats/DCA.h"
54-
#include "ReconstructionDataFormats/Track.h"
5556

5657
using namespace o2;
5758
using namespace o2::framework;
@@ -813,7 +814,7 @@ struct NonPromptCascadeTask {
813814
std::vector<int> mcMult(mcCollisions.size(), 0);
814815
for (auto const& mcp : mcParticles) {
815816
int mcid = mcp.mcCollisionId();
816-
if (mcid < 0 || mcid >= (int)mcMult.size())
817+
if (mcid < 0 || static_cast<size_t>(mcid) >= mcMult.size())
817818
continue;
818819

819820
// apply your primary/eta/charge definition here
@@ -823,7 +824,7 @@ struct NonPromptCascadeTask {
823824
continue;
824825
int q = 0;
825826
if (auto pdg = pdgDB->GetParticle(mcp.pdgCode())) {
826-
q = int(std::round(pdg->Charge() / 3.0));
827+
q = static_cast<int>(std::round(pdg->Charge() / 3.0));
827828
}
828829
if (q == 0)
829830
continue;
@@ -838,14 +839,14 @@ struct NonPromptCascadeTask {
838839
// ------------------------------------------------------------
839840
int maxCollRowId = -1;
840841
for (auto const& trk : tracks) {
841-
maxCollRowId = std::max(maxCollRowId, (int)trk.collisionId());
842+
maxCollRowId = std::max(maxCollRowId, static_cast<int>(trk.collisionId()));
842843
}
843844
std::vector<int> collRowIdToDense(maxCollRowId + 1, -1);
844845

845846
int dense = 0;
846847
for (auto const& col : colls) {
847848
const int collRowId = col.globalIndex(); // row id in aod::Collisions
848-
if (collRowId >= 0 && collRowId < (int)collRowIdToDense.size()) {
849+
if (collRowId >= 0 && static_cast<size_t>(collRowId) < collRowIdToDense.size()) {
849850
collRowIdToDense[collRowId] = dense;
850851
}
851852
++dense;
@@ -860,7 +861,7 @@ struct NonPromptCascadeTask {
860861
continue;
861862
}
862863
const int collRowId = trk.collisionId();
863-
if (collRowId < 0 || collRowId >= (int)collRowIdToDense.size()) {
864+
if (collRowId < 0 || static_cast<size_t>(collRowId) >= collRowIdToDense.size()) {
864865
continue;
865866
}
866867
const int dIdx = collRowIdToDense[collRowId];
@@ -890,7 +891,7 @@ struct NonPromptCascadeTask {
890891

891892
// Map track's collision row id -> dense colls index
892893
const int collRowId = trk.collisionId();
893-
if (collRowId < 0 || collRowId >= (int)collRowIdToDense.size()) {
894+
if (collRowId < 0 || static_cast<size_t>(collRowId) >= collRowIdToDense.size()) {
894895
continue;
895896
}
896897
const int dIdx = collRowIdToDense[collRowId];
@@ -903,14 +904,14 @@ struct NonPromptCascadeTask {
903904

904905
// MC collision id (row index in aod::McCollisions)
905906
const int mcCollId = col.mcCollisionId();
906-
if (mcCollId < 0 || mcCollId >= (int)mcCollisions.size()) {
907+
if (mcCollId < 0 || static_cast<int64_t>(mcCollId) >= mcCollisions.size()) {
907908
continue;
908909
}
909910
mcReconstructed[mcCollId] = 1;
910911

911912
// MC particle id (row index in aod::McParticles)
912913
const int mcPid = trk.mcParticleId();
913-
if (mcPid < 0 || mcPid >= (int)mcParticles.size()) {
914+
if (mcPid < 0 || static_cast<int64_t>(mcPid) >= mcParticles.size()) {
914915
continue;
915916
}
916917

@@ -934,7 +935,7 @@ struct NonPromptCascadeTask {
934935

935936
int q = 0;
936937
if (auto pdgEntry = pdgDB->GetParticle(mcPar.pdgCode())) {
937-
q = int(std::round(pdgEntry->Charge() / 3.0));
938+
q = static_cast<int>(std::round(pdgEntry->Charge() / 3.0));
938939
}
939940
if (q == 0) {
940941
continue;
@@ -954,7 +955,7 @@ struct NonPromptCascadeTask {
954955
// ------------------------------------------------------------
955956
// MC particles with no reco track (iterate by row index)
956957
// ------------------------------------------------------------
957-
for (int pid = 0; pid < (int)mcParticles.size(); ++pid) {
958+
for (int pid = 0; pid < static_cast<int>(mcParticles.size()); ++pid) {
958959
if (!isReco[pid]) {
959960
auto mcp = mcParticles.rawIteratorAt(pid);
960961
mRegistrydNdeta.fill(HIST("hdNdetaRM/hdNdetaRMNotInRecoTrk"), isRecoMult[pid], mcp.pt());
@@ -964,7 +965,7 @@ struct NonPromptCascadeTask {
964965
// ------------------------------------------------------------
965966
// Unreconstructed MC collisions (iterate by row index)
966967
// ------------------------------------------------------------
967-
for (int mcid = 0; mcid < (int)mcCollisions.size(); ++mcid) {
968+
for (int mcid = 0; mcid < static_cast<int>(mcCollisions.size()); ++mcid) {
968969
if (!mcReconstructed[mcid]) {
969970
std::vector<float> mcptvec;
970971
const int mult = mcMult[mcid];
@@ -981,19 +982,29 @@ struct NonPromptCascadeTask {
981982
{
982983
// std::cout << "Processing pile up" << std::endl;
983984
int ds = 1;
985+
uint32_t orbitO = 0;
986+
bool writeFlag = 0;
984987
for (const auto& coll : collisions) {
985-
if (ds == cfgDownscaleMB) {
986-
auto bc = coll.template bc_as<aod::BCsWithTimestamps>();
988+
auto bc = coll.template bc_as<aod::BCsWithTimestamps>();
989+
uint64_t globalBC = bc.globalBC();
990+
uint32_t orbit = globalBC / 3564;
991+
if (orbitO != orbit) {
992+
orbitO = orbit;
993+
if ((ds % cfgDownscaleMB) == 0) {
994+
writeFlag = 1;
995+
} else {
996+
writeFlag = 0;
997+
}
998+
ds++;
999+
}
1000+
if (writeFlag) {
9871001
if (mRunNumber != bc.runNumber()) {
9881002
mRunNumber = bc.runNumber();
9891003
}
9901004
float centFT0M = coll.centFT0M();
9911005
float multFT0M = coll.multFT0M();
992-
uint64_t globalBC = bc.globalBC();
9931006
NPPUTable(mRunNumber, globalBC, coll.numContrib(), coll.multNTracksGlobal(), centFT0M, multFT0M);
994-
ds = 0;
9951007
}
996-
ds++;
9971008
}
9981009
};
9991010
PROCESS_SWITCH(NonPromptCascadeTask, processPileUp, "pile up studies", true);

0 commit comments

Comments
 (0)