Skip to content

Commit e6062f3

Browse files
committed
UUU
1 parent fceb562 commit e6062f3

File tree

1 file changed

+40
-66
lines changed

1 file changed

+40
-66
lines changed

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 40 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ struct OnTheFlyTracker {
180180
// V0 names for filling histograms
181181
static constexpr int NtypesV0 = 3;
182182
static constexpr std::string_view NameV0s[NtypesV0] = {"K0", "Lambda", "AntiLambda"};
183-
static constexpr int NtypesDetectors = 4;
184-
static constexpr std::string_view NameDetectors[NtypesDetectors] = {"0", "1", "2", "3"};
185183

186184
// Class to hold the track information for the O2 vertexing
187185
class TrackAlice3 : public o2::track::TrackParCov
@@ -285,20 +283,20 @@ struct OnTheFlyTracker {
285283
TRandom3 rand;
286284
Service<o2::ccdb::BasicCCDBManager> ccdb;
287285

286+
o2::fastsim::GeometryContainer mGeoContainer;
288287
void init(o2::framework::InitContext& initContext)
289288
{
290289
ccdb->setURL("http://alice-ccdb.cern.ch");
291290
ccdb->setTimestamp(-1);
292-
o2::fastsim::GeometryContainer geoContainer;
293-
geoContainer.init(initContext);
291+
mGeoContainer.init(initContext);
294292

295-
const int nGeometries = geoContainer.getNumberOfConfigurations();
293+
const int nGeometries = mGeoContainer.getNumberOfConfigurations();
296294
for (int icfg = 0; icfg < nGeometries; ++icfg) {
297295
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
298296
mSmearer.emplace_back(std::make_unique<o2::delphes::DelphesO2TrackSmearer>());
299297
mSmearer[icfg]->setCcdbManager(ccdb.operator->());
300298
if (enablePrimarySmearing) {
301-
std::map<std::string, std::string> geoEntry = geoContainer.getConfiguration(icfg, "global");
299+
std::map<std::string, std::string> geoEntry = mGeoContainer.getConfiguration(icfg, "global");
302300
// load LUTs for primaries
303301
for (const auto& entry : geoEntry) {
304302
int pdg = 0;
@@ -376,7 +374,7 @@ struct OnTheFlyTracker {
376374
fastTracker[icfg]->SetApplyZacceptance(fastTrackerSettings.applyZacceptance);
377375
fastTracker[icfg]->SetApplyMSCorrection(fastTrackerSettings.applyMSCorrection);
378376
fastTracker[icfg]->SetApplyElossCorrection(fastTrackerSettings.applyElossCorrection);
379-
fastTracker[icfg]->AddGenericDetector(geoContainer.getEntry(icfg), ccdb.operator->());
377+
fastTracker[icfg]->AddGenericDetector(mGeoContainer.getEntry(icfg), ccdb.operator->());
380378
// print fastTracker settings
381379
fastTracker[icfg]->Print();
382380
if (cascadeDecaySettings.doXiQA)
@@ -772,15 +770,13 @@ struct OnTheFlyTracker {
772770
histos.fill(HIST("hGenPrFromLa"), laDecayRadius2D, decayProducts[2].Pt());
773771
}
774772
if (v0DecaySettings.doV0QA && isV0) {
775-
static_for<0, NtypesV0 * NtypesDetectors - 1>([&](auto i) {
776-
constexpr int IndexV0 = i.value / NtypesDetectors;
777-
constexpr int IndexDetector = i.value % NtypesDetectors;
778-
if (pdg == v0PDGs[IndexV0] && icfg == IndexDetector) {
779-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/") + HIST(NameV0s[IndexV0]) + HIST("/hGen"), v0DecayRadius2D, mcParticle.pt());
780-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/") + HIST(NameV0s[IndexV0]) + HIST("/hGenNegDaughterFromV0"), v0DecayRadius2D, v0DecayProducts[0].Pt());
781-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/") + HIST(NameV0s[IndexV0]) + HIST("/hGenPosDaughterFromV0"), v0DecayRadius2D, v0DecayProducts[1].Pt());
773+
for (int indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) {
774+
for (int indexDetector = 0; indexDetector < mGeoContainer.getNumberOfConfigurations(); indexDetector++) {
775+
getHist(TH2, Form("V0Building_Configuration_%i/%s/hGen", indexDetector, NameV0s[indexV0]))->Fill(v0DecayRadius2D, mcParticle.pt());
776+
getHist(TH2, Form("V0Building_Configuration_%i/%s/hGenNegDaughterFromV0", indexDetector, NameV0s[indexV0]))->Fill(v0DecayRadius2D, v0DecayProducts[0].Pt());
777+
getHist(TH2, Form("V0Building_Configuration_%i/%s/hGenPosDaughterFromV0", indexDetector, NameV0s[indexV0]))->Fill(v0DecayRadius2D, v0DecayProducts[1].Pt());
782778
}
783-
});
779+
}
784780
}
785781
if (mcParticle.pt() < minPt) {
786782
continue;
@@ -1072,12 +1068,7 @@ struct OnTheFlyTracker {
10721068
std::vector<int> nV0TPCHits(kv0Prongs); // TPC type
10731069
if (v0DecaySettings.decayV0 && isV0) {
10741070
if (v0DecaySettings.doV0QA) {
1075-
static_for<0, NtypesDetectors - 1>([&](auto j) {
1076-
constexpr int IndexDetector = j.value;
1077-
if (icfg == IndexDetector) {
1078-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/hV0Building"), 0.0f);
1079-
}
1080-
});
1071+
getHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg))->Fill(0.0f);
10811072
}
10821073
if (isK0) {
10831074
o2::upgrade::convertTLorentzVectorToO2Track(kPiMinus, v0DecayProducts[0], v0DecayVertex, v0DaughterTrackParCovsPerfect[0], pdgDB);
@@ -1100,12 +1091,7 @@ struct OnTheFlyTracker {
11001091
nV0TPCHits[i] = fastTracker[icfg]->GetNGasPoints();
11011092

11021093
if (nV0Hits[i] < 0) { // QA
1103-
static_for<0, NtypesDetectors - 1>([&](auto j) {
1104-
constexpr int IndexDetector = j.value;
1105-
if (icfg == IndexDetector) {
1106-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/hFastTrackerQA"), o2::math_utils::abs(nV0Hits[i]));
1107-
}
1108-
});
1094+
getHist(TH1, Form("V0Building_Configuration_%i/hFastTrackerQA", icfg))->Fill(o2::math_utils::abs(nV0Hits[i]));
11091095
}
11101096

11111097
if (nV0SiliconHits[i] >= fastTrackerSettings.minSiliconHits || (nV0SiliconHits[i] >= fastTrackerSettings.minSiliconHitsIfTPCUsed && nV0TPCHits[i] >= fastTrackerSettings.minTPCClusters)) {
@@ -1114,12 +1100,7 @@ struct OnTheFlyTracker {
11141100
continue; // extra sure
11151101
}
11161102
for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits(); ih++) {
1117-
static_for<0, NtypesDetectors - 1>([&](auto j) {
1118-
constexpr int IndexDetector = j.value;
1119-
if (icfg == IndexDetector) {
1120-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/hFastTrackerHits"), fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih)));
1121-
}
1122-
});
1103+
getHist(TH2, Form("V0Building_Configuration_%i/hFastTrackerHits", icfg))->Fill(fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih)));
11231104
}
11241105
} else {
11251106
isReco[i] = true;
@@ -1138,33 +1119,36 @@ struct OnTheFlyTracker {
11381119
}
11391120
}
11401121
if (v0DecaySettings.doV0QA) {
1141-
static_for<0, NtypesV0 * NtypesDetectors - 1>([&](auto i) {
1142-
constexpr int IndexV0 = i.value / NtypesDetectors;
1143-
constexpr int IndexDetector = i.value % NtypesDetectors;
1144-
if (pdg == v0PDGs[IndexV0] && icfg == IndexDetector) {
1145-
if (isReco[0] && isReco[1]) {
1146-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/hV0Building"), 1.0f);
1147-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/") + HIST(NameV0s[IndexV0]) + HIST("/hReco"), v0DecayRadius2D, mcParticle.pt());
1122+
if (isReco[0] && isReco[1]) {
1123+
getHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg))->Fill(1.0f);
1124+
for (int indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) {
1125+
if (pdg == v0PDGs[indexV0]) {
1126+
getHist(TH2, Form("V0Building_Configuration_%i/%s/hReco", icfg, NameV0s[indexV0]))->Fill(v0DecayRadius2D, mcParticle.pt());
1127+
}
1128+
}
1129+
}
1130+
if (isReco[0]) {
1131+
for (int indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) {
1132+
if (pdg == v0PDGs[indexV0]) {
1133+
getHist(TH2, Form("V0Building_Configuration_%i/%s/hRecoNegDaughterFromV0", icfg, NameV0s[indexV0]))->Fill(v0DecayRadius2D, v0DecayProducts[0].Pt());
11481134
}
1149-
if (isReco[0])
1150-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/") + HIST(NameV0s[IndexV0]) + HIST("/hRecoNegDaughterFromV0"), v0DecayRadius2D, v0DecayProducts[0].Pt());
1151-
if (isReco[1])
1152-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/") + HIST(NameV0s[IndexV0]) + HIST("/hRecoPosDaughterFromV0"), v0DecayRadius2D, v0DecayProducts[1].Pt());
11531135
}
1154-
});
1136+
}
1137+
if (isReco[1]) {
1138+
for (int indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) {
1139+
if (pdg == v0PDGs[indexV0]) {
1140+
getHist(TH2, Form("V0Building_Configuration_%i/%s/hRecoPosDaughterFromV0", icfg, NameV0s[indexV0]))->Fill(v0DecayRadius2D, v0DecayProducts[1].Pt());
1141+
}
1142+
}
1143+
}
11551144
}
11561145

11571146
// +-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+
11581147
// combine particles into actual V0 candidate
11591148
// V0 building starts here
11601149
if (v0DecaySettings.findV0 && isReco[0] && isReco[1]) {
11611150
if (v0DecaySettings.doV0QA) {
1162-
static_for<0, NtypesDetectors - 1>([&](auto j) {
1163-
constexpr int IndexDetector = j.value;
1164-
if (icfg == IndexDetector) {
1165-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/hV0Building"), 2.0f);
1166-
}
1167-
});
1151+
getHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg))->Fill(2.0f);
11681152
}
11691153

11701154
// assign indices of the particles we've used
@@ -1188,12 +1172,7 @@ struct OnTheFlyTracker {
11881172
// V0 found successfully
11891173
if (dcaFitterOK_V0) {
11901174
if (v0DecaySettings.doV0QA) {
1191-
static_for<0, NtypesDetectors - 1>([&](auto j) {
1192-
constexpr int IndexDetector = j.value;
1193-
if (icfg == IndexDetector) {
1194-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/hV0Building"), 3.0f);
1195-
}
1196-
});
1175+
getHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg))->Fill(3.0f);
11971176
}
11981177

11991178
std::array<float, 3> pos;
@@ -1245,15 +1224,10 @@ struct OnTheFlyTracker {
12451224
}
12461225

12471226
if (v0DecaySettings.doV0QA) {
1248-
static_for<0, NtypesDetectors - 1>([&](auto j) {
1249-
constexpr int IndexDetector = j.value;
1250-
if (icfg == IndexDetector) {
1251-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/hV0Building"), 4.0f);
1252-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/K0/hMass"), thisV0.mK0, thisV0.pt);
1253-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/Lambda/hMass"), thisV0.mLambda, thisV0.pt);
1254-
histos.fill(HIST("V0Building_Configuration_") + HIST(NameDetectors[IndexDetector]) + HIST("/AntiLambda/hMass"), thisV0.mAntiLambda, thisV0.pt);
1255-
}
1256-
});
1227+
getHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg))->Fill(4.0f);
1228+
getHist(TH2, Form("V0Building_Configuration_%i/K0/hMass", icfg))->Fill(thisV0.mK0, thisV0.pt);
1229+
getHist(TH2, Form("V0Building_Configuration_%i/Lambda/hMass", icfg))->Fill(thisV0.mLambda, thisV0.pt);
1230+
getHist(TH2, Form("V0Building_Configuration_%i/AntiLambda/hMass", icfg))->Fill(thisV0.mAntiLambda, thisV0.pt);
12571231
}
12581232

12591233
// add this V0 to vector (will fill cursor later with collision ID)

0 commit comments

Comments
 (0)