Skip to content

Commit f4dc7e0

Browse files
authored
Merge 26dc7d4 into sapling-pr-archive-ktf
2 parents f9e545a + 26dc7d4 commit f4dc7e0

File tree

10 files changed

+104
-103
lines changed

10 files changed

+104
-103
lines changed

Detectors/ITSMFT/ITS/base/src/GeometryTGeo.cxx

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
#ifdef ENABLE_UPGRADES
2626
#include "ITS3Base/SpecsV2.h"
27-
#include "ITS3Base/SegmentationSuperAlpide.h"
28-
using SuperSegmentation = o2::its3::SegmentationSuperAlpide;
2927
#endif
3028

3129
#include <TGeoBBox.h> // for TGeoBBox
@@ -420,33 +418,20 @@ TGeoHMatrix* GeometryTGeo::extractMatrixSensor(int index) const
420418
static int chipInGlo{0};
421419

422420
// account for the difference between physical sensitive layer (where charge collection is simulated) and effective sensor thicknesses
421+
// in the ITS3 case this accounted by specialized functions
423422
double delta = Segmentation::SensorLayerThickness - Segmentation::SensorLayerThicknessEff;
424-
#ifdef ENABLE_UPGRADES
425-
if (mIsLayerITS3[getLayer(index)]) {
426-
delta = its3::SegmentationSuperAlpide::mSensorLayerThickness - its3::SegmentationSuperAlpide::mSensorLayerThicknessEff;
427-
}
428-
#endif
429-
430423
static TGeoTranslation tra(0., 0.5 * delta, 0.);
431-
424+
#ifdef ENABLE_UPGRADES // only apply for non ITS3 OB layers
425+
if (!mIsLayerITS3[getLayer(index)]) {
426+
matTmp *= tra;
427+
}
428+
#else
432429
matTmp *= tra;
430+
#endif
433431

434432
return &matTmp;
435433
}
436434

437-
//__________________________________________________________________________
438-
const o2::math_utils::Transform3D GeometryTGeo::getT2LMatrixITS3(int isn, float alpha)
439-
{
440-
// create for sensor isn the TGeo matrix for Tracking to Local frame transformations
441-
static TGeoHMatrix t2l;
442-
t2l.Clear();
443-
t2l.RotateZ(alpha * RadToDeg()); // rotate in direction of normal to the tangent to the cylinder
444-
const TGeoHMatrix& matL2G = getMatrixL2G(isn);
445-
const auto& matL2Gi = matL2G.Inverse();
446-
t2l.MultiplyLeft(&matL2Gi);
447-
return Mat3D(t2l);
448-
}
449-
450435
//__________________________________________________________________________
451436
void GeometryTGeo::Build(int loadTrans)
452437
{
@@ -492,23 +477,6 @@ void GeometryTGeo::Build(int loadTrans)
492477
mLastChipIndex[i] = numberOfChips - 1;
493478
}
494479

