Skip to content

Commit d799a6c

Browse files
authored
Merge 5dafde5 into sapling-pr-archive-ktf
2 parents 9e74814 + 5dafde5 commit d799a6c

File tree

35 files changed

+321
-224
lines changed

35 files changed

+321
-224
lines changed

DataFormats/Detectors/TOF/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12+
o2_add_library(DataFormatsParamTOF
13+
SOURCES src/ParameterContainers.cxx
14+
PUBLIC_LINK_LIBRARIES O2::FrameworkLogger)
15+
16+
17+
o2_target_root_dictionary(DataFormatsParamTOF
18+
HEADERS include/DataFormatsTOF/ParameterContainers.h)
19+
1220
o2_add_library(DataFormatsTOF
1321
SOURCES src/Cluster.cxx
1422
src/CalibInfoTOFshort.cxx
@@ -22,6 +30,7 @@ o2_add_library(DataFormatsTOF
2230
src/TOFFEElightInfo.cxx
2331
PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats
2432
O2::GPUCommon
33+
O2::DataFormatsParamTOF
2534
Boost::serialization)
2635

2736
o2_target_root_dictionary(DataFormatsTOF
@@ -33,7 +42,6 @@ o2_target_root_dictionary(DataFormatsTOF
3342
include/DataFormatsTOF/RawDataFormat.h
3443
include/DataFormatsTOF/CompressedDataFormat.h
3544
include/DataFormatsTOF/CTF.h
36-
include/DataFormatsTOF/ParameterContainers.h
3745
include/DataFormatsTOF/CalibInfoCluster.h
3846
include/DataFormatsTOF/CosmicInfo.h
3947
include/DataFormatsTOF/TOFFEElightInfo.h

DataFormats/Detectors/TOF/include/DataFormatsTOF/Cluster.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,17 @@ class Cluster : public o2::BaseCluster<float>
4949
kDownRight = 4, // 2^4, 5th bit
5050
kDown = 5, // 2^5, 6th bit
5151
kDownLeft = 6, // 2^6, 7th bit
52-
kLeft = 7, // 2^7, 8th bit
53-
//
54-
FrameBit = 6 }; // this bit set means that the cluster is in the nominal (alpha=20*sector+10 deg.) sector frame rather than aligned
52+
kLeft = 7 // 2^7, 8th bit
53+
};
5554

5655
Cluster() = default;
5756

5857
Cluster(std::int16_t sensid, float x, float y, float z, float sy2, float sz2, float syz, double timeRaw, double time, float tot, int L0L1latency, int deltaBC, float geanttime = 0.0, double t0 = 0.0);
5958

6059
~Cluster() = default;
6160

62-
bool isInNominalSector() const { return isBitSet(FrameBit); }
63-
void setInNominalSector() { setBit(FrameBit); }
61+
bool isInNominalSector() const { return mInNominalSector; }
62+
void setInNominalSector(bool v = true) { mInNominalSector = v; }
6463

6564
std::int8_t getSector() const { return getCount(); }
6665
void setSector(std::int8_t value) { setCount(value); }
@@ -163,9 +162,10 @@ class Cluster : public o2::BaseCluster<float>
163162
double mDigitInfoT[6] = {0., 0., 0., 0., 0., 0.};
164163
float mDigitInfoTOT[6] = {0., 0., 0., 0., 0., 0.};
165164
float mTgeant = 0.0;
165+
bool mInNominalSector = false;
166166
double mT0true = 0.0;
167167

168-
ClassDefNV(Cluster, 5);
168+
ClassDefNV(Cluster, 6);
169169
};
170170

171171
#ifndef GPUCA_GPUCODE

DataFormats/Detectors/TOF/include/DataFormatsTOF/ParameterContainers.h

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
#ifndef O2_TOF_PARAMCONTAINER_H
1919
#define O2_TOF_PARAMCONTAINER_H
2020

21-
#include "TNamed.h"
22-
#include "TFile.h"
23-
#include "Framework/Logger.h"
24-
#include "map"
21+
#include <TNamed.h>
22+
#include <TFile.h>
23+
#include <Framework/Logger.h>
24+
#include <map>
2525

