Skip to content

Commit 5e41050

Browse files
committed
start adding FlatTrackSmearer
1 parent ee2cc96 commit 5e41050

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

ALICE3/Core/FlatTrackSmearer.cxx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
#include "FlatTrackSmearer.h"
13+
14+
namespace o2::delphes {
15+
int TrackSmearer::getIndexPDG(int pdg) const
16+
{
17+
switch (std::abs(pdg)) {
18+
case 11:
19+
return 0; // Electron
20+
case 13:
21+
return 1; // Muon
22+
case 211:
23+
return 2; // Pion
24+
case 321:
25+
return 3; // Kaon
26+
case 2212:
27+
return 4; // Proton
28+
case 1000010020:
29+
return 5; // Deuteron
30+
case 1000010030:
31+
return 6; // Triton
32+
case 1000020030:
33+
return 7; // Helium3
34+
case 1000020040:
35+
return 8; // Alphas
36+
default:
37+
return 2; // Default: pion
38+
}
39+
}
40+
41+
const char* TrackSmearer::getParticleName(int pdg) const
42+
{
43+
switch (std::abs(pdg)) {
44+
case 11:
45+
return "electron";
46+
case 13:
47+
return "muon";
48+
case 211:
49+
return "pion";
50+
case 321:
51+
return "kaon";
52+
case 2212:
53+
return "proton";
54+
case 1000010020:
55+
return "deuteron";
56+
case 1000010030:
57+
return "triton";
58+
case 1000020030:
59+
return "helium3";
60+
case 1000020040:
61+
return "alpha";
62+
default:
63+
return "pion"; // Default: pion
64+
}
65+
}
66+
} // namespace o2::delphes

ALICE3/Core/FlatTrackSmearer.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

Comments
 (0)