495-
LOGP(debug, "Summary of extracted Geometry:");
496-
LOGP(debug, " There are {} Layers and {} HalfBarrels", mNumberOfLayers, mNumberOfHalfBarrels);
497-
for (int i = 0; i < mNumberOfLayers; i++) {
498-
LOGP(debug, " Layer {}: {:*^30}", i, "START");
499-
LOGP(debug, " - mNumberOfStaves={}", mNumberOfStaves[i]);
500-
LOGP(debug, " - mNumberOfChipsPerStave={}", mNumberOfChipsPerStave[i]);
501-
LOGP(debug, " - mNumberOfHalfStaves={}", mNumberOfHalfStaves[i]);
502-
LOGP(debug, " - mNumberOfChipsPerHalfStave={}", mNumberOfChipsPerHalfStave[i]);
503-
LOGP(debug, " - mNumberOfModules={}", mNumberOfModules[i]);
504-
LOGP(debug, " - mNumberOfChipsPerModules={}", mNumberOfChipsPerModule[i]);
505-
LOGP(debug, " - mNumberOfChipsPerLayer={}", mNumberOfChipsPerLayer[i]);
506-
LOGP(debug, " - mNumberOfChipsPerHalfBarrel={}", mNumberOfChipsPerHalfBarrel[i]);
507-
LOGP(debug, " - mLastChipIndex={}", mLastChipIndex[i]);
508-
LOGP(debug, " Layer {}: {:*^30}", i, "END");
509-
}
510-
LOGP(debug, "In total there {} chips registered", numberOfChips);
511-
512480
#ifdef ENABLE_UPGRADES
513481
if (std::any_of(mIsLayerITS3.cbegin(), mIsLayerITS3.cend(), [](auto b) { return b; })) {
514482
LOGP(info, "Found active IT3 layers -> Renaming Detector ITS to IT3");
@@ -880,34 +848,39 @@ void GeometryTGeo::extractSensorXAlpha(int isn, float& x, float& alp)
880848

881849
const TGeoHMatrix* matL2G = extractMatrixSensor(isn);
882850
double locA[3] = {-100., 0., 0.}, locB[3] = {100., 0., 0.}, gloA[3], gloB[3];
883-
int iLayer = getLayer(isn);
851+
double xp{0}, yp{0};
884852

885853
#ifdef ENABLE_UPGRADES
886-
if (mIsLayerITS3[iLayer]) {
887-
// We need to calcualte the line tangent at the mid-point in the geometry
854+
if (int iLayer = getLayer(isn); mIsLayerITS3[iLayer]) {
855+
// For a TGeoTubeSeg the local coordinate system is defined at the origin
856+
// of the circle of the side, since in our implementation we rotated the geometry a bit
888857
const auto radius = o2::its3::constants::radii[iLayer];
889858
const auto phi1 = o2::its3::constants::tile::width / radius;
890859
const auto phi2 = o2::its3::constants::pixelarray::width / radius + phi1;
891860
const auto phi3 = (phi2 - phi1) / 2.; // mid-point in phi
892-
const auto x = radius * std::cos(phi3);
893-
const auto y = radius * std::sin(phi3);
894-
// For the tangent we make the parametric line equation y = m * x - c
895-
const auto m = x / y;
896-
const auto c = y - m * x;
897-
// Now we can given any x calulate points along this line, we pick points far away,
898-
// the calculation of the normal should work then below.
899-
locA[1] = m * locA[0] + c;
900-
locB[1] = m * locB[0] + c;
901-
}
902-
#endif
903-
861+
locA[0] = radius * std::cos(phi3);
862+
locA[1] = radius * std::sin(phi3);
863+
matL2G->LocalToMaster(locA, gloA);
864+
xp = gloA[0];
865+
yp = gloA[1];
866+
} else {
867+
matL2G->LocalToMaster(locA, gloA);
868+
matL2G->LocalToMaster(locB, gloB);
869+
double dx = gloB[0] - gloA[0], dy = gloB[1] - gloA[1];
870+
double t = (gloB[0] * dx + gloB[1] * dy) / (dx * dx + dy * dy);
871+
xp = gloB[0] - dx * t;
872+
yp = gloB[1] - dy * t;
873+
}
874+
#else // just ITS2 part
904875
matL2G->LocalToMaster(locA, gloA);
905876
matL2G->LocalToMaster(locB, gloB);
906877
double dx = gloB[0] - gloA[0], dy = gloB[1] - gloA[1];
907878
double t = (gloB[0] * dx + gloB[1] * dy) / (dx * dx + dy * dy);
908-
double xp = gloB[0] - dx * t, yp = gloB[1] - dy * t;
909-
x = Sqrt(xp * xp + yp * yp);
910-
alp = ATan2(yp, xp);
879+
xp = gloB[0] - dx * t;
880+
yp = gloB[1] - dy * t;
881+
#endif
882+
x = std::hypot(xp, yp);
883+
alp = std::atan2(yp, xp);
911884
o2::math_utils::bringTo02Pi(alp);
912885
}
913886