2626
namespace o2
2727
{
@@ -37,7 +37,7 @@ class Parameters
3737
Parameters(std::array<std::string, nPar> parNames, std::string name) : mName{name}, mPar{}, mParNames{parNames} {};
3838

3939
/// Default destructor
40-
virtual ~Parameters() = default; // Ensure proper cleanup in derived classes
40+
~Parameters() = default;
4141

4242
/// Setter for the parameter at position iparam
4343
/// \param iparam index in the array of the parameters
@@ -183,27 +183,10 @@ class ParameterCollection : public TNamed
183183
/// @param value parameter to add to the stored information
184184
/// @param pass key to look for in the stored information e.g. pass
185185
/// @return true if found and configured false if not fully configured
186-
bool addParameter(const std::string& pass, const std::string& parName, float value)
187-
{
188-
const bool alreadyPresent = hasKey(pass);
189-
if (alreadyPresent) {
190-
LOG(debug) << "Changing parametrization corresponding to key " << pass << " from size " << mParameters[pass].size() << " to " << parName;
191-
} else {
192-
mParameters[pass] = std::unordered_map<std::string, paramvar_t>{};
193-
LOG(debug) << "Adding new parametrization corresponding to key " << pass << ": " << parName;
194-
}
195-
mParameters[pass][parName] = value;
196-
return true;
197-
}
186+
bool addParameter(const std::string& pass, const std::string& parName, float value);
198187

199188
/// @return the size of the container i.e. the number of stored keys (or passes)
200-
int getSize(const std::string& pass) const
201-
{
202-
if (!hasKey(pass)) {
203-
return -1;
204-
}
205-
return mParameters.at(pass).size();
206-
}
189+
int getSize(const std::string& pass) const;
207190

208191
/// @brief Function to push the parameters from the sub container into the collection and store it under a given key
209192
/// @tparam ParType type of the parameter container
@@ -231,26 +214,10 @@ class ParameterCollection : public TNamed
231214

232215
/// @brief printing function for the content of the pass
233216
/// @param pass pass to print
234-
void print(const std::string& pass) const
235-
{
236-
const auto& size = getSize(pass);
237-
if (size < 0) {
238-
LOG(info) << "empty pass: " << pass;
239-
return;
240-
}
241-
LOG(info) << "Pass \"" << pass << "\" with size " << size;
242-
for (const auto& [par, value] : mParameters.at(pass)) {
243-
LOG(info) << "par name = " << par << ", value = " << value;
244-
}
245-
}
217+
void print(const std::string& pass) const;
246218

247219
/// @brief printing function for the full content of the container
248-
void print() const
249-
{
250-
for (const auto& [pass, pars] : mParameters) {
251-
print(pass);
252-
}
253-
}
220+
void print() const;
254221

255222
/// @brief Getter of the full map of parameters stored in the container
256223
/// @return returns the full map of parameters
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
#ifdef __CLING__
13+
14+
#pragma link C++ class o2::tof::Parameters < 5> + ;
15+
#pragma link C++ class o2::tof::ParameterCollection + ;
16+
17+
#endif

DataFormats/Detectors/TOF/src/DataFormatsTOFLinkDef.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
#pragma link C++ class std::vector < o2::dataformats::CalibInfoTOFshort> + ;
3535
#pragma link C++ class std::vector < o2::dataformats::CalibInfoTOF> + ;
36-
#pragma link C++ class o2::tof::Parameters < 5> + ;
37-
#pragma link C++ class o2::tof::ParameterCollection + ;
3836

3937
#pragma link C++ class o2::tof::CTFHeader + ;
4038
#pragma link C++ class o2::tof::CompressedInfos + ;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
/// \file ParameterContainers.h
13+
/// \author Francesco Noferini
14+
/// \author Nicolò Jacazio [email protected]
15+
/// @since 2022-11-08
16+
/// \brief Implementation of the containers for the general parameters
17+
18+
#include "DataFormatsTOF/ParameterContainers.h"
19+
20+
// ClassImp(o2::tof::Parameters);
21+
using namespace o2::tof;
22+
23+
bool ParameterCollection::addParameter(const std::string& pass, const std::string& parName, float value)
24+
{
25+
const bool alreadyPresent = hasKey(pass);
26+
if (alreadyPresent) {
27+
LOG(debug) << "Changing parametrization corresponding to key " << pass << " from size " << mParameters[pass].size() << " to " << parName;
28+
} else {
29+
mParameters[pass] = std::unordered_map<std::string, paramvar_t>{};
30+
LOG(debug) << "Adding new parametrization corresponding to key " << pass << ": " << parName;
31+
}
32+
mParameters[pass][parName] = value;
33+
return true;
34+
}
35+
36+
int ParameterCollection::getSize(const std::string& pass) const
37+
{
38+
if (!hasKey(pass)) {
39+
return -1;
40+
}
41+
return mParameters.at(pass).size();
42+
}
43+
44+
void ParameterCollection::print() const
45+
{
46+
for (const auto& [pass, pars] : mParameters) {
47+
print(pass);
48+
}
49+
}
50+
51+
void ParameterCollection::print(const std::string& pass) const
52+
{
53+
const auto& size = getSize(pass);
54+
if (size < 0) {
55+
LOG(info) << "empty pass: " << pass;
56+
return;
57+
}
58+
LOG(info) << "Pass \"" << pass << "\" with size " << size;
59+
for (const auto& [par, value] : mParameters.at(pass)) {
60+
LOG(info) << "par name = " << par << ", value = " << value;
61+
}
62+
}

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,9 +2126,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
21262126
0,
21272127
sourceID);
21282128
}
2129-
if (sourceID != 0 || !mUseSigFiltMC) {
2130-
mcColToEvSrc.emplace_back(std::vector<int>{iCol, sourceID, eventID}); // point background and injected signal events to one collision
2131-
}
2129+
mcColToEvSrc.emplace_back(std::vector<int>{iCol, sourceID, eventID}); // point background and injected signal events to one collision
21322130
}
21332131
}
21342132
}

