Skip to content

Commit c7a1608

Browse files
authored
Merge c6a01d6 into sapling-pr-archive-ktf
2 parents b97a39b + c6a01d6 commit c7a1608

File tree

9 files changed

+165
-101
lines changed

9 files changed

+165
-101
lines changed

Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -514,34 +514,34 @@ void VertexerTraits<nLayers>::addTruthSeedingVertices()
514514
bounded_vector<int> events;
515515
};
516516
std::map<int, VertInfo> vertices;
517-
for (int iSrc{0}; iSrc < mcReader.getNSources(); ++iSrc) {
518-
auto eveId2colId = dc->getCollisionIndicesForSource(iSrc);
519-
for (int iEve{0}; iEve < mcReader.getNEvents(iSrc); ++iEve) {
520-
const auto& ir = irs[eveId2colId[iEve]];
521-
if (!ir.isDummy()) { // do we need this, is this for diffractive events?
522-
const auto& eve = mcReader.getMCEventHeader(iSrc, iEve);
523-
int rofId = ((ir - raw::HBFUtils::Instance().getFirstSampledTFIR()).toLong() - roFrameBiasInBC) / roFrameLengthInBC;
524-
if (!vertices.contains(rofId)) {
525-
vertices[rofId] = {
526-
.vertices = bounded_vector<Vertex>(mMemoryPool.get()),
527-
.srcs = bounded_vector<int>(mMemoryPool.get()),
528-
.events = bounded_vector<int>(mMemoryPool.get()),
529-
};
530-
}
531-
Vertex vert;
532-
vert.setTimeStamp(rofId);
533-
vert.setNContributors(std::ranges::count_if(mcReader.getTracks(iSrc, iEve), [](const auto& trk) {
534-
return trk.isPrimary() && trk.GetPt() > 0.2 && std::abs(trk.GetEta()) < 1.3;
535-
}));
536-
vert.setXYZ((float)eve.GetX(), (float)eve.GetY(), (float)eve.GetZ());
537-
vert.setChi2(1);
538-
constexpr float cov = 50e-9;
539-
vert.setCov(cov, cov, cov, cov, cov, cov);
540-
vertices[rofId].vertices.push_back(vert);
541-
vertices[rofId].srcs.push_back(iSrc);
542-
vertices[rofId].events.push_back(iEve);
517+
const int iSrc = 0; // take only events from collision generator
518+
auto eveId2colId = dc->getCollisionIndicesForSource(iSrc);
519+
for (int iEve{0}; iEve < mcReader.getNEvents(iSrc); ++iEve) {
520+
const auto& ir = irs[eveId2colId[iEve]];
521+
if (!ir.isDummy()) { // do we need this, is this for diffractive events?
522+
const auto& eve = mcReader.getMCEventHeader(iSrc, iEve);
523+
int rofId = ((ir - raw::HBFUtils::Instance().getFirstSampledTFIR()).toLong() - roFrameBiasInBC) / roFrameLengthInBC;
524+
if (!vertices.contains(rofId)) {
525+
vertices[rofId] = {
526+
.vertices = bounded_vector<Vertex>(mMemoryPool.get()),
527+
.srcs = bounded_vector<int>(mMemoryPool.get()),
528+
.events = bounded_vector<int>(mMemoryPool.get()),
529+
};
543530
}
531+
Vertex vert;
532+
vert.setTimeStamp(rofId);
533+
vert.setNContributors(std::ranges::count_if(mcReader.getTracks(iSrc, iEve), [](const auto& trk) {
534+
return trk.isPrimary() && trk.GetPt() > 0.2 && std::abs(trk.GetEta()) < 1.3;
535+
}));
536+
vert.setXYZ((float)eve.GetX(), (float)eve.GetY(), (float)eve.GetZ());
537+
vert.setChi2(1);
538+
constexpr float cov = 50e-9;
539+
vert.setCov(cov, cov, cov, cov, cov, cov);
540+
vertices[rofId].vertices.push_back(vert);
541+
vertices[rofId].srcs.push_back(iSrc);
542+
vertices[rofId].events.push_back(iEve);
544543
}
544+
mcReader.releaseTracksForSourceAndEvent(iSrc, iEve);
545545
}
546546
size_t nVerts{0};
547547
for (int iROF{0}; iROF < mTimeFrame->getNrof(); ++iROF) {

Detectors/Upgrades/ALICE3/ECal/base/include/ECalBase/Geometry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class Geometry
6161
double getSamplingAlpha() { return mSamplingAlpha; }
6262
double getCrystalDeltaPhi() { return 2 * std::atan(mCrystalModW / 2 / mRMin); }
6363
double getSamplingDeltaPhi() { return 2 * std::atan(mSamplingModW / 2 / mRMin); }
64+
double getFrontFaceMaxEta(int i);
6465
double getCrystalPhiMin();
6566
double getSamplingPhiMin();
6667
int getNModulesZ() { return mNModulesZ; }

Detectors/Upgrades/ALICE3/ECal/base/src/Geometry.cxx

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,18 @@ double Geometry::getSamplingPhiMin()
7373
return (superModuleDeltaPhi - samplingDeltaPhi * mNSamplingModulesPhi) / 2.;
7474
}
7575

76+
double Geometry::getFrontFaceMaxEta(int i)
77+
{
78+
double theta = std::atan(mRMin / getFrontFaceZatMinR(i));
79+
return -std::log(std::tan(theta / 2.));
80+
}
81+
7682
//==============================================================================
7783
void Geometry::fillFrontFaceCenterCoordinates()
7884
{
79-
if (mFrontFaceCenterR.size() > 0)
85+
if (mFrontFaceCenterR.size() > 0) {
8086
return;
87+
}
8188
mFrontFaceCenterTheta.resize(mNCrystalModulesZ + mNSamplingModulesZ);
8289
mFrontFaceZatMinR.resize(mNCrystalModulesZ + mNSamplingModulesZ);
8390
mFrontFaceCenterR.resize(mNCrystalModulesZ + mNSamplingModulesZ);
@@ -153,7 +160,7 @@ int Geometry::getCellID(int moduleId, int sectorId, bool isCrystal)
153160
if (sectorId % 2 == 0) { // sampling at positive eta
154161
cellID = sectorId / 2 * mNModulesZ + moduleId + mNSamplingModulesZ + mNCrystalModulesZ * 2;
155162
} else { // sampling at negative eta
156-
cellID = sectorId / 2 * mNModulesZ - moduleId + mNSamplingModulesZ;
163+
cellID = sectorId / 2 * mNModulesZ - moduleId + mNSamplingModulesZ - 1;
157164
}
158165
}
159166
return cellID;
@@ -206,13 +213,15 @@ void Geometry::detIdToGlobalPosition(int detId, double& x, double& y, double& z)
206213
{
207214
int chamber, sector, iphi, iz;
208215
detIdToRelIndex(detId, chamber, sector, iphi, iz);
216+
double r = 0;
209217
if (iz < mNSamplingModulesZ + mNCrystalModulesZ) {
210218
z = -mFrontFaceCenterZ[mNSamplingModulesZ + mNCrystalModulesZ - iz - 1];
219+
r = mFrontFaceCenterR[mNSamplingModulesZ + mNCrystalModulesZ - iz - 1];
211220
} else {
212-
z = +mFrontFaceCenterZ[iz % (mNSamplingModulesZ + mNCrystalModulesZ)];
221+
z = mFrontFaceCenterZ[iz % (mNSamplingModulesZ + mNCrystalModulesZ)];
222+
r = mFrontFaceCenterR[iz % (mNSamplingModulesZ + mNCrystalModulesZ)];
213223
}
214224
double phi = chamber == 1 ? mFrontFaceCenterCrystalPhi[iphi] : mFrontFaceCenterSamplingPhi[iphi];
215-
double r = mFrontFaceCenterR[iz % (mNSamplingModulesZ + mNCrystalModulesZ)];
216225
x = r * std::cos(phi);
217226
y = r * std::sin(phi);
218227
}
@@ -224,40 +233,45 @@ int Geometry::areNeighboursVertex(int detId1, int detId2) const
224233
int ch2, sector2, iphi2, iz2;
225234
detIdToRelIndex(detId1, ch1, sector1, iphi1, iz1);
226235
detIdToRelIndex(detId2, ch2, sector2, iphi2, iz2);
227-
if (sector1 != sector2 || ch1 != ch2)
236+
if (sector1 != sector2 || ch1 != ch2) {
228237
return 0;
229-
if (std::abs(iphi1 - iphi2) <= 1 && std::abs(iz1 - iz2) <= 1)
238+
}
239+
if (std::abs(iphi1 - iphi2) <= 1 && std::abs(iz1 - iz2) <= 1) {
230240
return 1;
241+
}
231242
return 0;
232243
}
233244

234245
//==============================================================================
235246
bool Geometry::isAtTheEdge(int cellId)
236247
{
237248
auto [row, col] = globalRowColFromIndex(cellId);
238-
if (col == 0)
249+
if (col == 0) {
239250
return 1;
240-
if (col == mNSamplingModulesZ)
251+
} else if (col == mNSamplingModulesZ) {
241252
return 1;
242-
if (col == mNSamplingModulesZ - 1)
253+
} else if (col == mNSamplingModulesZ - 1) {
243254
return 1;
244-
if (col == mNSamplingModulesZ + 2 * mNCrystalModulesZ)
255+
} else if (col == mNSamplingModulesZ + 2 * mNCrystalModulesZ) {
245256
return 1;
246-
if (col == mNSamplingModulesZ + 2 * mNCrystalModulesZ - 1)
257+
} else if (col == mNSamplingModulesZ + 2 * mNCrystalModulesZ - 1) {
247258
return 1;
248-
if (col == mNModulesZ - 1)
259+
} else if (col == mNModulesZ - 1) {
249260
return 1;
261+
}
250262
for (int m = 0; m <= mNSuperModules; m++) {
251263
if (isCrystal(cellId)) {
252-
if (row == m * mNCrystalModulesPhi)
264+
if (row == m * mNCrystalModulesPhi) {
253265
return 1;
254-
if (row == m * mNCrystalModulesPhi - 1)
266+
} else if (row == m * mNCrystalModulesPhi - 1) {
255267
return 1;
268+
}
256269
} else {
257-
if (row == m * mNSamplingModulesPhi)
270+
if (row == m * mNSamplingModulesPhi) {
258271
return 1;
259-
if (row == m * mNSamplingModulesPhi - 1)
272+
} else if (row == m * mNSamplingModulesPhi - 1) {
260273
return 1;
274+
}
261275
}
262276
}
263277
return 0;

Detectors/Upgrades/ALICE3/ECal/reconstruction/include/ECalReconstruction/Clusterizer.h

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,33 @@ class Clusterizer
4848
void setClusteringThreshold(double threshold) { mClusteringThreshold = threshold; }
4949
void setCrystalDigitThreshold(double threshold) { mCrystalDigitThreshold = threshold; }
5050
void setSamplingDigitThreshold(double threshold) { mSamplingDigitThreshold = threshold; }
51+
void setCrystalEnergyCorrectionPars(std::vector<double> pars) { mCrystalEnergyCorrectionPars = pars; }
52+
void setSamplingEnergyCorrectionPars(std::vector<double> pars) { mSamplingEnergyCorrectionPars = pars; }
53+
void setCrystalZCorrectionPars(std::vector<double> pars) { mCrystalZCorrectionPars = pars; }
54+
void setSamplingZCorrectionPars(std::vector<double> pars) { mSamplingZCorrectionPars = pars; }
5155

5256
private:
53-
std::vector<std::vector<int>> mDigitIndices; // 2D map of digit indices used for recursive cluster finding
54-
bool mUnfoldClusters = true; // to perform cluster unfolding
55-
double mCrystalDigitThreshold = 0.040; // minimal energy of crystal digit
56-
double mSamplingDigitThreshold = 0.100; // minimal energy of sampling digit
57-
double mClusteringThreshold = 0.050; // minimal energy of digit to start clustering (GeV)
58-
double mClusteringTimeGate = 1e9; // maximal time difference between digits to be accepted to clusters (in ns)
59-
int mNLMMax = 30; // maximal number of local maxima in unfolding
60-
double mLogWeight = 4.; // cutoff used in log. weight calculation
61-
double mUnfogingEAccuracy = 1.e-4; // accuracy of energy calculation in unfoding prosedure (GeV)
62-
double mUnfogingXZAccuracy = 1.e-2; // accuracy of position calculation in unfolding procedure (cm)
63-
int mNMaxIterations = 100; // maximal number of iterations in unfolding procedure
64-
double mLocalMaximumCut = 0.015; // minimal height of local maximum over neighbours
65-
bool mApplyCorrectionZ = 1; // z-correction
66-
bool mApplyCorrectionE = 1; // energy-correction
67-
TF1* fCrystalShowerShape; //! Crystal shower shape
68-
TF1* fSamplingShowerShape; //! Sampling shower shape
69-
TF1* fCrystalRMS; //! Crystal RMS
57+
std::vector<std::vector<int>> mDigitIndices; // 2D map of digit indices used for recursive cluster finding
58+
bool mUnfoldClusters = true; // to perform cluster unfolding
59+
double mCrystalDigitThreshold = 0.040; // minimal energy of crystal digit
60+
double mSamplingDigitThreshold = 0.100; // minimal energy of sampling digit
61+
double mClusteringThreshold = 0.050; // minimal energy of digit to start clustering (GeV)
62+
double mClusteringTimeGate = 1e9; // maximal time difference between digits to be accepted to clusters (in ns)
63+
int mNLMMax = 30; // maximal number of local maxima in unfolding
64+
double mLogWeight = 4.; // cutoff used in log. weight calculation
65+
double mUnfogingEAccuracy = 1.e-4; // accuracy of energy calculation in unfoding prosedure (GeV)
66+
double mUnfogingXZAccuracy = 1.e-2; // accuracy of position calculation in unfolding procedure (cm)
67+
int mNMaxIterations = 100; // maximal number of iterations in unfolding procedure
68+
double mLocalMaximumCut = 0.015; // minimal height of local maximum over neighbours
69+
bool mApplyCorrectionZ = 1; // apply z-correction
70+
bool mApplyCorrectionE = 1; // apply energy-correction
71+
TF1* fCrystalShowerShape; //! Crystal shower shape
72+
TF1* fSamplingShowerShape; //! Sampling shower shape
73+
TF1* fCrystalRMS; //! Crystal RMS
74+
std::vector<double> mCrystalEnergyCorrectionPars; // crystal energy-correction parameters
75+
std::vector<double> mSamplingEnergyCorrectionPars; // sampling energy-correction parameters
76+
std::vector<double> mCrystalZCorrectionPars; // crystal z-correction parameters
77+
std::vector<double> mSamplingZCorrectionPars; // sampling z-correction parameters
7078
};
7179

7280
} // namespace ecal

0 commit comments

Comments
 (0)