@@ -926,6 +899,19 @@ TGeoHMatrix& GeometryTGeo::createT2LMatrix(int isn)
926899
return t2l;
927900
}
928901

902+
//__________________________________________________________________________
903+
const o2::math_utils::Transform3D GeometryTGeo::getT2LMatrixITS3(int isn, float alpha)
904+
{
905+
// create for sensor isn the TGeo matrix for Tracking to Local frame transformations with correction for effective thickness
906+
static TGeoHMatrix t2l;
907+
t2l.Clear();
908+
t2l.RotateZ(alpha * RadToDeg()); // rotate in direction of normal to the tangent to the cylinder
909+
const TGeoHMatrix& matL2G = getMatrixL2G(isn);
910+
const auto& matL2Gi = matL2G.Inverse();
911+
t2l.MultiplyLeft(&matL2Gi);
912+
return Mat3D(t2l);
913+
}
914+
929915
//__________________________________________________________________________
930916
int GeometryTGeo::extractVolumeCopy(const char* name, const char* prefix) const
931917
{

Detectors/ITSMFT/ITS/simulation/src/Detector.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Detector::Detector(Bool_t active, TString name)
190190
} else {
191191
mLayerName[j].Form("%s%d", GeometryTGeo::getITSSensorPattern(), j); // See V3Layer
192192
}
193-
LOGP(info, "{}: mLayerName={}", j, mLayerName[j].Data());
193+
LOGP(debug, "{}: mLayerName={}", j, mLayerName[j].Data());
194194
}
195195

196196
if (mNumberLayers > 0) { // if not, we'll Fatal-ize in CreateGeometry
@@ -723,8 +723,8 @@ void Detector::defineLayer(Int_t nlay, Double_t phi0, Double_t r, Int_t nstav, I
723723
// Return:
724724
// none.
725725

726-
LOG(info) << "L# " << nlay << " Phi:" << phi0 << " R:" << r << " Nst:" << nstav << " Nunit:" << nunit
727-
<< " Lthick:" << lthick << " Dthick:" << dthick << " DetID:" << dettypeID << " B:" << buildLevel;
726+
LOG(debug) << "L# " << nlay << " Phi:" << phi0 << " R:" << r << " Nst:" << nstav << " Nunit:" << nunit
727+
<< " Lthick:" << lthick << " Dthick:" << dthick << " DetID:" << dettypeID << " B:" << buildLevel;
728728

729729
if (nlay >= mNumberLayers || nlay < 0) {
730730
LOG(error) << "Wrong layer number " << nlay;

Detectors/ITSMFT/common/data/AlpideResponseData/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DI
2020

2121
if(ITSRESPONSE)
2222
message(STATUS "ITSRESPONSE option provided, setting ITSRESPONSE_DIR from it: " ${ITSRESPONSE})
23-
set(ITSRESPONSE_DIR ${ITSRESPONSE})
23+
set(ITSRESPONSE_DIR ${ITSRESPONSE} CACHE PATH "ITSResponse directory")
2424
else()
2525
message(STATUS "ITSRESPONSE option not provided, setting ITSRESPONSE_DIR from environment ITSRESPONSE_ROOT: " $ENV{ITSRESPONSE_ROOT})
26-
set(ITSRESPONSE_DIR $ENV{ITSRESPONSE_ROOT})
26+
set(ITSRESPONSE_DIR $ENV{ITSRESPONSE_ROOT} CACHE PATH "ITSResponse directory")
2727
endif()
2828

2929
add_custom_command(TARGET O2exe-alpide-response-generator POST_BUILD

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/DigiParams.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,18 @@ class DigiParams
9696
const SignalShape& getSignalShape() const { return mSignalShape; }
9797
SignalShape& getSignalShape() { return (SignalShape&)mSignalShape; }
9898

99-
void print() const;
99+
virtual void print() const;
100100

101101
private:
102102
static constexpr double infTime = 1e99;
103-
bool mIsContinuous = false; ///< flag for continuous simulation
104-
float mNoisePerPixel = 1.e-8; ///< ALPIDE Noise per chip
105-
int mROFrameLengthInBC = 0; ///< ROF length in BC for continuos mode
106-
float mROFrameLength = 0; ///< length of RO frame in ns
107-
float mStrobeDelay = 0.; ///< strobe start (in ns) wrt ROF start
108-
float mStrobeLength = 0; ///< length of the strobe in ns (sig. over threshold checked in this window only)
109-
double mTimeOffset = -2 * infTime; ///< time offset (in seconds!) to calculate ROFrame from hit time
110-
int mROFrameBiasInBC = 0; ///< misalignment of the ROF start in BC
103+
bool mIsContinuous = false; ///< flag for continuous simulation
104+
float mNoisePerPixel = 1.e-8; ///< ALPIDE Noise per chip
105+
int mROFrameLengthInBC = 0; ///< ROF length in BC for continuos mode
106+
float mROFrameLength = 0; ///< length of RO frame in ns
107+
float mStrobeDelay = 0.; ///< strobe start (in ns) wrt ROF start
108+
float mStrobeLength = 0; ///< length of the strobe in ns (sig. over threshold checked in this window only)
109+
double mTimeOffset = -2 * infTime; ///< time offset (in seconds!) to calculate ROFrame from hit time
110+
int mROFrameBiasInBC = 0; ///< misalignment of the ROF start in BC
111111
int mChargeThreshold = 150; ///< charge threshold in Nelectrons
112112
int mMinChargeToAccount = 15; ///< minimum charge contribution to account
113113
int mNSimSteps = 7; ///< number of steps in response simulation
@@ -125,7 +125,7 @@ class DigiParams
125125
float mROFrameLengthInv = 0; ///< inverse length of RO frame in ns
126126
float mNSimStepsInv = 0; ///< its inverse
127127

128-
ClassDefNV(DigiParams, 2);
128+
ClassDef(DigiParams, 2);
129129
};
130130
} // namespace itsmft
131131
} // namespace o2

Framework/Utils/include/DPLUtils/DPLRawPageSequencer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class DPLRawPageSequencer
191191
}
192192

