|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +#ifndef ALICE3_CORE_FLATTRACKSMEARER_H_ |
| 13 | +#define ALICE3_CORE_FLATTRACKSMEARER_H_ |
| 14 | + |
| 15 | +#include "FlatLutEntry.h" |
| 16 | + |
| 17 | +#include <CCDB/BasicCCDBManager.h> |
| 18 | +#include <ReconstructionDataFormats/Track.h> |
| 19 | + |
| 20 | +namespace o2::delphes { |
| 21 | +/** |
| 22 | + * @brief Track smearing with flat LUT backend |
| 23 | + */ |
| 24 | +using O2Track = o2::track::TrackParCov; |
| 25 | +class TrackSmearer |
| 26 | +{ |
| 27 | + public: |
| 28 | + TrackSmearer() = default; |
| 29 | + ~TrackSmearer() = default; |
| 30 | + |
| 31 | + /** LUT methods **/ |
| 32 | + bool loadTable(int pdg, const char* filename, bool forceReload = false); |
| 33 | + bool hasTable(int pdg) const; |
| 34 | + |
| 35 | + void useEfficiency(bool val) { mUseEfficiency = val; } |
| 36 | + void interpolateEfficiency(bool val) { mInterpolateEfficiency = val; } |
| 37 | + void skipUnreconstructed(bool val) { mSkipUnreconstructed = val; } |
| 38 | + void setWhatEfficiency(int val) { mWhatEfficiency = val; } |
| 39 | + |
| 40 | + const lutHeader_t* getLUTHeader(int pdg) const; |
| 41 | + const lutEntry_t* getLUTEntry(int pdg, float nch, float radius, float eta, float pt, float& interpolatedEff) const; |
| 42 | + |
| 43 | + bool smearTrack(O2Track& o2track, const lutEntry_t* lutEntry, float interpolatedEff); |
| 44 | + bool smearTrack(O2Track& o2track, int pdg, float nch); |
| 45 | + |
| 46 | + double getPtRes(int pdg, float nch, float eta, float pt) const; |
| 47 | + double getEtaRes(int pdg, float nch, float eta, float pt) const; |
| 48 | + double getAbsPtRes(int pdg, float nch, float eta, float pt) const; |
| 49 | + double getAbsEtaRes(int pdg, float nch, float eta, float pt) const; |
| 50 | + double getEfficiency(int pdg, float nch, float eta, float pt) const; |
| 51 | + |
| 52 | + int getIndexPDG(int pdg) const; |
| 53 | + |
| 54 | + const char* getParticleName(int pdg) const; |
| 55 | + |
| 56 | + void setdNdEta(float val) { mdNdEta = val; } |
| 57 | + void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } |
| 58 | + |
| 59 | + protected: |
| 60 | + static constexpr unsigned int nLUTs = 9; // Number of LUT available |
| 61 | + lutHeader_t const* mHeaders[nLUTs]; // header references for quick access |
| 62 | + FlatLutData mLUTData[nLUTs]; // NEW: Flat data storage |
| 63 | + |
| 64 | + bool mUseEfficiency = true; |
| 65 | + bool mInterpolateEfficiency = false; |
| 66 | + bool mSkipUnreconstructed = true; // don't smear tracks that are not reco'ed |
| 67 | + int mWhatEfficiency = 1; |
| 68 | + float mdNdEta = 1600.f; |
| 69 | + |
| 70 | + private: |
| 71 | + o2::ccdb::BasicCCDBManager* mCcdbManager = nullptr; |
| 72 | +}; |
| 73 | + |
| 74 | +} |
| 75 | + |
| 76 | +#endif // ALICE3_CORE_FLATTRACKSMEARER_H_ |
0 commit comments