Skip to content

Commit bb9b798

Browse files
committed
Add new definition for the efficiency
1 parent fe461f8 commit bb9b798

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

examples/smearing/lutRead.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
enum EWhat {
22
kEfficiency,
3+
kEfficiency2,
34
kEfficiencyInnerTOF,
45
kEfficiencyOuterTOF,
56
kPtResolution,
@@ -44,6 +45,7 @@ lutRead(int pdg, const char *filename, int what, int vs, float nch = 0., float r
4445
if (vs == kPt) cen = lutEntry->pt;
4546
double val = 0.;
4647
if (what == kEfficiency) val = lutEntry->eff * 100.; // efficiency (%)
48+
if (what == kEfficiency2) val = lutEntry->eff2 * 100.; // efficiency (%)
4749
if (what == kEfficiencyInnerTOF) val = lutEntry->itof * 100.; // efficiency (%)
4850
if (what == kEfficiencyOuterTOF) val = lutEntry->otof * 100.; // efficiency (%)
4951
if (what == kPtResolution) val = sqrt(lutEntry->covm[14]) * lutEntry->pt * 100.; // pt resolution (%)

src/TrackSmearer.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,13 @@ bool
9696
TrackSmearer::smearTrack(O2Track &o2track, lutEntry_t *lutEntry)
9797
{
9898
// generate efficiency
99-
if (mUseEfficiency && (gRandom->Uniform() > lutEntry->eff))
100-
return false;
99+
if (mUseEfficiency) {
100+
auto eff = 0.;
101+
if (mWhatEfficiency == 1) eff = lutEntry->eff;
102+
if (mWhatEfficiency == 2) eff = lutEntry->eff2;
103+
if (gRandom->Uniform() > eff)
104+
return false;
105+
}
101106
// transform params vector and smear
102107
double params_[5];
103108
for (int i = 0; i < 5; ++i) {

src/TrackSmearer.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public:
2525
/** LUT methods **/
2626
bool loadTable(int pdg, const char *filename, bool forceReload = false);
2727
void useEfficiency(bool val) { mUseEfficiency = val; };
28+
void setWhatEfficiency(int val) { mWhatEfficiency = val; };
2829
lutHeader_t *getLUTHeader(int pdg) { return mLUTHeader[getIndexPDG(pdg)]; };
2930
lutEntry_t *getLUTEntry(int pdg, float nch, float radius, float eta, float pt);
3031

@@ -53,6 +54,7 @@ protected:
5354
lutHeader_t *mLUTHeader[nLUTs] = {nullptr};
5455
lutEntry_t *****mLUTEntry[nLUTs] = {nullptr};
5556
bool mUseEfficiency = true;
57+
int mWhatEfficiency = 1;
5658
float mdNdEta = 1600.;
5759

5860
};

src/lutCovm.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/// @email: [email protected]
33

44
#pragma once
5-
#define LUTCOVM_VERSION 20210731
5+
#define LUTCOVM_VERSION 20210801
66

77
struct map_t {
88
int nbins = 1;
@@ -56,6 +56,7 @@ struct lutEntry_t {
5656
float pt = 0.;
5757
bool valid = false;
5858
float eff = 0.;
59+
float eff2 = 0.;
5960
float itof = 0.;
6061
float otof = 0.;
6162
float covm[15] = {0.};

src/lutWrite.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,28 @@ fatSolve(lutEntry_t &lutEntry, float pt = 0.1, float eta = 0.0, float mass = 0.1
2323
if (!trPtr) return false;
2424

2525
lutEntry.valid = true;
26-
lutEntry.eff = fat.GetGoodHitProb(0);
2726
lutEntry.itof = fat.GetGoodHitProb(itof);
2827
lutEntry.otof = fat.GetGoodHitProb(otof);
2928
for (int i = 0; i < 15; ++i) lutEntry.covm[i] = trPtr->GetCovariance()[i];
30-
29+
30+
// define the efficiency
31+
auto totfake = 0.;
32+
lutEntry.eff = 1.;
33+
for (int i = 1; i < 20; ++i) {
34+
auto igoodhit = fat.GetGoodHitProb(i);
35+
if (igoodhit <= 0. || i == itof || i == otof) continue;
36+
lutEntry.eff *= igoodhit;
37+
auto pairfake = 0.;
38+
for (int j = i + 1; j < 20; ++j) {
39+
auto jgoodhit = fat.GetGoodHitProb(j);
40+
if (jgoodhit <= 0. || j == itof || j == otof) continue;
41+
pairfake = (1. - igoodhit) * (1. - jgoodhit);
42+
break;
43+
}
44+
totfake += pairfake;
45+
}
46+
lutEntry.eff2 = (1. - totfake);
47+
3148
return true;
3249
}
3350

@@ -164,13 +181,15 @@ lutWrite(const char *filename = "lutCovm.dat", int pdg = 211, float field = 0.2,
164181
// printf(" --- fatSolve: error \n");
165182
lutEntry.valid = false;
166183
lutEntry.eff = 0.;
184+
lutEntry.eff2 = 0.;
167185
for (int i = 0; i < 15; ++i)
168186
lutEntry.covm[i] = 0.;
169187
}
170188
}
171189
else {
172190
// printf(" --- fwdSolve: pt = %f, eta = %f, mass = %f, field=%f \n", lutEntry.pt, lutEntry.eta, lutHeader.mass, lutHeader.field);
173191
lutEntry.eff = 1.;
192+
lutEntry.eff2 = 1.;
174193
bool retval = true;
175194
if (usePara) {
176195
retval = fwdPara(lutEntry, lutEntry.pt, lutEntry.eta, lutHeader.mass, field);

0 commit comments

Comments
 (0)