193193
private:
194-
InputRecordWalker mInput;
194+
InputRecordWalker<> mInput;
195195

196196
template <typename Predicate, typename Inserter>
197197
void forwardInternal(Predicate pred, Inserter inserter, const char* data, size_t size, const o2::header::DataHeader* dh)

Utilities/DataSampling/include/DataSampling/DataSamplingHeader.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ struct DataSamplingHeader : public header::BaseHeader {
4141
uint32_t totalEvaluatedMessages = 0;
4242
DeviceIDType deviceID = "";
4343

44-
DataSamplingHeader();
45-
DataSamplingHeader(uint64_t _sampleTimeUs, uint32_t _totalAcceptedMessages, uint32_t _totalEvaluatedMessages, DeviceIDType _deviceID);
44+
/// Presampled description for the data. Copied from the original DataHeader.
45+
header::DataDescription dataDescription;
46+
/// Presampled origin for the data. Copied from the original DataHeader.
47+
header::DataOrigin dataOrigin;
48+
/// Presampled subSpecification for the data.
49+
header::DataHeader::SubSpecificationType subSpecification;
50+
51+
DataSamplingHeader() = delete;
52+
DataSamplingHeader(uint64_t _sampleTimeUs, uint32_t _totalAcceptedMessages, uint32_t _totalEvaluatedMessages, DeviceIDType _deviceID, header::DataHeader const&original);
4653
DataSamplingHeader(const DataSamplingHeader&) = default;
4754
DataSamplingHeader& operator=(const DataSamplingHeader&) = default;
4855

Utilities/DataSampling/include/DataSampling/Dispatcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Dispatcher : public framework::Task
6464
framework::Options getOptions();
6565

6666
private:
67-
DataSamplingHeader prepareDataSamplingHeader(const DataSamplingPolicy& policy);
67+
DataSamplingHeader prepareDataSamplingHeader(const DataSamplingPolicy& policy, header::DataHeader const& original);
6868
header::Stack extractAdditionalHeaders(const char* inputHeaderStack) const;
6969
void reportStats(monitoring::Monitoring& monitoring) const;
7070
void send(framework::DataAllocator& dataAllocator, const framework::DataRef& inputData, const framework::Output& output) const;

Utilities/DataSampling/src/DataSamplingHeader.cxx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@
1919
namespace o2::utilities
2020
{
2121

22-
DataSamplingHeader::DataSamplingHeader() : BaseHeader(sizeof(DataSamplingHeader), sHeaderType, sSerializationMethod, sVersion)
23-
{
24-
}
25-
26-
DataSamplingHeader::DataSamplingHeader(uint64_t _sampleTimeUs, uint32_t _totalAcceptedMessages, uint32_t _totalEvaluatedMessages, DeviceIDType _deviceID)
22+
DataSamplingHeader::DataSamplingHeader(uint64_t _sampleTimeUs, uint32_t _totalAcceptedMessages, uint32_t _totalEvaluatedMessages, DeviceIDType _deviceID, header::DataHeader const&_original)
2723
: BaseHeader(sizeof(DataSamplingHeader), sHeaderType, sSerializationMethod, sVersion),
2824
sampleTimeUs(_sampleTimeUs),
2925
totalAcceptedMessages(_totalAcceptedMessages),
3026
totalEvaluatedMessages(_totalEvaluatedMessages),
31-
deviceID(_deviceID)
27+
deviceID(_deviceID),
28+
dataDescription(_original.dataDescription),
29+
dataOrigin(_original.dataOrigin),
30+
subSpecification(_original.subSpecification)
3231
{
3332
}
3433

@@ -42,4 +41,4 @@ const uint32_t o2::utilities::DataSamplingHeader::sVersion = 1;
4241
const o2::header::HeaderType o2::utilities::DataSamplingHeader::sHeaderType = header::String2<uint64_t>("DataSamp");
4342
const o2::header::SerializationMethod o2::utilities::DataSamplingHeader::sSerializationMethod = o2::header::gSerializationMethodNone;
4443

45-
} // namespace o2::utilities
44+
} // namespace o2::utilities

