Skip to content

Commit bf081c9

Browse files
authored
ITS3: fix topologydict generation + load APTS (#14330)
* ITS3: fix loading APTS repsonse function * ITS3: fix topologydict generation * ITS3: add braces and some reordering in ChipDigitsContainer
1 parent b0d3802 commit bf081c9

File tree

8 files changed

+46
-34
lines changed

8 files changed

+46
-34
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class AlpideSimResponse
114114

115115
public:
116116
AlpideSimResponse() = default;
117-
~AlpideSimResponse() = default;
117+
virtual ~AlpideSimResponse() = default;
118118

119119
void initData(int tableNumber, std::string dataPath, const bool quiet = true);
120120

@@ -145,7 +145,7 @@ class AlpideSimResponse
145145
const std::string& getColRowDataFmt() const { return mColRowDataFmt; }
146146
void print() const;
147147

148-
ClassDefNV(AlpideSimResponse, 2);
148+
ClassDef(AlpideSimResponse, 2);
149149
};
150150

151151
//-----------------------------------------------------

Detectors/Upgrades/ITS3/macros/test/CreateDictionariesITS3.C

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,16 @@ void CreateDictionariesITS3(bool saveDeltas = true,
280280
mMosaixSegmentations[layer].curvedToFlat(locC.X(), locC.Y(), xFlat, yFlat);
281281
locC.SetCoordinates(xFlat, yFlat, locC.Z());
282282
}
283+
284+
auto pitchX = (ib) ? o2::its3::SegmentationMosaix::PitchRow : o2::itsmft::SegmentationAlpide::PitchRow;
285+
auto pitchZ = (ib) ? o2::its3::SegmentationMosaix::PitchCol : o2::itsmft::SegmentationAlpide::PitchCol;
283286
dX = xyzLocM.X() - locC.X();
284287
dZ = xyzLocM.Z() - locC.Z();
285-
dX /= (ib) ? o2::its3::SegmentationMosaix::PitchRow : o2::itsmft::SegmentationAlpide::PitchRow;
286-
dZ /= (ib) ? o2::its3::SegmentationMosaix::PitchCol : o2::itsmft::SegmentationAlpide::PitchCol;
287288