Detectors/TOF/base/src/Geo.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,8 +1049,8 @@ void Geo::rotateToSector(Float_t* xyz, Int_t isector)
10491049
void Geo::alignedToNominalSector(Float_t* xyz, Int_t isector)
10501050
{
10511051
// rotate from the aligned sector frame coordinates to nominal ones (i.e. alpha=20*sector+10 deg.)
1052-
constexpr float CS[18] = {.848077e-01, 8.660254e-01, 6.427876e-01, 3.420202e-01, -4.371139e-08, -3.420201e-01, -6.427876e-01, -8.660254e-01, -9.848077e-01, -9.848077e-01, -8.660254e-01, -6.427875e-01, -3.420201e-01, 1.192488e-08, 3.420201e-01, 6.427875e-01, 8.660253e-01, 9.848078e-01};
1053-
constexpr float SN[18] = {1.736482e-01, 5.000000e-01, 7.660444e-01, 9.396926e-01, 1.000000e+00, 9.396926e-01, 7.660444e-01, 5.000001e-01, 1.736483e-01, -1.736482e-01, -5.000000e-01, -7.660446e-01, -9.396927e-01, -1.000000e+00, -9.396926e-01, -7.660445e-01, -5.000002e-01, -1.736480e-01};
1052+
constexpr float CS[18] = {+9.848078e-01, +8.660254e-01, +6.427876e-01, +3.420201e-01, +6.123234e-17, -3.420201e-01, -6.427876e-01, -8.660254e-01, -9.848078e-01, -9.848078e-01, -8.660254e-01, -6.427876e-01, -3.420201e-01, -1.836970e-16, +3.420201e-01, +6.427876e-01, +8.660254e-01, +9.848078e-01};
1053+
constexpr float SN[18] = {+1.736482e-01, +5.000000e-01, +7.660444e-01, +9.396926e-01, +1.000000e+00, +9.396926e-01, +7.660444e-01, +5.000000e-01, +1.736482e-01, -1.736482e-01, -5.000000e-01, -7.660444e-01, -9.396926e-01, -1.000000e+00, -9.396926e-01, -7.660444e-01, -5.000000e-01, -1.736482e-01};
10541054
Float_t xyzDummy[3] = {xyz[1], xyz[2], xyz[0]}; // go to twisted coordinates...
10551055
o2::tof::Geo::antiRotateToSector(xyzDummy, isector); // lab coordinates
10561056
xyz[0] = xyzDummy[0] * CS[isector] + xyzDummy[1] * SN[isector];

Detectors/TOF/workflow/src/make-parameter-collection.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ParamExample : public Parameters<5>
6363
public:
6464
ParamExample() : Parameters(std::array<std::string, 5>{"p0", "p1", "p2", "p3", "p4"},
6565
"ParamExample") { setParameters(std::array<paramvar_t, 5>{0, 1, 2, 3, 4}); }; // Default constructor with default parameters
66-
~ParamExample() override = default;
66+
~ParamExample() = default;
6767
};
6868