Utilities/DataSampling/src/Dispatcher.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void Dispatcher::run(ProcessingContext& ctx)
9999
// a "TST/RAWDATA/*" output.
100100
if (auto route = policy->match(inputMatcher); route != nullptr && policy->decide(firstPart)) {
101101
auto routeAsConcreteDataType = DataSpecUtils::asConcreteDataTypeMatcher(*route);
102-
auto dsheader = prepareDataSamplingHeader(*policy);
102+
auto dsheader = prepareDataSamplingHeader(*policy, *firstInputHeader);
103103
for (const auto& part : inputIt) {
104104
if (part.header != nullptr) {
105105
// We copy every header which is not DataHeader or DataProcessingHeader,
@@ -144,15 +144,16 @@ void Dispatcher::reportStats(Monitoring& monitoring) const
144144
monitoring.send(Metric{dispatcherTotalAcceptedMessages, "Dispatcher_messages_passed", Verbosity::Prod}.addTag(tags::Key::Subsystem, tags::Value::DataSampling));
145145
}
146146

147-
DataSamplingHeader Dispatcher::prepareDataSamplingHeader(const DataSamplingPolicy& policy)
147+
DataSamplingHeader Dispatcher::prepareDataSamplingHeader(const DataSamplingPolicy& policy, header::DataHeader const& original)
148148
{
149149
uint64_t sampleTime = static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
150150

151151
return {
152152
sampleTime,
153153
policy.getTotalAcceptedMessages(),
154154
policy.getTotalEvaluatedMessages(),
155-
mDeviceID};
155+
mDeviceID,
156+
original};
156157
}
157158

158159
header::Stack Dispatcher::extractAdditionalHeaders(const char* inputHeaderStack) const

0 commit comments

Comments
 (0)