Skip to content

Commit 199d2ed

Browse files
committed
Fixing code-check
1 parent 6e9b0e7 commit 199d2ed

1 file changed

Lines changed: 32 additions & 17 deletions

File tree

DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <Framework/runDataProcessing.h>
3535

3636
#include <TGeoManager.h>
37+
#include <TMath.h>
3738
#include <TPDGCode.h>
3839

3940
#include <HMPIDBase/Param.h>
@@ -103,8 +104,7 @@ struct HmpidTableProducer {
103104

104105
// (reference) HMPID Detector class in O2
105106
static constexpr double AbsThetaDeg = 33.5;
106-
const double mAbsCosT = std::cos(AbsThetaDeg * TMath::DegToRad());
107-
const double mAbsSinT = std::sin(AbsThetaDeg * TMath::DegToRad());
107+
double mAbsCosT = 0., mAbsSinT = 0.;
108108

109109
// Rich2 absorber: trans2 = {435.5, 0., -155.}, thickness 40mm -> halfX = 2cm
110110
static constexpr double AbsRich2CenterX = 435.5, AbsRich2CenterZ = -155.;
@@ -119,6 +119,9 @@ struct HmpidTableProducer {
119119

120120
void init(o2::framework::InitContext&)
121121
{
122+
mAbsCosT = std::cos(AbsThetaDeg * TMath::DegToRad());
123+
mAbsSinT = std::sin(AbsThetaDeg * TMath::DegToRad());
124+
122125
ccdb->setURL(ccdbConfig.ccdbUrl);
123126
ccdb->setCaching(true);
124127
ccdb->setLocalObjectValidityChecking();
@@ -265,8 +268,9 @@ struct HmpidTableProducer {
265268
(x[1] - planePoint[1]) * planeNormal[1] +
266269
(x[2] - planePoint[2]) * planeNormal[2];
267270

268-
if (std::abs(dist) >= std::abs(distPrev))
271+
if (std::abs(dist) >= std::abs(distPrev)) {
269272
return false;
273+
}
270274

271275
distPrev = dist;
272276
s -= dist;
@@ -309,14 +313,16 @@ struct HmpidTableProducer {
309313
// Intersection track - radiator plane
310314
std::array<double, 3> xRad{}, pAtRad{};
311315

312-
if (!intersectHelixPlane(bz, charge, x, p, pRad, nRad, xRad, pAtRad))
316+
if (!intersectHelixPlane(bz, charge, x, p, pRad, nRad, xRad, pAtRad)) {
313317
continue;
318+
}
314319

315320
// Intersection track - PC plane
316321
std::array<double, 3> xPc{}, pAtPc{};
317322

318-
if (!intersectHelixPlane(bz, charge, xRad, pAtRad, pPc, nPc, xPc, pAtPc))
323+
if (!intersectHelixPlane(bz, charge, xRad, pAtRad, pPc, nPc, xPc, pAtPc)) {
319324
continue;
325+
}
320326

321327
double theta = 0., phi = 0.;
322328
param->mars2LorsVec(ch, pAtRad.data(), theta, phi);
@@ -325,8 +331,9 @@ struct HmpidTableProducer {
325331
param->mars2Lors(ch, xPc.data(), xL, yL);
326332

327333
// Use isInside to check Chamber intersected
328-
if (param->isInside(xL, yL, param->distCut()))
334+
if (param->isInside(xL, yL, param->distCut())) {
329335
return ch;
336+
}
330337
}
331338

332339
// No chamber intersected
@@ -403,26 +410,30 @@ struct HmpidTableProducer {
403410

404411
const auto& globalTrack = t.template track_as<TTrackTable>();
405412

406-
if (!globalTrack.has_collision())
413+
if (!globalTrack.has_collision()) {
407414
continue;
415+
}
408416

409417
const auto& col = globalTrack.template collision_as<CollisionCandidates>();
410418
initCCDB(col.template bc_as<aod::BCsWithTimestamps>());
411419
uint32_t collId = col.globalIndex();
412420

413421
if ((requireITS && !globalTrack.hasITS()) ||
414422
(requireTPC && !globalTrack.hasTPC()) ||
415-
(requireTOF && !globalTrack.hasTOF()))
423+
(requireTOF && !globalTrack.hasTOF())) {
416424
continue;
425+
}
417426

418-
if (mCollisionsWithHmpid.insert(collId).second)
427+
if (mCollisionsWithHmpid.insert(collId).second) {
419428
histos.fill(HIST("eventsHmpid"), 0.5);
429+
}
420430

421431
// clusSize diagnostics
422432
histos.fill(HIST("hClusSize"), t.hmpidClusSize());
423433
bool isCorrupt = (t.hmpidClusSize() <= 0);
424-
if (isCorrupt)
434+
if (isCorrupt) {
425435
histos.fill(HIST("hClusSizeCorrupt"), t.hmpidClusSize());
436+
}
426437

427438
// --- M2: clusSize encoding ---
428439
int chamberM2 = t.hmpidClusSize() / 1000000;
@@ -470,20 +481,22 @@ struct HmpidTableProducer {
470481
// bin 2 = clusSize <= 0, M1 recovery (corrupt, M1 ok)
471482
// bin 3 = clusSize <= 0, M1 fails (corrupt, skipped)
472483

473-
if (!isCorrupt && chamberM3 >= 0)
484+
if (!isCorrupt && chamberM3 >= 0) {
474485
histos.fill(HIST("hChamberAssignment"), 0.);
475-
else if (!isCorrupt && chamberM3 < 0)
486+
} else if (!isCorrupt && chamberM3 < 0) {
476487
histos.fill(HIST("hChamberAssignment"), 1.);
477-
else if (isCorrupt && chamberM3 >= 0)
488+
} else if (isCorrupt && chamberM3 >= 0) {
478489
histos.fill(HIST("hChamberAssignment"), 2.);
479-
else
490+
} else {
480491
histos.fill(HIST("hChamberAssignment"), 3.);
492+
}
481493

482494
histos.fill(HIST("hChamberM3"), chamberM3);
483495
histos.fill(HIST("hChamberM3vsM2"), chamberM2, chamberM3);
484496

485-
if (chamberM3 < 0)
497+
if (chamberM3 < 0) {
486498
continue;
499+
}
487500

488501
std::vector<float> hmpidPhotsCharge2(o2::aod::kDimPhotonsCharge, 0.f);
489502

@@ -527,8 +540,9 @@ struct HmpidTableProducer {
527540
auto daughter = mcParticles.rawIteratorAt(idx);
528541

529542
int absPdg = std::abs(daughter.pdgCode());
530-
if (absPdg == kElectron || absPdg == kGamma)
543+
if (absPdg == kElectron || absPdg == kGamma) {
531544
continue;
545+
}
532546

533547
foundRelevantDaughter = true;
534548

@@ -556,8 +570,9 @@ struct HmpidTableProducer {
556570

557571
// skip delta rays (e-/e+), photons, and HMPID Cherenkov/feedback
558572
int absPdg = std::abs(daughter.pdgCode());
559-
if (absPdg == kElectron || absPdg == kGamma)
573+
if (absPdg == kElectron || absPdg == kGamma) {
560574
continue;
575+
}
561576

562577
foundRelevantDaughter = true;
563578

0 commit comments

Comments
 (0)