6969
int main(int argc, char* argv[])

Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/SegmentationChip.h

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ class SegmentationChip
3535
// The "detector coordinate system" refers to the hit position in row,col inside the sensor
3636
// This class provides the transformations from the local and detector coordinate systems
3737
// The conversion between global and local coordinate systems is operated by the transformation matrices
38-
// For the curved VD layers there exist three coordinate systems and one is transient.
38+
// For the curved VD layers there exist four coordinate systems.
3939
// 1. The global (curved) coordinate system. The chip's center of coordinate system is
4040
// defined at the the mid-point of the detector.
41-
// 2. The local (flat) coordinate system. This is the tube segment projected onto a flat
42-
// surface. In the projection we implicitly assume that the inner and outer
43-
// stretch does not depend on the radius.
44-
// 3. The detector coordinate system. Defined by the row and column segmentation
45-
// defined at the upper edge in the flat coord.
41+
// 2. The local (curved) coordinate system, centered in 0,0,0.
42+
// 3. The local (flat) coordinate system. This is the tube segment projected onto a flat
43+
// surface, centered in the middle of the chip, with the y axis pointing towards the interaction point.
44+
// In the projection we implicitly assume that the inner and outer stretch does not depend on the radius.
45+
// 4. The detector coordinate system. Defined by the row and column segmentation.
4646
// For the flat ML and OT layers, there exist two coordinate systems:
4747
// 1. The global (flat) coordinate system. The chip's center of coordinate system is
4848
// defined at the the mid-point of the detector.
49-
// 2. The detector coordinate system. Defined by the row and column segmentation
49+
// 2. The detector coordinate system. Defined by the row and column segmentation.
5050
// TODO: add segmentation for VD disks
5151

5252
public:
@@ -121,15 +121,20 @@ class SegmentationChip
121121
pitchCol = PitchColMLOT;
122122
maxWidth = constants::ML::width;
123123
maxLength = constants::ML::length;
124-
} else if (subDetID == 1 && layer >= 4) { // OT
124+
} else if (subDetID == 1 && layer == 4) { // ML/OT (mixed layer, length = ML but staggered as OT)
125125
pitchRow = PitchRowMLOT;
126126
pitchCol = PitchColMLOT;
127-
maxWidth = constants::OT::width;
128-
maxLength = constants::OT::length;
127+
maxWidth = constants::OT::halfstave::width;
128+
maxLength = constants::ML::length;
129+
} else if (subDetID == 1 && layer > 4) { // OT
130+
pitchRow = PitchRowMLOT;
131+
pitchCol = PitchColMLOT;
132+
maxWidth = constants::OT::halfstave::width;
133+
maxLength = constants::OT::halfstave::length;
129134
}
130135
// convert to row/col
131-
iRow = static_cast<int>(std::floor((maxWidth / 2 - xRow) / pitchRow));
132-
iCol = static_cast<int>(std::floor((zCol + maxLength / 2) / pitchCol));
136+
iRow = static_cast<int>(((maxWidth / 2 - xRow) / pitchRow));
137+
iCol = static_cast<int>(((zCol + maxLength / 2) / pitchCol));
133138
};
134139

