Skip to content

Commit 0df8365

Browse files
authored
Add nuclei LUTs in tracking with checks in AO2D creation (#93)
* Add nuclei LUTs in tracking * Extend analysis tools * Using dNdEta to smear tracks * Update LUT maker script
1 parent 143c14c commit 0df8365

File tree

4 files changed

+51
-26
lines changed

4 files changed

+51
-26
lines changed

examples/aod/createO2tables.C

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,21 @@ int createO2tables(const char* inputFile = "delphes.root",
9494

9595
// smearer
9696
o2::delphes::TrackSmearer smearer;
97-
smearer.loadTable(11, "lutCovm.el.dat");
98-
smearer.loadTable(13, "lutCovm.mu.dat");
99-
smearer.loadTable(211, "lutCovm.pi.dat");
100-
smearer.loadTable(321, "lutCovm.ka.dat");
101-
smearer.loadTable(2212, "lutCovm.pr.dat");
97+
std::map<int, const char*> mapPdgLut;
98+
mapPdgLut.insert(std::make_pair(11, "lutCovm.el.dat"));
99+
mapPdgLut.insert(std::make_pair(13, "lutCovm.mu.dat"));
100+
mapPdgLut.insert(std::make_pair(211, "lutCovm.pi.dat"));
101+
mapPdgLut.insert(std::make_pair(321, "lutCovm.ka.dat"));
102+
mapPdgLut.insert(std::make_pair(2212, "lutCovm.pr.dat"));
102103
if (enable_nuclei) {
103-
smearer.loadTable(1000010020, "lutCovm.de.dat");
104-
smearer.loadTable(1000020030, "lutCovm.he3.dat");
104+
mapPdgLut.insert(std::make_pair(1000010020, "lutCovm.de.dat"));
105+
mapPdgLut.insert(std::make_pair(1000020030, "lutCovm.he.dat"));
106+
}
107+
for (auto e : mapPdgLut) {
108+
if (!smearer.loadTable(e.first, e.second)) {
109+
Printf("Having issue with loading the LUT %i '%s'", e.first, e.second);
110+
return 1;
111+
}
105112
}
106113

107114
// TOF layer
@@ -170,6 +177,8 @@ int createO2tables(const char* inputFile = "delphes.root",
170177

171178
// Load selected branches with data from specified event
172179
treeReader->ReadEntry(ientry);
180+
const float multEtaRange = 2.f; // Range in eta to count the charged particles
181+
float dNdEta = 0.f; // Charged particle multiplicity to use in the efficiency evaluation
173182

174183
for (Int_t iparticle = 0; iparticle < particles->GetEntries(); ++iparticle) { // Loop over particles
175184
auto particle = (GenParticle*)particles->At(iparticle);
@@ -207,8 +216,12 @@ int createO2tables(const char* inputFile = "delphes.root",
207216
mcparticle.fVz = particle->Z * 0.1;
208217
mcparticle.fVt = particle->T;
209218

219+
if (TMath::Abs(particle->Eta) <= multEtaRange && particle->D1 < 0 && particle->D2 < 0 && particle->Charge != 0) {
220+
dNdEta += 1.f;
221+
}
210222
FillTree(kMcParticle);
211223
}
224+
dNdEta = 0.5f * dNdEta / multEtaRange;
212225
fOffsetLabel += particles->GetEntries();
213226

214227
// loop over tracks
@@ -246,7 +259,7 @@ int createO2tables(const char* inputFile = "delphes.root",
246259

247260
O2Track o2track; // tracks in internal O2 format
248261
o2::delphes::TrackUtils::convertTrackToO2Track(*track, o2track, true);
249-
if (!smearer.smearTrack(o2track, track->PID)) { // Skipping inefficient/not correctly smeared tracks
262+
if (!smearer.smearTrack(o2track, track->PID, dNdEta)) { // Skipping inefficient/not correctly smeared tracks
250263
continue;
251264
}
252265
o2::delphes::TrackUtils::convertO2TrackToTrack(o2track, *track, true);

examples/scripts/create_luts.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,19 @@ while getopts ":t:B:R:p:o:T:P:h" option; do
6060
esac
6161
done
6262

63-
cp "${WRITER_PATH}/lutWrite.$WHAT.cc" . || { echo "cannot find lut writer: ${WRITER_PATH}/lutWrite.$WHAT.cc" ; exit 1; }
64-
cp "${WRITER_PATH}/DetectorK/DetectorK.cxx" .
65-
cp "${WRITER_PATH}/DetectorK/DetectorK.h" .
66-
cp -r "${WRITER_PATH}/fwdRes" .
67-
cp "${WRITER_PATH}/lutWrite.cc" .
63+
function do_copy() {
64+
cp "${1}" . || {
65+
echo "Cannot find $2: ${1}"
66+
exit 1
67+
}
68+
}
69+
70+
do_copy "${WRITER_PATH}/lutWrite.$WHAT.cc" "lut writer"
71+
do_copy "${WRITER_PATH}/DetectorK/DetectorK.cxx"
72+
do_copy "${WRITER_PATH}/DetectorK/DetectorK.h"
73+
do_copy "${WRITER_PATH}/lutWrite.cc"
74+
do_copy "${WRITER_PATH}/lutCovm.hh"
75+
cp -r "${WRITER_PATH}/fwdRes" .
6876

6977
echo " --- creating LUTs: config = ${WHAT}, field = ${FIELD} T, min tracking radius = ${RMIN} cm"
7078

@@ -93,11 +101,12 @@ done
93101
NullSize=""
94102
P=(el mu pi ka pr de he3)
95103
for i in $PARTICLES; do
96-
if [[ ! -s lutCovm.${P[$i]}.dat ]]; then
97-
echo "${i} has zero size"
104+
LUT_FILE=${OUT_PATH}/lutCovm.${P[$i]}${OUT_TAG}.dat
105+
if [[ ! -s ${LUT_FILE} ]]; then
106+
echo "LUT file ${LUT_FILE} for particle ${i} has zero size"
98107
NullSize="${NullSize} ${i}"
99108
else
100-
echo "lutCovm.${P[$i]}.dat is ok"
109+
echo "${LUT_FILE} is ok"
101110
fi
102111
done
103112

examples/scripts/diagnostic_tools/doanalysis.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def main(mode,
124124
merge_output=False,
125125
merge_only=False,
126126
shm_mem_size=16000000000,
127+
rate_lim=1000000000,
127128
readers=1,
128129
avoid_overwriting_merge=False,
129130
extra_arguments=""):
@@ -139,7 +140,7 @@ def main(mode,
139140
else:
140141
msg("Merging output of", f"'{mode}'",
141142
"analysis", color=bcolors.BOKBLUE)
142-
o2_arguments = f"-b --shm-segment-size {shm_mem_size} --readers {readers}"
143+
o2_arguments = f"-b --shm-segment-size {shm_mem_size} --aod-memory-rate-limit {rate_lim} --readers {readers}"
143144
o2_arguments += extra_arguments
144145
if mode not in analyses:
145146
raise ValueError("Did not find analyses matching mode",

src/TrackSmearer.hh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,23 @@ public:
3434

3535
int getIndexPDG(int pdg) {
3636
switch(abs(pdg)) {
37-
case 11: return 0;
38-
case 13: return 1;
39-
case 211: return 2;
40-
case 321: return 3;
41-
case 2212: return 4;
42-
default: return 2;
37+
case 11: return 0; // Electron
38+
case 13: return 1; // Muon
39+
case 211: return 2; // Pion
40+
case 321: return 3; // Kaon
41+
case 2212: return 4; // Proton
42+
case 1000010020: return 5; // Deuteron
43+
case 1000020030: return 6; // Helium3
44+
default: return 2; // Default: pion
4345
};
4446
};
4547

4648
void setdNdEta(float val) { mdNdEta = val; };
4749

4850
protected:
49-
50-
lutHeader_t *mLUTHeader[5] = {nullptr};
51-
lutEntry_t *****mLUTEntry[5] = {nullptr};
51+
static constexpr unsigned int nLUTs = 7;
52+
lutHeader_t *mLUTHeader[nLUTs] = {nullptr};
53+
lutEntry_t *****mLUTEntry[nLUTs] = {nullptr};
5254
bool mUseEfficiency = true;
5355
float mdNdEta = 1600.;
5456

0 commit comments

Comments
 (0)