-
Notifications
You must be signed in to change notification settings - Fork 652
Expand file tree
/
Copy pathFastTracker.h
More file actions
173 lines (150 loc) · 8.01 KB
/
FastTracker.h
File metadata and controls
173 lines (150 loc) · 8.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICE3_CORE_FASTTRACKER_H_
#define ALICE3_CORE_FASTTRACKER_H_
#include "DetLayer.h"
#include <CCDB/BasicCCDBManager.h>
#include <ReconstructionDataFormats/Track.h>
#include <fairlogger/Logger.h>
#include <string>
#include <vector>
namespace o2
{
namespace fastsim
{
// +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+
// this class implements a synthetic smearer that allows
// for on-demand smearing of TrackParCovs in a certain flexible t
// detector layout.
class FastTracker
{
public:
// Constructor/destructor
FastTracker() = default;
// Destructor
virtual ~FastTracker() {}
// Layer and layer configuration
void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0);
DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true) const;
std::vector<DetLayer> GetLayers() const { return layers; }
int GetLayerIndex(const std::string& name) const;
size_t GetNLayers() const { return layers.size(); }
bool IsLayerInert(const int layer) const { return layers[layer].isInert(); }
void ClearLayers() { layers.clear(); }
void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].setRadiationLength(x0); }
void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].setRadius(r); }
void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].setResolutionRPhi(resRPhi); }
void SetResolutionZ(const std::string layerName, float resZ) { layers[GetLayerIndex(layerName)].setResolutionZ(resZ); }
void SetResolution(const std::string layerName, float resRPhi, float resZ)
{
SetResolutionRPhi(layerName, resRPhi);
SetResolutionZ(layerName, resZ);
}
void AddSiliconALICE3v4(std::vector<float> pixelResolution);
void AddSiliconALICE3v2(std::vector<float> pixelResolution);
void AddSiliconALICE3(float scaleX0VD, std::vector<float> pixelResolution);
void AddTPC(float phiResMean, float zResMean);
/**
* @brief Adds a generic detector configuration from the specified file.
*
* This function loads and integrates a detector configuration into the tracker
* using the provided filename. The file should contain the necessary parameters
* and settings for the detector to be added.
*
* @param filename Path to the configuration file describing the detector.
* @param ccdbManager Pointer to a BasicCCDBManager instance for database access (if needed).
*/
void AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager = nullptr);
void Print();
/**
* @brief Performs fast tracking on the input track parameters.
*
* Propagates the given input track through the detector layers, applying
* relevant corrections and updates, and stores the result in outputTrack.
*
* @param inputTrack The input track parameters and covariance (const, by value).
* @param outputTrack Reference to the output track parameters and covariance, to be filled.
* @param nch Charged particle multiplicity (used for hit density calculations).
* @return int i.e. number of intercepts (implementation-defined).
*/
int FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackParCov& outputTrack, const float nch);
// For efficiency calculation
float Dist(float z, float radius);
float OneEventHitDensity(float multiplicity, float radius);
float IntegratedHitDensity(float multiplicity, float radius);
float UpcHitDensity(float radius);
float HitDensity(float radius);
float ProbGoodChiSqHit(float radius, float searchRadiusRPhi, float searchRadiusZ);
// Setters and getters for configuration
void SetIntegrationTime(float t) { integrationTime = t; }
void SetMaxRadiusOfSlowDetectors(float r) { maxRadiusSlowDet = r; }
void SetAvgRapidity(float y) { avgRapidity = y; }
void SetdNdEtaCent(int d) { dNdEtaCent = d; }
void SetLhcUPCscale(float s) { lhcUPCScale = s; }
void SetBField(float b) { magneticField = b; }
void SetMinRadTrack(float r) { fMinRadTrack = r; }
void SetMagneticField(float b) { magneticField = b; }
void SetApplyZacceptance(bool b) { mApplyZacceptance = b; }
void SetApplyMSCorrection(bool b) { mApplyMSCorrection = b; }
void SetApplyElossCorrection(bool b) { mApplyElossCorrection = b; }
void SetApplyEffCorrection(bool b) { mApplyEffCorrection = b; }
// Getters for the last track
int GetNIntercepts() const { return nIntercepts; }
int GetNSiliconPoints() const { return nSiliconPoints; }
int GetNGasPoints() const { return nGasPoints; }
float GetGoodHitProb(int layer) const
{
return (layer >= 0 && static_cast<size_t>(layer) < goodHitProbability.size()) ? goodHitProbability[layer] : 0.0f;
}
std::size_t GetNHits() const { return hits.size(); }
float GetHitX(const int i) const { return hits[i][0]; }
float GetHitY(const int i) const { return hits[i][1]; }
float GetHitZ(const int i) const { return hits[i][2]; }
uint64_t GetCovMatOK() const { return covMatOK; }
uint64_t GetCovMatNotOK() const { return covMatNotOK; }
private:
// Definition of detector layers
std::vector<DetLayer> layers;
std::vector<std::vector<float>> hits; // bookkeep last added hits
/// configuration parameters
bool mApplyZacceptance = false; /// check z acceptance or not
bool mApplyMSCorrection = true; /// Apply correction for multiple scattering
bool mApplyElossCorrection = true; /// Apply correction for eloss (requires MS correction)
bool mApplyEffCorrection = true; /// Apply correction for hit efficiency
int mVerboseLevel = 0; /// 0: not verbose, >0 more verbose
const float mCrossSectionMinB = 8; /// Minimum bias Cross section for event under study (PbPb MinBias ~ 8 Barns)
int dNdEtaCent = 2200; /// dN/deta e.g. at centrality 0-5% (for 5 TeV PbPb)
int dNdEtaMinB = 1; /// dN/deta for minimum bias events
float integrationTime = 0.02f; /// Integration time in ms
float magneticField = 20.f; /// Magnetic field in kiloGauss (5 = 0.5T, 20 = 2T, etc)
float covMatFactor = 0.99f; /// covmat off-diagonal factor to use for covmat fix (negative: no factor)
float sigmaD = 6.0f; /// sigma for the detector resolution in cm
float luminosity = 1.e27f; /// luminosity in cm^-2 s^-1 (e.g. 1.e27 for PbPb at 5 TeV)
float otherBackground = 0.0f; /// background from other sources, e.g. pileup, in [0, 1]
float maxRadiusSlowDet = 10.f; /// maximum radius of slow detectors in cm
float avgRapidity = 0.45f; /// average rapidity for hit density calculation
float lhcUPCScale = 1.0f; /// scale factor for LHC UPC events
float upcBackgroundMultiplier = 1.0f; /// multiplier for UPC background
float fMinRadTrack = 132.f; /// minimum radius for track propagation in cm
/// counters for covariance matrix statuses
uint64_t covMatOK = 0; /// cov mat has positive eigenvals
uint64_t covMatNotOK = 0; /// cov mat has negative eigenvals
/// last track information
int nIntercepts = 0; /// found in first outward propagation
int nSiliconPoints = 0; /// silicon-based space points added to track
int nGasPoints = 0; /// tpc-based space points added to track
std::vector<float> goodHitProbability;
ClassDef(FastTracker, 1);
};
// +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+
} // namespace fastsim
} // namespace o2
#endif // ALICE3_CORE_FASTTRACKER_H_