Skip to content

Commit 0117984

Browse files
committed
Fixing MegaLinter errors
1 parent 22c6238 commit 0117984

File tree

1 file changed

+19
-49
lines changed

1 file changed

+19
-49
lines changed

Common/TableProducer/muonRealignment.cxx

Lines changed: 19 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
/// \brief Task for muon re-alignment at analysis level
1414
/// \author Chi Zhang <chi.zhang@cern.ch>, CEA-Saclay
1515

16-
#include <filesystem>
1716
#include <string>
1817
#include "Framework/AnalysisDataModel.h"
1918
#include "Framework/AnalysisTask.h"
@@ -79,15 +78,11 @@ struct MuonRealignment {
7978
Configurable<std::string> geoRefPath{"geoRefPath", "GLO/Config/GeometryAligned", "Path of the reference geometry file"};
8079
Configurable<std::string> geoNewPath{"geoNewPath", "GLO/Config/GeometryAligned", "Path of the new geometry file"};
8180
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
82-
Configurable<std::string> grpPathLocal{"grpPathLocal", "", "Local path of the GRP object if not using CCDB"};
83-
Configurable<std::string> geoNewPathLocal{"geoNewPathLocal", "", "Local path of the GRP object if not using CCDB"};
8481
Configurable<int64_t> nolaterthanRef{"ccdb-no-later-than-ref", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object of reference basis"};
8582
Configurable<int64_t> nolaterthanNew{"ccdb-no-later-than-new", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object of new basis"};
8683
Configurable<double> cfgChamberResolutionX{"cfgChamberResolutionX", 0.04, "Chamber resolution along X configuration for refit"}; // 0.4cm pp, 0.2cm PbPb
8784
Configurable<double> cfgChamberResolutionY{"cfgChamberResolutionY", 0.04, "Chamber resolution along Y configuration for refit"}; // 0.4cm pp, 0.2cm PbPb
8885
Configurable<double> cfgSigmaCutImprove{"cfgSigmaCutImprove", 6., "Sigma cut for track improvement"}; // 6 for pp, 4 for PbPb
89-
Configurable<bool> fUseRemoteField{"cfgUseRemoteField", true, "Chose whether to fetch the magnetic field from ccdb or set it manually"};
90-
Configurable<bool> fUseRemoteGeometry{"cfgUseRemoteGeometry", false, "Chose whether to fetch new geometry from ccdb or set it manually"};
9186

9287
parameters::GRPMagField* grpmag = nullptr;
9388
base::MatLayerCylSet* lut = nullptr;
@@ -234,7 +229,7 @@ struct MuonRealignment {
234229
FwdTrkCovRealignInfo fwdTrkCovRealignInfo;
235230
for (auto const& muon : muons) {
236231
int muonRealignId = muon.globalIndex();
237-
if (int(muon.trackType() > 2)) {
232+
if (static_cast<int>(muon.trackType() > 2)) {
238233

239234
auto clustersSliced = clusters.sliceBy(perMuon, muon.globalIndex()); // Slice clusters by muon id
240235
mch::Track convertedTrack = mch::Track(); // Temporary variable to store re-aligned clusters
@@ -333,25 +328,14 @@ struct MuonRealignment {
333328
auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
334329
if (fCurrentRun != bc.runNumber()) {
335330
// Load magnetic field information from CCDB/local
336-
if (fUseRemoteField) {
337-
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
338-
grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, bc.timestamp());
339-
if (grpmag != nullptr) {
340-
base::Propagator::initFieldFromGRP(grpmag);
341-
TrackExtrap::setField();
342-
TrackExtrap::useExtrapV2();
343-
} else {
344-
LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", bc.timestamp());
345-
}
331+
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
332+
grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, bc.timestamp());
333+
if (grpmag != nullptr) {
334+
base::Propagator::initFieldFromGRP(grpmag);
335+
TrackExtrap::setField();
336+
TrackExtrap::useExtrapV2();
346337
} else {
347-
if (std::filesystem::exists(grpPathLocal.value)) {
348-
const auto grp = parameters::GRPObject::loadFrom(grpPathLocal.value);
349-
base::Propagator::initFieldFromGRP(grp);
350-
TrackExtrap::setField();
351-
TrackExtrap::useExtrapV2();
352-
} else {
353-
LOGF(fatal, "GRP object is not available in local path: %s", grpPathLocal.value);
354-
}
338+
LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", bc.timestamp());
355339
}
356340

357341
// Load geometry information from CCDB/local
@@ -369,32 +353,18 @@ struct MuonRealignment {
369353
transformRef[iDEN] = transformation(iDEN);
370354
}
371355

372-
if (fUseRemoteGeometry) {
373-
LOGF(info, "Loading new aligned geometry from CCDB no later than %d", nolaterthanNew.value);
374-
ccdb->setCreatedNotAfter(nolaterthanNew.value); // make sure this timestamp can be resolved regarding the reference one
375-
geoNew = ccdb->getForTimeStamp<TGeoManager>(geoNewPath, bc.timestamp());
376-
ccdb->clearCache(geoNewPath);
377-
if (geoNew != nullptr) {
378-
transformation = geo::transformationFromTGeoManager(*geoNew);
379-
} else {
380-
LOGF(fatal, "New aligned geometry object is not available in CCDB at timestamp=%llu", bc.timestamp());
381-
}
382-
for (int i = 0; i < 156; i++) {
383-
int iDEN = GetDetElemId(i);
384-
transformNew[iDEN] = transformation(iDEN);
385-
}
356+
LOGF(info, "Loading new aligned geometry from CCDB no later than %d", nolaterthanNew.value);
357+
ccdb->setCreatedNotAfter(nolaterthanNew.value); // make sure this timestamp can be resolved regarding the reference one
358+
geoNew = ccdb->getForTimeStamp<TGeoManager>(geoNewPath, bc.timestamp());
359+
ccdb->clearCache(geoNewPath);
360+
if (geoNew != nullptr) {
361+
transformation = geo::transformationFromTGeoManager(*geoNew);
386362
} else {
387-
LOGF(info, "Loading new aligned geometry from local path: %s", geoNewPathLocal.value);
388-
if (std::filesystem::exists(geoNewPathLocal.value)) {
389-
base::GeometryManager::loadGeometry(geoNewPathLocal.value);
390-
transformation = geo::transformationFromTGeoManager(*gGeoManager);
391-
for (int i = 0; i < 156; i++) {
392-
int iDEN = GetDetElemId(i);
393-
transformNew[iDEN] = transformation(iDEN);
394-
}
395-
} else {
396-
LOGF(fatal, "New geometry file is not available in local path: %s", geoNewPathLocal.value);
397-
}
363+
LOGF(fatal, "New aligned geometry object is not available in CCDB at timestamp=%llu", bc.timestamp());
364+
}
365+
for (int i = 0; i < 156; i++) {
366+
int iDEN = GetDetElemId(i);
367+
transformNew[iDEN] = transformation(iDEN);
398368
}
399369

400370
fCurrentRun = bc.runNumber();

0 commit comments

Comments
 (0)