Skip to content

Commit b9effcc

Browse files
Dmitri Peresunkoshahor02
authored andcommitted
Change cluster def to common side; bugfix
1 parent 5e87c7a commit b9effcc

3 files changed

Lines changed: 21 additions & 26 deletions

File tree

Detectors/PHOS/base/include/PHOSBase/PHOSSimParams.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct PHOSSimParams : public o2::conf::ConfigurableParamHelper<PHOSSimParams> {
8080

8181
// Parameters used in clusterization
8282
float mLogWeight = 4.5; ///< Cutoff used in log. weight calculation
83-
float mDigitMinEnergy = 0.010; ///< Minimal energy of digits to be used in cluster (GeV)
83+
float mDigitMinEnergy = 0.020; ///< Minimal energy of digits to be used in cluster (GeV)
8484
float mClusteringThreshold = 0.050; ///< Minimal energy of digit to start clustering (GeV)
8585
float mLocalMaximumCut = 0.015; ///< Minimal height of local maximum over neighbours
8686
int mUnfoldMaxSize = 100; ///< maximal number of cells in cluster to be unfolded

Detectors/PHOS/base/src/Geometry.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int Geometry::areNeighbours(short absId1, short absId2)
178178
char rowdiff = TMath::Abs(relid1[1] - relid2[1]);
179179
char coldiff = TMath::Abs(relid1[2] - relid2[2]);
180180

181-
if ((coldiff <= 1) && (rowdiff <= 1)) { // At least common vertex
181+
if (coldiff + rowdiff <= 1) { // Common side
182182
return 1;
183183
} else {
184184
if ((relid2[1] > relid1[1]) && (relid2[2] > relid1[2] + 1)) {

Detectors/PHOS/reconstruction/src/Clusterer.cxx

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ void Clusterer::unfoldOneCluster(Cluster& iniClu, char nMax, std::vector<Cluster
382382
// insuficientAccuracy|=fabs(meMax[iclu]-eOld)> meMax[iclu]*o2::phos::PHOSSimParams::Instance().mUnfogingEAccuracy ;
383383
}
384384
} else {
385-
LOG(warning) << "Failed to decompose matrix of size " << int(nMax);
385+
// LOG(warning) << "Failed to decompose matrix of size " << int(nMax) << " Clusters mult=" << lastCE-firstCE;
386386
}
387387
} else {
388-
LOG(warning) << "Failed to decompose matrix of size " << int(nMax);
388+
// LOG(warning) << "Failed to decompose matrix of size " << int(nMax);
389389
}
390390
insuficientAccuracy &= (chi2 > o2::phos::PHOSSimParams::Instance().mUnfogingChi2Accuracy * nMax);
391391
nIterations++;
@@ -549,7 +549,7 @@ void Clusterer::evalAll(Cluster& clu, std::vector<CluElement>& cluel) const
549549
if (ce.energy < eMin) {
550550
continue;
551551
}
552-
float w = std::max(float(0.), o2::phos::PHOSSimParams::Instance().mLogWeight + std::log(ce.energy * invE));
552+
float w = std::max(0.f, o2::phos::PHOSSimParams::Instance().mLogWeight + std::log(ce.energy * invE));
553553
localPosX += ce.localX * w;
554554
localPosZ += ce.localZ * w;
555555
wtot += w;
@@ -577,7 +577,7 @@ void Clusterer::evalAll(Cluster& clu, std::vector<CluElement>& cluel) const
577577
float z = ce.localZ - localPosZ;
578578
float distance = x * x + z * z;
579579

580-
float w = std::max(float(0.), o2::phos::PHOSSimParams::Instance().mLogWeight + std::log(ei * invE));
580+
float w = std::max(0.f, o2::phos::PHOSSimParams::Instance().mLogWeight + std::log(ei * invE));
581581
dispersion += w * distance;
582582
dxx += w * x * x;
583583
dzz += w * z * z;
@@ -587,27 +587,25 @@ void Clusterer::evalAll(Cluster& clu, std::vector<CluElement>& cluel) const
587587
}
588588
}
589589
clu.setCoreEnergy(coreE);
590-
// dispersion
591-
if (wtot > 0) {
592-
wtot = 1. / wtot;
593-
dispersion *= wtot;
590+
// dispersion NB! wtot here already inverse
591+
dispersion *= wtot;
594592

595-
dxx *= wtot;
596-
dzz *= wtot;
597-
dxz *= wtot;
593+
dxx *= wtot;
594+
dzz *= wtot;
595+
dxz *= wtot;
598596

599-
lambdaLong = 0.5 * (dxx + dzz) + std::sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz);
600-
if (lambdaLong > 0) {
601-
lambdaLong = std::sqrt(lambdaLong);
602-
}
597+
lambdaLong = 0.5 * (dxx + dzz) + std::sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz);
598+
if (lambdaLong > 0) {
599+
lambdaLong = std::sqrt(lambdaLong);
600+
}
603601

604-
lambdaShort = 0.5 * (dxx + dzz) - std::sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz);
605-
if (lambdaShort > 0) { // To avoid exception if numerical errors lead to negative lambda.
606-
lambdaShort = std::sqrt(lambdaShort);
607-
} else {
608-
lambdaShort = 0.;
609-
}
602+
lambdaShort = 0.5 * (dxx + dzz) - std::sqrt(0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz);
603+
if (lambdaShort > 0) { // To avoid exception if numerical errors lead to negative lambda.
604+
lambdaShort = std::sqrt(lambdaShort);
605+
} else {
606+
lambdaShort = 0.;
610607
}
608+
611609
if (dispersion >= 0) {
612610
clu.setDispersion(std::sqrt(dispersion));
613611
} else {
@@ -652,12 +650,10 @@ char Clusterer::getNumberOfLocalMax(Cluster& clu, std::vector<CluElement>& cluel
652650
mIsLocalMax.reserve(clu.getMultiplicity());
653651

654652
uint32_t iFirst = clu.getFirstCluEl(), iLast = clu.getLastCluEl();
655-
LOG(debug) << "getNumberOfLocalMax: iFirst=" << iFirst << " iLast=" << iLast << " elements=" << cluel.size();
656653
for (uint32_t i = iFirst; i < iLast; i++) {
657654
mIsLocalMax.push_back(cluel[i].energy > cluSeed);
658655
}
659656

660-
LOG(debug) << "mIsLocalMax size=" << mIsLocalMax.size();
661657
for (uint32_t i = iFirst; i < iLast - 1; i++) {
662658
for (uint32_t j = i + 1; j < iLast; j++) {
663659

@@ -679,7 +675,6 @@ char Clusterer::getNumberOfLocalMax(Cluster& clu, std::vector<CluElement>& cluel
679675
} // digit j
680676
} // digit i
681677

682-
LOG(debug) << " Filled mIsLocalMax";
683678
int iDigitN = 0;
684679
for (std::size_t i = 0; i < mIsLocalMax.size(); i++) {
685680
if (mIsLocalMax[i]) {

0 commit comments

Comments
 (0)