|
| 1 | +enum EWhat { |
| 2 | + kEfficiency, |
| 3 | + kEfficiencyInnerTOF, |
| 4 | + kEfficiencyOuterTOF, |
| 5 | + kPtResolution, |
| 6 | + kRPhiResolution, |
| 7 | + kZResolution |
| 8 | +}; |
| 9 | + |
| 10 | +enum EVs { |
| 11 | + kNch, |
| 12 | + kEta, |
| 13 | + kPt |
| 14 | +}; |
| 15 | + |
| 16 | +TGraph * |
| 17 | +lutRead(int pdg, const char *filename, int what, int vs, float nch = 0., float radius = 0., float eta = 0., float pt = 0.) |
| 18 | +{ |
| 19 | + o2::delphes::TrackSmearer smearer; |
| 20 | + smearer.loadTable(pdg, filename); |
| 21 | + auto lutHeader = smearer.getLUTHeader(pdg); |
| 22 | + map_t lutMap; |
| 23 | + if (vs == kNch) lutMap = lutHeader->nchmap; |
| 24 | + if (vs == kEta) lutMap = lutHeader->etamap; |
| 25 | + if (vs == kPt) lutMap = lutHeader->ptmap; |
| 26 | + auto nbins = lutMap.nbins; |
| 27 | + auto g = new TGraph(); |
| 28 | + |
| 29 | + bool canBeInvalid = true; |
| 30 | + for (int i = 0; i < nbins; ++i) { |
| 31 | + if (vs == kNch) nch = lutMap.eval(i); |
| 32 | + if (vs == kEta) eta = lutMap.eval(i); |
| 33 | + if (vs == kPt) pt = lutMap.eval(i); |
| 34 | + auto lutEntry = smearer.getLUTEntry(pdg, nch, radius, eta , pt); |
| 35 | + if (!lutEntry->valid || lutEntry->eff == 0.) { |
| 36 | + if (!canBeInvalid) std::cout << " --- warning: it cannot be invalid \n" << std::endl; |
| 37 | + continue; |
| 38 | + } |
| 39 | + canBeInvalid = false; |
| 40 | + |
| 41 | + double cen = 0.; |
| 42 | + if (vs == kNch) cen = lutEntry->nch; |
| 43 | + if (vs == kEta) cen = lutEntry->eta; |
| 44 | + if (vs == kPt) cen = lutEntry->pt; |
| 45 | + double val = 0.; |
| 46 | + if (what == kEfficiency) val = lutEntry->eff * 100.; // efficiency (%) |
| 47 | + if (what == kEfficiencyInnerTOF) val = lutEntry->itof * 100.; // efficiency (%) |
| 48 | + if (what == kEfficiencyOuterTOF) val = lutEntry->otof * 100.; // efficiency (%) |
| 49 | + if (what == kPtResolution) val = sqrt(lutEntry->covm[14]) * lutEntry->pt * 100.; // pt resolution (%) |
| 50 | + if (what == kRPhiResolution) val = sqrt(lutEntry->covm[0]) * 1.e4; // rphi resolution (um) |
| 51 | + if (what == kZResolution) val = sqrt(lutEntry->covm[1]) * 1.e4; // z resolution (um) |
| 52 | + if (val < 0.) continue; |
| 53 | + g->SetPoint(g->GetN(), cen, val); |
| 54 | + } |
| 55 | + |
| 56 | + return g; |
| 57 | + |
| 58 | +} |
| 59 | + |
0 commit comments