Skip to content

Commit 852f369

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 58d738a + 06e8c9e commit 852f369

File tree

243 files changed

+16248
-6256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+16248
-6256
lines changed

.clang-format

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,60 @@ PenaltyBreakFirstLessLess: 120
3939
PenaltyBreakString: 1000
4040
PenaltyExcessCharacter: 1000000
4141
PenaltyReturnTypeOnItsOwnLine: 200
42-
SortIncludes: false
42+
SortIncludes: CaseSensitive
43+
IncludeBlocks: Regroup
44+
IncludeCategories:
45+
# O2Physics, PWG
46+
- Regex: ^(<|")PWG[A-Z]{2}/.*\.h
47+
Priority: 2
48+
CaseSensitive: true
49+
# O2Physics, non-PWG
50+
- Regex: ^(<|")(Common|ALICE3|DPG|EventFiltering|Tools|Tutorials)/.*\.h
51+
Priority: 3
52+
CaseSensitive: true
53+
# O2
54+
- Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h
55+
Priority: 4
56+
CaseSensitive: true
57+
# ROOT
58+
- Regex: ^(<|")(T[A-Z]|Math/|Roo[A-Z])[[:alnum:]/]+\.h
59+
Priority: 5
60+
CaseSensitive: true
61+
# known third-party: KFParticle
62+
- Regex: ^(<|")KF[A-Z][[:alnum:]]+\.h
63+
Priority: 6
64+
CaseSensitive: true
65+
# known third-party: FastJet
66+
- Regex: ^(<|")fastjet/
67+
Priority: 6
68+
CaseSensitive: true
69+
# known third-party: ONNX runtime
70+
- Regex: ^(<|")onnxruntime
71+
Priority: 6
72+
CaseSensitive: true
73+
# incomplete path to DataModel
74+
- Regex: ^(<|").*DataModel/
75+
Priority: 1
76+
CaseSensitive: true
77+
# other third-party
78+
- Regex: ^(<|")([[:alnum:]_]+/)+[[:alnum:]_]+\.h
79+
Priority: 6
80+
CaseSensitive: true
81+
# other local-looking file
82+
- Regex: ^".*\.
83+
Priority: 1
84+
CaseSensitive: true
85+
# C system
86+
- Regex: ^(<|")[[:lower:]_]+\.h(>|")
87+
Priority: 102
88+
CaseSensitive: true
89+
# C++ system
90+
- Regex: ^(<|")[[:lower:]_/]+(>|")
91+
Priority: 101
92+
CaseSensitive: true
93+
# rest
94+
- Regex: .*
95+
Priority: 100
4396
SpaceBeforeAssignmentOperators: true
4497
SpaceBeforeParens: ControlStatements
4598
SpaceInEmptyParentheses: false

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ repos:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- repo: https://github.com/pre-commit/mirrors-clang-format
10-
rev: v18.1.3 # clang-format version
10+
rev: v20.1.5 # clang-format version
1111
hooks:
1212
- id: clang-format
1313
- repo: https://github.com/cpplint/cpplint
14-
rev: 2.0.0
14+
rev: 2.0.2
1515
hooks:
1616
- id: cpplint

ALICE3/Core/DelphesO2LutWriter.cxx

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323

2424
#include "ALICE3/Core/DelphesO2TrackSmearer.h"
2525
#include "ALICE3/Core/DelphesO2LutWriter.h"
26-
#include "iostream"
26+
#include <iostream>
2727
#include "TMatrixD.h"
2828
#include "TVectorD.h"
29+
#include "TAxis.h"
2930
#include "TMatrixDSymEigen.h"
3031
#include "TDatabasePDG.h"
3132
#include "TLorentzVector.h"
@@ -55,17 +56,18 @@ bool DelphesO2LutWriter::fatSolve(lutEntry_t& lutEntry,
5556
const float mass,
5657
int itof,
5758
int otof,
58-
int q)
59+
int q,
60+
const float nch)
5961
{
6062
lutEntry.valid = false;
6163

6264
static TLorentzVector tlv;
6365
tlv.SetPtEtaPhiM(pt, eta, 0., mass);
6466
o2::track::TrackParCov trkIn;
6567
o2::upgrade::convertTLorentzVectorToO2Track(q, tlv, {0., 0., 0.}, trkIn);
66-
6768
o2::track::TrackParCov trkOut;
68-
if (fat.FastTrack(trkIn, trkOut, 1) < 0) {
69+
const int status = fat.FastTrack(trkIn, trkOut, nch);
70+
if (status <= 0) {
6971
Printf(" --- fatSolve: FastTrack failed --- \n");
7072
tlv.Print();
7173
return false;
@@ -234,6 +236,9 @@ void DelphesO2LutWriter::lutWrite(const char* filename, int pdg, float field, in
234236
lutEntry_t lutEntry;
235237

236238
// write entries
239+
int nCalls = 0;
240+
int successfullCalls = 0;
241+
int failedCalls = 0;
237242
for (int inch = 0; inch < nnch; ++inch) {
238243
Printf(" --- writing nch = %d/%d", inch, nnch);
239244
auto nch = lutHeader.nchmap.eval(inch);
@@ -242,6 +247,7 @@ void DelphesO2LutWriter::lutWrite(const char* filename, int pdg, float field, in
242247
for (int irad = 0; irad < nrad; ++irad) {
243248
Printf(" --- writing irad = %d/%d", irad, nrad);
244249
for (int ieta = 0; ieta < neta; ++ieta) {
250+
nCalls++;
245251
Printf(" --- writing ieta = %d/%d", ieta, neta);
246252
auto eta = lutHeader.etamap.eval(ieta);
247253
lutEntry.eta = lutHeader.etamap.eval(ieta);
@@ -252,6 +258,7 @@ void DelphesO2LutWriter::lutWrite(const char* filename, int pdg, float field, in
252258
if (std::fabs(eta) <= etaMaxBarrel) { // full lever arm ends at etaMaxBarrel
253259
Printf("Solving in the barrel");
254260
// printf(" --- fatSolve: pt = %f, eta = %f, mass = %f, field=%f \n", lutEntry.pt, lutEntry.eta, lutHeader.mass, lutHeader.field);
261+
successfullCalls++;
255262
if (!fatSolve(lutEntry, lutEntry.pt, lutEntry.eta, lutHeader.mass, itof, otof, q)) {
256263
// printf(" --- fatSolve: error \n");
257264
lutEntry.valid = false;
@@ -260,13 +267,16 @@ void DelphesO2LutWriter::lutWrite(const char* filename, int pdg, float field, in
260267
for (int i = 0; i < 15; ++i) {
261268
lutEntry.covm[i] = 0.;
262269
}
270+
successfullCalls--;
271+
failedCalls++;
263272
}
264273
} else {
265274
Printf("Solving outside the barrel");
266275
// printf(" --- fwdSolve: pt = %f, eta = %f, mass = %f, field=%f \n", lutEntry.pt, lutEntry.eta, lutHeader.mass, lutHeader.field);
267276
lutEntry.eff = 1.;
268277
lutEntry.eff2 = 1.;
269278
bool retval = true;
279+
successfullCalls++;
270280
if (useFlatDipole) { // Using the parametrization at the border of the barrel
271281
retval = fatSolve(lutEntry, lutEntry.pt, etaMaxBarrel, lutHeader.mass, itof, otof, q);
272282
} else if (usePara) {
@@ -288,6 +298,8 @@ void DelphesO2LutWriter::lutWrite(const char* filename, int pdg, float field, in
288298
for (int i = 0; i < 15; ++i) {
289299
lutEntry.covm[i] = 0.;
290300
}
301+
successfullCalls--;
302+
failedCalls++;
291303
}
292304
}
293305
Printf("Diagonalizing");
@@ -298,6 +310,8 @@ void DelphesO2LutWriter::lutWrite(const char* filename, int pdg, float field, in
298310
}
299311
}
300312
}
313+
Printf(" --- finished writing LUT file %s", filename);
314+
Printf(" --- successfull calls: %d/%d, failed calls: %d/%d", successfullCalls, nCalls, failedCalls, nCalls);
301315
lutFile.close();
302316
}
303317

@@ -331,10 +345,13 @@ void DelphesO2LutWriter::diagonalise(lutEntry_t& lutEntry)
331345

332346
TGraph* DelphesO2LutWriter::lutRead(const char* filename, int pdg, int what, int vs, float nch, float radius, float eta, float pt)
333347
{
348+
Printf(" --- reading LUT file %s", filename);
349+
// vs
334350
static const int kNch = 0;
335351
static const int kEta = 1;
336352
static const int kPt = 2;
337353

354+
// what
338355
static const int kEfficiency = 0;
339356
static const int kEfficiency2 = 1;
340357
static const int kEfficiencyInnerTOF = 2;
@@ -360,6 +377,58 @@ TGraph* DelphesO2LutWriter::lutRead(const char* filename, int pdg, int what, int
360377
}
361378
auto nbins = lutMap.nbins;
362379
auto g = new TGraph();
380+
g->SetName(Form("lut_%s_%d_vs_%d_what_%d", filename, pdg, vs, what));
381+
g->SetTitle(Form("LUT for %s, pdg %d, vs %d, what %d", filename, pdg, vs, what));
382+
switch (vs) {
383+
case kNch:
384+
Printf(" --- vs = kNch");
385+
g->GetXaxis()->SetTitle("Nch");
386+
break;
387+
case kEta:
388+
Printf(" --- vs = kEta");
389+
g->GetXaxis()->SetTitle("#eta");
390+
break;
391+
case kPt:
392+
Printf(" --- vs = kPt");
393+
g->GetXaxis()->SetTitle("p_{T} (GeV/c)");
394+
break;
395+
default:
396+
Printf(" --- error: unknown vs %d", vs);
397+
return nullptr;
398+
}
399+
switch (what) {
400+
case kEfficiency:
401+
Printf(" --- what = kEfficiency");
402+
g->GetYaxis()->SetTitle("Efficiency (%)");
403+
break;
404+
case kEfficiency2:
405+
Printf(" --- what = kEfficiency2");
406+
g->GetYaxis()->SetTitle("Efficiency2 (%)");
407+
break;
408+
case kEfficiencyInnerTOF:
409+
Printf(" --- what = kEfficiencyInnerTOF");
410+
g->GetYaxis()->SetTitle("Inner TOF Efficiency (%)");
411+
break;
412+
case kEfficiencyOuterTOF:
413+
Printf(" --- what = kEfficiencyOuterTOF");
414+
g->GetYaxis()->SetTitle("Outer TOF Efficiency (%)");
415+
break;
416+
case kPtResolution:
417+
Printf(" --- what = kPtResolution");
418+
g->GetYaxis()->SetTitle("p_{T} Resolution (%)");
419+
break;
420+
case kRPhiResolution:
421+
Printf(" --- what = kRPhiResolution");
422+
g->GetYaxis()->SetTitle("R#phi Resolution (#mum)");
423+
break;
424+
case kZResolution:
425+
Printf(" --- what = kZResolution");
426+
g->GetYaxis()->SetTitle("Z Resolution (#mum)");
427+
break;
428+
default:
429+
Printf(" --- error: unknown what %d", what);
430+
return nullptr;
431+
}
363432

364433
bool canBeInvalid = true;
365434
for (int i = 0; i < nbins; ++i) {

ALICE3/Core/DelphesO2LutWriter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class DelphesO2LutWriter
5555
const float mass = 0.13957000,
5656
int itof = 0,
5757
int otof = 0,
58-
int q = 1);
58+
int q = 1,
59+
const float nch = 1);
5960
bool fwdSolve(float* covm, float pt = 0.1, float eta = 0.0, float mass = 0.13957000);
6061
bool fwdPara(lutEntry_t& lutEntry, float pt = 0.1, float eta = 0.0, float mass = 0.13957000, float Bfield = 0.5);
6162
void lutWrite(const char* filename = "lutCovm.dat", int pdg = 211, float field = 0.2, int itof = 0, int otof = 0);

ALICE3/Core/DetLayer.cxx

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,76 @@
1616
/// \brief Basic struct to hold information regarding a detector layer to be used in fast simulation
1717
///
1818

19+
#include <vector>
20+
#include <string>
21+
1922
#include "DetLayer.h"
23+
24+
namespace o2::fastsim
25+
{
26+
27+
// Parametric constructor
28+
DetLayer::DetLayer(const TString& name_,
29+
float r_,
30+
float z_,
31+
float x0_,
32+
float xrho_,
33+
float resRPhi_,
34+
float resZ_,
35+
float eff_,
36+
int type_)
37+
: name(name_),
38+
r(r_),
39+
z(z_),
40+
x0(x0_),
41+
xrho(xrho_),
42+
resRPhi(resRPhi_),
43+
resZ(resZ_),
44+
eff(eff_),
45+
type(type_)
46+
{
47+
}
48+
49+
DetLayer::DetLayer(const DetLayer& other)
50+
: name(other.name), r(other.r), z(other.z), x0(other.x0), xrho(other.xrho), resRPhi(other.resRPhi), resZ(other.resZ), eff(other.eff), type(other.type)
51+
{
52+
}
53+
54+
std::string DetLayer::toString() const
55+
{
56+
std::string out = "";
57+
out.append("DetLayer: ");
58+
out.append(name.Data());
59+
out.append(" | r: ");
60+
out.append(std::to_string(r));
61+
out.append(" cm | z: ");
62+
out.append(std::to_string(z));
63+
out.append(" cm | x0: ");
64+
out.append(std::to_string(x0));
65+
out.append(" cm | xrho: ");
66+
out.append(std::to_string(xrho));
67+
out.append(" g/cm^3 | resRPhi: ");
68+
out.append(std::to_string(resRPhi));
69+
out.append(" cm | resZ: ");
70+
out.append(std::to_string(resZ));
71+
out.append(" cm | eff: ");
72+
out.append(std::to_string(eff));
73+
out.append(" | type: ");
74+
switch (type) {
75+
case layerInert:
76+
out.append("Inert");
77+
break;
78+
case layerSilicon:
79+
out.append("Silicon");
80+
break;
81+
case layerGas:
82+
out.append("Gas/TPC");
83+
break;
84+
default:
85+
out.append("Unknown");
86+
break;
87+
}
88+
return out;
89+
}
90+
91+
} // namespace o2::fastsim

0 commit comments

Comments
 (0)