diff --git a/examples/smearing/lutRead.C b/examples/smearing/lutRead.C index d43fee4..9226aa1 100644 --- a/examples/smearing/lutRead.C +++ b/examples/smearing/lutRead.C @@ -1,5 +1,6 @@ enum EWhat { kEfficiency, + kEfficiency2, kEfficiencyInnerTOF, kEfficiencyOuterTOF, kPtResolution, @@ -44,6 +45,7 @@ lutRead(int pdg, const char *filename, int what, int vs, float nch = 0., float r if (vs == kPt) cen = lutEntry->pt; double val = 0.; if (what == kEfficiency) val = lutEntry->eff * 100.; // efficiency (%) + if (what == kEfficiency2) val = lutEntry->eff2 * 100.; // efficiency (%) if (what == kEfficiencyInnerTOF) val = lutEntry->itof * 100.; // efficiency (%) if (what == kEfficiencyOuterTOF) val = lutEntry->otof * 100.; // efficiency (%) if (what == kPtResolution) val = sqrt(lutEntry->covm[14]) * lutEntry->pt * 100.; // pt resolution (%) diff --git a/src/TrackSmearer.cc b/src/TrackSmearer.cc index 9a17fa8..598164d 100644 --- a/src/TrackSmearer.cc +++ b/src/TrackSmearer.cc @@ -96,8 +96,13 @@ bool TrackSmearer::smearTrack(O2Track &o2track, lutEntry_t *lutEntry) { // generate efficiency - if (mUseEfficiency && (gRandom->Uniform() > lutEntry->eff)) - return false; + if (mUseEfficiency) { + auto eff = 0.; + if (mWhatEfficiency == 1) eff = lutEntry->eff; + if (mWhatEfficiency == 2) eff = lutEntry->eff2; + if (gRandom->Uniform() > eff) + return false; + } // transform params vector and smear double params_[5]; for (int i = 0; i < 5; ++i) { diff --git a/src/TrackSmearer.hh b/src/TrackSmearer.hh index b6af3f8..4f3bc70 100644 --- a/src/TrackSmearer.hh +++ b/src/TrackSmearer.hh @@ -25,6 +25,7 @@ public: /** LUT methods **/ bool loadTable(int pdg, const char *filename, bool forceReload = false); void useEfficiency(bool val) { mUseEfficiency = val; }; + void setWhatEfficiency(int val) { mWhatEfficiency = val; }; lutHeader_t *getLUTHeader(int pdg) { return mLUTHeader[getIndexPDG(pdg)]; }; lutEntry_t *getLUTEntry(int pdg, float nch, float radius, float eta, float pt); @@ -53,6 +54,7 @@ protected: lutHeader_t *mLUTHeader[nLUTs] = {nullptr}; lutEntry_t *****mLUTEntry[nLUTs] = {nullptr}; bool mUseEfficiency = true; + int mWhatEfficiency = 1; float mdNdEta = 1600.; }; diff --git a/src/lutCovm.hh b/src/lutCovm.hh index 8cb8c6a..acceefd 100644 --- a/src/lutCovm.hh +++ b/src/lutCovm.hh @@ -2,7 +2,7 @@ /// @email: preghenella@bo.infn.it #pragma once -#define LUTCOVM_VERSION 20210731 +#define LUTCOVM_VERSION 20210801 struct map_t { int nbins = 1; @@ -56,6 +56,7 @@ struct lutEntry_t { float pt = 0.; bool valid = false; float eff = 0.; + float eff2 = 0.; float itof = 0.; float otof = 0.; float covm[15] = {0.}; diff --git a/src/lutWrite.cc b/src/lutWrite.cc index 90fc7fa..371bb1a 100644 --- a/src/lutWrite.cc +++ b/src/lutWrite.cc @@ -23,11 +23,28 @@ fatSolve(lutEntry_t &lutEntry, float pt = 0.1, float eta = 0.0, float mass = 0.1 if (!trPtr) return false; lutEntry.valid = true; - lutEntry.eff = fat.GetGoodHitProb(0); lutEntry.itof = fat.GetGoodHitProb(itof); lutEntry.otof = fat.GetGoodHitProb(otof); for (int i = 0; i < 15; ++i) lutEntry.covm[i] = trPtr->GetCovariance()[i]; - + + // define the efficiency + auto totfake = 0.; + lutEntry.eff = 1.; + for (int i = 1; i < 20; ++i) { + auto igoodhit = fat.GetGoodHitProb(i); + if (igoodhit <= 0. || i == itof || i == otof) continue; + lutEntry.eff *= igoodhit; + auto pairfake = 0.; + for (int j = i + 1; j < 20; ++j) { + auto jgoodhit = fat.GetGoodHitProb(j); + if (jgoodhit <= 0. || j == itof || j == otof) continue; + pairfake = (1. - igoodhit) * (1. - jgoodhit); + break; + } + totfake += pairfake; + } + lutEntry.eff2 = (1. - totfake); + return true; } @@ -164,6 +181,7 @@ lutWrite(const char *filename = "lutCovm.dat", int pdg = 211, float field = 0.2, // printf(" --- fatSolve: error \n"); lutEntry.valid = false; lutEntry.eff = 0.; + lutEntry.eff2 = 0.; for (int i = 0; i < 15; ++i) lutEntry.covm[i] = 0.; } @@ -171,6 +189,7 @@ lutWrite(const char *filename = "lutCovm.dat", int pdg = 211, float field = 0.2, else { // printf(" --- fwdSolve: pt = %f, eta = %f, mass = %f, field=%f \n", lutEntry.pt, lutEntry.eta, lutHeader.mass, lutHeader.field); lutEntry.eff = 1.; + lutEntry.eff2 = 1.; bool retval = true; if (usePara) { retval = fwdPara(lutEntry, lutEntry.pt, lutEntry.eta, lutHeader.mass, field);