288289
float outLimitDx{-1}, outLimitDz{-1};
289290
if (checkOutliers > 0.) {
290-
outLimitDx = topology.getRowSpan() * checkOutliers;
291-
outLimitDz = topology.getColumnSpan() * checkOutliers;
291+
outLimitDx = topology.getRowSpan() * checkOutliers * pitchX;
292+
outLimitDz = topology.getColumnSpan() * checkOutliers * pitchZ;
292293
bool isOutDx = std::abs(dX) > outLimitDx;
293294
bool isOutDz = std::abs(dZ) > outLimitDz;
294295
if (isOutDx || isOutDz) { // ignore outlier

Detectors/Upgrades/ITS3/reconstruction/src/BuildTopologyDictionary.cxx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ void BuildTopologyDictionary::accountTopologyImpl(const itsmft::ClusterTopology&
4040
++tot;
4141
bool useDf = dX < IgnoreVal / 2; // we may need to account the frequency but to not update the centroid
4242

43-
// std::pair<unordered_map<unsigned long, itsmft::TopoStat>::iterator,bool> ret;
44-
// auto ret = mTopologyMap.insert(std::make_pair(cluster.getHash(), std::make_pair(cluster, 1)));
4543
auto& topoStat = tstat[cluster.getHash()];
4644
topoStat.countsTotal++;
4745
if (topoStat.countsTotal == 1) { // a new topology is inserted
@@ -59,7 +57,7 @@ void BuildTopologyDictionary::accountTopologyImpl(const itsmft::ClusterTopology&
5957
topoStat.countsWithBias = 1;
6058
} else { // assign expected sigmas from the pixel X, Z sizes
6159
topInf.mXsigma2 = sigmaX * sigmaX / 12.f / (float)std::min(10, topInf.mSizeX);
62-
topInf.mZsigma2 = sigmaZ * sigmaZ / (float)std::min(10, topInf.mSizeZ);
60+
topInf.mZsigma2 = sigmaZ * sigmaZ / 12.f / (float)std::min(10, topInf.mSizeZ);
6361
}
6462
tinfo.emplace(cluster.getHash(), topInf);
6563
} else {
@@ -128,7 +126,7 @@ void BuildTopologyDictionary::setThresholdImpl(double thr, TopoFreq& tfreq, Topo
128126
{
129127
setNCommonImpl(0, tfreq, tstat, ncommon, ntot);
130128
freqthres = thr;
131-
for (auto& q : tfreq) {
129+
for (const auto& q : tfreq) {
132130
if (((double)q.first) / ntot > thr) {
133131
++ncommon;
134132
} else {
@@ -205,7 +203,7 @@ void BuildTopologyDictionary::groupRareTopologiesImpl(TopoFreq& tfreq, TopoInfo&
205203
gr.mHash = tfreq[j].second;
206204
gr.mFrequency = ((double)(tfreq[j].first)) / ntot;
207205
totFreq += gr.mFrequency;
208-
// rough estimation for the error considering a8 uniform distribution
206+
// rough estimation for the error considering a uniform distribution
209207
const auto& topo = tinfo.find(gr.mHash)->second;
210208
gr.mErrX = std::sqrt(topo.mXsigma2);
211209
gr.mErrZ = std::sqrt(topo.mZsigma2);

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ChipDigitsContainer.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,18 @@
1212
#ifndef ALICEO2_ITS3_CHIPDIGITSCONTAINER_
1313
#define ALICEO2_ITS3_CHIPDIGITSCONTAINER_
1414

15-
#include "ITSMFTBase/SegmentationAlpide.h" // Base class in o2::itsmft namespace
16-
#include "ITSMFTSimulation/ChipDigitsContainer.h" // Base class in o2::itsmft namespace
17-
#include "ITS3Base/SegmentationMosaix.h" // OB segmentation implementation
18-
#include "ITS3Base/SpecsV2.h" // Provides SpecsV2::isDetITS3() interface
19-
#include "ITS3Simulation/DigiParams.h" // ITS3-specific DigiParams interface
15+
#include "ITSMFTBase/SegmentationAlpide.h"
16+
#include "ITSMFTSimulation/ChipDigitsContainer.h"
17+
#include "ITS3Base/SegmentationMosaix.h"
18+
#include "ITS3Base/SpecsV2.h"
19+
#include "ITS3Simulation/DigiParams.h"
2020
#include <TRandom.h>
2121

2222
namespace o2::its3
2323
{
2424

2525
class ChipDigitsContainer : public o2::itsmft::ChipDigitsContainer
2626
{
27-
private:
28-
bool innerBarrel; ///< true if the chip belongs to the inner barrel (IB), false if outer barrel (OB)
29-
int maxRows; ///< maximum number of rows
30-
int maxCols; ///< maximum number of columns
31-
3227
public:
3328
explicit ChipDigitsContainer(UShort_t idx = 0);
3429

@@ -51,9 +46,14 @@ class ChipDigitsContainer : public o2::itsmft::ChipDigitsContainer
5146
void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::itsmft::DigiParams* params, int maxRows = o2::itsmft::SegmentationAlpide::NRows, int maxCols = o2::itsmft::SegmentationAlpide::NCols) = delete;
5247
void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::its3::DigiParams* params);
5348

49+
private:
50+
bool innerBarrel{false}; ///< true if the chip belongs to the inner barrel (IB), false if outer barrel (OB)
51+
int maxRows{-1}; ///< maximum number of rows
52+
int maxCols{-1}; ///< maximum number of columns
53+
5454
ClassDefNV(ChipDigitsContainer, 1);
5555
};
5656

5757
} // namespace o2::its3
5858

59-
#endif // ALICEO2_ITS3_CHIPDIGITSCONTAINER_
59+
#endif // ALICEO2_ITS3_CHIPDIGITSCONTAINER_

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ChipSimResponse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ChipSimResponse : public o2::itsmft::AlpideSimResponse
2424
public:
2525
ChipSimResponse() = default;
2626
ChipSimResponse(const ChipSimResponse& other) = default;
27+
ChipSimResponse(const o2::itsmft::AlpideSimResponse* base) : o2::itsmft::AlpideSimResponse(*base) {}
2728

2829
float getRespCentreDep() const { return mRespCentreDep; }
2930
void computeCentreFromData();

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class Digitizer : public TObject
4242
using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; ///< container for extra contributions to PreDigits
4343

4444
public:
45+
~Digitizer();
46+
4547
void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
4648
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
4749
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }

Detectors/Upgrades/ITS3/simulation/src/ChipDigitsContainer.cxx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111

1212
#include "ITS3Simulation/ChipDigitsContainer.h"
1313

14-
namespace o2
15-
{
16-
namespace its3
17-
{
14+
using namespace o2::its3;
1815

1916
ChipDigitsContainer::ChipDigitsContainer(UShort_t idx)
2017
: o2::itsmft::ChipDigitsContainer(idx) {}
@@ -48,16 +45,17 @@ void ChipDigitsContainer::addNoise(UInt_t rofMin, UInt_t rofMax, const o2::its3:
4845
for (Int_t i = 0; i < nhits; ++i) {
4946
row = gRandom->Integer(maxRows);
5047
col = gRandom->Integer(maxCols);
51-
if (mNoiseMap && mNoiseMap->isNoisy(mChipIndex, row, col))
48+
if (mNoiseMap && mNoiseMap->isNoisy(mChipIndex, row, col)) {
5249
continue;
53-
if (mDeadChanMap && mDeadChanMap->isNoisy(mChipIndex, row, col))
50+
}
51+
if (mDeadChanMap && mDeadChanMap->isNoisy(mChipIndex, row, col)) {
5452
continue;
53+
}
5554
auto key = getOrderingKey(rof, row, col);
56-
if (!findDigit(key))
55+
if (!findDigit(key)) {
5756
addDigit(key, rof, row, col, nel, o2::MCCompLabel(true));
57+
}
5858
}
5959
}
6060
}
61-
62-
} // namespace its3
63-
} // namespace o2
61+
// namespace its3

Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/// \file Digitizer.cxx
1313
/// \brief Implementation of the ITS3 digitizer
1414

15+
#include "ITS3Simulation/ChipSimResponse.h"
1516
#include "ITSMFTBase/SegmentationAlpide.h"
1617
#include "ITS3Simulation/Digitizer.h"
1718
#include "ITS3Base/ITS3Params.h"
@@ -34,6 +35,11 @@ using o2::itsmft::PreDigit;
3435

3536
using namespace o2::its3;
3637

38+
Digitizer::~Digitizer()
39+
{
40+
delete mSimRespIB;
41+
}
42+
3743
void Digitizer::init()
3844
{
3945
const int numOfChips = mGeometry->getNumberOfChips();
@@ -57,8 +63,14 @@ void Digitizer::init()
5763
if (!fOB || fOB->IsZombie() || !fOB->IsOpen()) {
5864
LOGP(fatal, "Cannot open file {}", fileOB);
5965
}
60-
mParams.setIBSimResponse(mSimRespIB = fIB->Get<o2::its3::ChipSimResponse>(nameIB));
61-
mParams.setOBSimResponse(mSimRespOB = fOB->Get<o2::itsmft::AlpideSimResponse>(nameOB));
66+
if ((mSimRespIB = new o2::its3::ChipSimResponse(fIB->Get<o2::itsmft::AlpideSimResponse>(nameIB))) == nullptr) {
67+
LOGP(fatal, "Cannot create response function for IB");
68+
}
69+
if ((mSimRespOB = fOB->Get<o2::itsmft::AlpideSimResponse>(nameOB)) == nullptr) {
70+
LOGP(fatal, "Cannot create response function for OB");
71+
}
72+
mParams.setIBSimResponse(mSimRespIB);
73+
mParams.setOBSimResponse(mSimRespOB);
6274
fIB->Close();
6375
fOB->Close();
6476
};

0 commit comments

Comments
 (0)