135140
// Check local coordinates (cm) validity.
@@ -143,9 +148,12 @@ class SegmentationChip
143148
} else if (subDetID == 1 && layer <= 3) { // ML
144149
maxWidth = constants::ML::width;
145150
maxLength = constants::ML::length;
146-
} else if (subDetID == 1 && layer >= 4) { // OT
147-
maxWidth = constants::OT::width;
148-
maxLength = constants::OT::length;
151+
} else if (subDetID == 1 && layer == 4) { // ML/OT (mixed layer, length = ML but staggered as OT)
152+
maxWidth = constants::OT::halfstave::width;
153+
maxLength = constants::ML::length;
154+
} else if (subDetID == 1 && layer > 4) { // OT
155+
maxWidth = constants::OT::halfstave::width;
156+
maxLength = constants::OT::halfstave::length;
149157
}
150158
return (-maxWidth / 2 < x && x < maxWidth / 2 && -maxLength / 2 < z && z < maxLength / 2);
151159
}
@@ -162,9 +170,12 @@ class SegmentationChip
162170
} else if (subDetID == 1 && layer <= 3) { // ML
163171
nRows = constants::ML::nRows;
164172
nCols = constants::ML::nCols;
165-
} else if (subDetID == 1 && layer >= 4) { // OT
166-
nRows = constants::OT::nRows;
167-
nCols = constants::OT::nCols;
173+
} else if (subDetID == 1 && layer == 4) { // ML/OT (mixed layer, length = ML but staggered as OT)
174+
nRows = constants::OT::halfstave::nRows;
175+
nCols = constants::ML::nCols;
176+
} else if (subDetID == 1 && layer > 4) { // OT
177+
nRows = constants::OT::halfstave::nRows;
178+
nCols = constants::OT::halfstave::nCols;
168179
}
169180
return (row >= 0 && row < static_cast<float>(nRows) && col >= 0 && col < static_cast<float>(nCols));
170181
}
@@ -210,9 +221,12 @@ class SegmentationChip
210221
} else if (subDetID == 1 && layer <= 3) { // ML
211222
xRow = 0.5 * (constants::ML::width - PitchRowMLOT) - (row * PitchRowMLOT);
212223
zCol = col * PitchRowMLOT + 0.5 * (PitchRowMLOT - constants::ML::length);
213-
} else if (subDetID == 1 && layer >= 4) { // OT
214-
xRow = 0.5 * (constants::OT::width - PitchRowMLOT) - (row * PitchRowMLOT);
215-
zCol = col * PitchColMLOT + 0.5 * (PitchColMLOT - constants::OT::length);
224+
} else if (subDetID == 1 && layer == 4) { // ML/OT (mixed layer, length = ML but staggered as OT)
225+
xRow = 0.5 * (constants::OT::halfstave::width - PitchRowMLOT) - (row * PitchRowMLOT);
226+
zCol = col * PitchRowMLOT + 0.5 * (PitchRowMLOT - constants::ML::length);
227+
} else if (subDetID == 1 && layer > 4) { // OT
228+
xRow = 0.5 * (constants::OT::halfstave::width - PitchRowMLOT) - (row * PitchRowMLOT);
229+
zCol = col * PitchColMLOT + 0.5 * (PitchColMLOT - constants::OT::halfstave::length);
216230
}
217231
}
218232

@@ -263,17 +277,25 @@ class SegmentationChip
263277
}
264278

265279
/// Print segmentation info
266-
static const void Print() noexcept
280+
static void Print() noexcept
267281
{
268282
LOG(info) << "Number of rows:\nVD L0: " << constants::VD::petal::layer::nRows[0]
269283
<< "\nVD L1: " << constants::VD::petal::layer::nRows[1]
270284
<< "\nVD L2: " << constants::VD::petal::layer::nRows[2]
271285
<< "\nML stave: " << constants::ML::nRows
272-
<< "\nOT stave: " << constants::OT::nRows;
286+
<< "\nOT half stave: " << constants::OT::halfstave::nRows;
273287

274288
LOG(info) << "Number of cols:\nVD: " << constants::VD::petal::layer::nCols
275289
<< "\nML stave: " << constants::ML::nCols
276-
<< "\nOT stave: " << constants::OT::nCols;
290+
<< "\nOT half stave: " << constants::OT::halfstave::nCols;
291+
292+
LOG(info) << "Pitch rows [cm]:\nVD: " << PitchRowVD
293+
<< "\nML stave: " << PitchRowMLOT
294+
<< "\nOT stave: " << PitchRowMLOT;
295+
296+
LOG(info) << "Pitch cols [cm]:\nVD: " << PitchColVD
297+
<< "\nML stave: " << PitchColMLOT
298+
<< "\nOT stave: " << PitchColMLOT;
277299
}
278300
};
279301

0 commit comments

Comments
 (0)