Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Common/Core/FFitWeights.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ void FFitWeights::init()
fW_data->Add(new TProfile("pMeanPt", "", centBin, 0, centBin));
fW_data->Add(new TH2D("hPtWeight", "", centBin, 0, centBin, ptBin, ptAxis->GetXmin(), ptAxis->GetXmax()));

ptProfCent = reinterpret_cast<TProfile*>(fW_data->FindObject("pMeanPt"));
h2ptCent = reinterpret_cast<TH2D*>(fW_data->FindObject("hPtWeight"));
ptProfCent = dynamic_cast<TProfile*>(fW_data->FindObject("pMeanPt"));
h2ptCent = dynamic_cast<TH2D*>(fW_data->FindObject("hPtWeight"));
};

void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf)
Expand All @@ -98,10 +98,10 @@ void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf
if (!tar)
return;

TH2D* th2 = reinterpret_cast<TH2D*>(tar->FindObject(this->getQName(nh, pf)));
TH2D* th2 = dynamic_cast<TH2D*>(tar->FindObject(this->getQName(nh, pf)));
if (!th2) {
tar->Add(new TH2D(this->getQName(nh, pf), this->getAxisName(nh, pf), centBin, 0, centBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax()));
th2 = reinterpret_cast<TH2D*>(tar->At(tar->GetEntries() - 1));
th2 = dynamic_cast<TH2D*>(tar->At(tar->GetEntries() - 1));
}
th2->Fill(centrality, qn);
};
Expand All @@ -117,7 +117,7 @@ void FFitWeights::fillPt(float centrality, float pt, float weight, bool first)
float FFitWeights::getPtMult(float centrality)
{
if (!ptProfCent) {
ptProfCent = reinterpret_cast<TProfile*>(fW_data->FindObject("pMeanPt"));
ptProfCent = dynamic_cast<TProfile*>(fW_data->FindObject("pMeanPt"));
}
return ptProfCent->GetBinContent(ptProfCent->FindBin(centrality));
};
Expand All @@ -132,7 +132,7 @@ Long64_t FFitWeights::Merge(TCollection* collist)
}
FFitWeights* lW = 0;
TIter allW(collist);
while ((lW = (reinterpret_cast<FFitWeights*>(allW())))) {
while ((lW = (dynamic_cast<FFitWeights*>(allW())))) {
addArray(fW_data, lW->getDataArray());
nmerged++;
}
Expand All @@ -150,7 +150,7 @@ void FFitWeights::addArray(TObjArray* targ, TObjArray* sour)

auto* tObj = targ->FindObject(obj->GetName());
if (!tObj) {
auto* clone = static_cast<TObject*>(obj->Clone(obj->GetName()));
auto* clone = obj->Clone(obj->GetName());
if (auto* h = dynamic_cast<TH1*>(clone))
h->SetDirectory(0);
targ->Add(clone);
Expand All @@ -168,7 +168,7 @@ void FFitWeights::mptSel()
if (!tar)
return;

TH2D* th2 = reinterpret_cast<TH2D*>(tar->FindObject("hPtWeight"));
TH2D* th2 = dynamic_cast<TH2D*>(tar->FindObject("hPtWeight"));
if (!th2) {
return;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ void FFitWeights::qSelection(const std::vector<int>& nhv, const std::vector<std:

for (const auto& pf : stv) {
for (const auto& nh : nhv) {
TH2D* th2{reinterpret_cast<TH2D*>(tar->FindObject(this->getQName(nh, pf.c_str())))};
TH2D* th2{dynamic_cast<TH2D*>(tar->FindObject(this->getQName(nh, pf.c_str())))};
if (!th2) {
LOGF(info, "FFitWeights qh not found!");
return;
Expand Down
2 changes: 1 addition & 1 deletion Common/Core/PID/PIDTOFParamService.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ struct TOFSupport : o2::framework::ServicePlugin {
},
.configure = CommonServices::noConfiguration(),
.exit = [](ServiceRegistryRef, void* service) {
auto* resp = reinterpret_cast<o2::pid::tof::TOFResponse*>(service);
auto* resp = static_cast<o2::pid::tof::TOFResponse*>(service);
delete resp; },
.kind = ServiceKind::Serial};
}
Expand Down
8 changes: 4 additions & 4 deletions Common/Core/Zorro.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void Zorro::populateHistRegistry(o2::framework::HistogramRegistry& histRegistry,
for (int iBin{2}; iBin < mSelections->GetNbinsX(); ++iBin) { // Exclude first and last bins as they are total number of analysed and selected events, respectively
mAnalysedTriggers->GetXaxis()->SetBinLabel(iBin - 1, mSelections->GetXaxis()->GetBinLabel(iBin));
}
std::shared_ptr<TH1> selections = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "Selections").data(), "", o2::framework::HistType::kTH1D, {{mSelections->GetNbinsX(), -0.5, static_cast<double>(mSelections->GetNbinsX() - 0.5)}});
std::shared_ptr<TH1> selections = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "Selections").data(), "", o2::framework::HistType::kTH1D, {{mSelections->GetNbinsX(), -0.5, (mSelections->GetNbinsX() - 0.5)}});
selections->SetBit(TH1::kIsAverage);
for (int iBin{1}; iBin <= mSelections->GetNbinsX(); ++iBin) {
selections->GetXaxis()->SetBinLabel(iBin, mSelections->GetXaxis()->GetBinLabel(iBin));
Expand All @@ -81,7 +81,7 @@ void Zorro::populateHistRegistry(o2::framework::HistogramRegistry& histRegistry,
}
}
if (mScalers) {
std::shared_ptr<TH1> scalers = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "Scalers").data(), "", o2::framework::HistType::kTH1D, {{mScalers->GetNbinsX(), -0.5, static_cast<double>(mScalers->GetNbinsX() - 0.5)}});
std::shared_ptr<TH1> scalers = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "Scalers").data(), "", o2::framework::HistType::kTH1D, {{mScalers->GetNbinsX(), -0.5, (mScalers->GetNbinsX() - 0.5)}});
scalers->SetBit(TH1::kIsAverage);
for (int iBin{1}; iBin <= mScalers->GetNbinsX(); ++iBin) {
scalers->GetXaxis()->SetBinLabel(iBin, mScalers->GetXaxis()->GetBinLabel(iBin));
Expand All @@ -90,7 +90,7 @@ void Zorro::populateHistRegistry(o2::framework::HistogramRegistry& histRegistry,
}
}
if (mInspectedTVX) {
std::shared_ptr<TH1> inspectedTVX = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "InspectedTVX").data(), "", o2::framework::HistType::kTH1D, {{mInspectedTVX->GetNbinsX(), -0.5, static_cast<double>(mInspectedTVX->GetNbinsX() - 0.5)}});
std::shared_ptr<TH1> inspectedTVX = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "InspectedTVX").data(), "", o2::framework::HistType::kTH1D, {{mInspectedTVX->GetNbinsX(), -0.5, (mInspectedTVX->GetNbinsX() - 0.5)}});
inspectedTVX->SetBit(TH1::kIsAverage);
for (int iBin{1}; iBin <= mInspectedTVX->GetNbinsX(); ++iBin) {
inspectedTVX->GetXaxis()->SetBinLabel(iBin, mInspectedTVX->GetXaxis()->GetBinLabel(iBin));
Expand All @@ -99,7 +99,7 @@ void Zorro::populateHistRegistry(o2::framework::HistogramRegistry& histRegistry,
}
}
if (mTOIs.size()) {
mAnalysedTriggersOfInterest = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "AnalysedTriggersOfInterest").data(), "", o2::framework::HistType::kTH1D, {{static_cast<int>(mTOIs.size()), -0.5, static_cast<double>(mTOIs.size() - 0.5)}}).get();
mAnalysedTriggersOfInterest = histRegistry.add<TH1>((folderName + "/" + std::to_string(runNumber) + "/" + "AnalysedTriggersOfInterest").data(), "", o2::framework::HistType::kTH1D, {{static_cast<int>(mTOIs.size()), -0.5, (mTOIs.size() - 0.5)}}).get();
for (size_t i{0}; i < mTOIs.size(); ++i) {
mAnalysedTriggersOfInterest->GetXaxis()->SetBinLabel(i + 1, mTOIs[i].data());
}
Expand Down
2 changes: 1 addition & 1 deletion Common/Core/ZorroSummary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

void ZorroSummary::Copy(TObject& c) const
{
static_cast<ZorroSummary&>(c) = *this;
dynamic_cast<ZorroSummary&>(c) = *this;
}

Long64_t ZorroSummary::Merge(TCollection* list)
Expand Down
4 changes: 2 additions & 2 deletions Common/Core/macros/testMetadataHelper.C
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
auto readMetadata(std::unique_ptr<TFile>& currentFile) -> std::vector<o2::framework::ConfigParamSpec>
{
// Get the metadata, if any
auto m = (TMap*)currentFile->Get("metaData");
auto m = dynamic_cast<TMap*>(currentFile->Get("metaData"));
if (!m) {
return {};
}
Expand All @@ -59,7 +59,7 @@ auto readMetadata(std::unique_ptr<TFile>& currentFile) -> std::vector<o2::framew
LOGP(info, "Metadata for file \"{}\":", currentFile->GetName());
first = false;
}
auto objString = (TObjString*)m->GetValue(obj);
auto objString = dynamic_cast<TObjString*>(m->GetValue(obj));
std::string key = "aod-metadata-" + std::string(obj->GetName());
LOGP(info, "- {}: {} goes into key {}", obj->GetName(), objString->String().Data(), key);
char const* value = strdup(objString->String());
Expand Down
10 changes: 5 additions & 5 deletions Common/TableProducer/PID/pidTOFBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ struct tofEventTime {
tableFlags(0);
tableEvTime(0.f, 999.f);
if (enableTableTOFOnly) {
tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1);
tableEvTimeTOFOnly(static_cast<uint8_t>(0), 0.f, 0.f, -1);
}
continue;
}
Expand Down Expand Up @@ -408,7 +408,7 @@ struct tofEventTime {
tableFlags(flags);
tableEvTime(et, erret);
if (enableTableTOFOnly) {
tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), et, erret, evTimeTOF.mEventTimeMultiplicity);
tableEvTimeTOFOnly(static_cast<uint8_t>(filterForTOFEventTime(trk)), et, erret, evTimeTOF.mEventTimeMultiplicity);
}
}
}
Expand Down Expand Up @@ -438,7 +438,7 @@ struct tofEventTime {
tableFlags(0);
tableEvTime(0.f, 999.f);
if (enableTableTOFOnly) {
tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1);
tableEvTimeTOFOnly(static_cast<uint8_t>(0), 0.f, 0.f, -1);
}
continue;
}
Expand Down Expand Up @@ -504,7 +504,7 @@ struct tofEventTime {
}
tableEvTime(eventTime / sumOfWeights, std::sqrt(1. / sumOfWeights));
if (enableTableTOFOnly) {
tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), t0TOF[0], t0TOF[1], evTimeTOF.mEventTimeMultiplicity);
tableEvTimeTOFOnly(static_cast<uint8_t>(filterForTOFEventTime(trk)), t0TOF[0], t0TOF[1], evTimeTOF.mEventTimeMultiplicity);
}
}
}
Expand All @@ -529,7 +529,7 @@ struct tofEventTime {

for (auto const& t : tracks) { // Loop on collisions
if (enableTableTOFOnly) {
tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1);
tableEvTimeTOFOnly(static_cast<uint8_t>(0), 0.f, 0.f, -1);
}
if (!t.has_collision() || collisions.size() == 0) { // Track was not assigned, cannot compute event time
tableFlags(0);
Expand Down
10 changes: 5 additions & 5 deletions Common/TableProducer/PID/pidTOFMerge.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ struct tofEventTime {
tableFlags(0);
tableEvTime(0.f, 999.f);
if (enableTableEvTimeTOFOnly) {
tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1);
tableEvTimeTOFOnly(static_cast<uint8_t>(0), 0.f, 0.f, -1);
}
continue;
}
Expand Down Expand Up @@ -470,7 +470,7 @@ struct tofEventTime {
}
tableEvTime(eventTime / sumOfWeights, std::sqrt(1. / sumOfWeights));
if (enableTableEvTimeTOFOnly) {
tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), t0TOF[0], t0TOF[1], evTimeMakerTOF.mEventTimeMultiplicity);
tableEvTimeTOFOnly(static_cast<uint8_t>(filterForTOFEventTime(trk)), t0TOF[0], t0TOF[1], evTimeMakerTOF.mEventTimeMultiplicity);
}
}
}
Expand All @@ -481,7 +481,7 @@ struct tofEventTime {
tableFlags(0);
tableEvTime(0.f, 999.f);
if (enableTableEvTimeTOFOnly) {
tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1);
tableEvTimeTOFOnly(static_cast<uint8_t>(0), 0.f, 0.f, -1);
}
continue;
}
Expand Down Expand Up @@ -513,14 +513,14 @@ struct tofEventTime {
tableFlags(flags);
tableEvTime(et, erret);
if (enableTableEvTimeTOFOnly) {
tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), et, erret, evTimeMakerTOF.mEventTimeMultiplicity);
tableEvTimeTOFOnly(static_cast<uint8_t>(filterForTOFEventTime(trk)), et, erret, evTimeMakerTOF.mEventTimeMultiplicity);
}
}
}
} else if (mComputeEvTimeWithTOF == 0 && mComputeEvTimeWithFT0 == 1) {
for (auto const& t : tracks) { // Loop on collisions
if (enableTableEvTimeTOFOnly) {
tableEvTimeTOFOnly((uint8_t)0, 0.f, 0.f, -1);
tableEvTimeTOFOnly(static_cast<uint8_t>(0), 0.f, 0.f, -1);
}
if (!t.has_collision() || collisions.size() == 0) { // Track was not assigned, cannot compute event time
tableFlags(0);
Expand Down
4 changes: 2 additions & 2 deletions Common/TableProducer/PID/pidTPCBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct PidMultiplicity {
}

using TrksIU = soa::Join<aod::TracksIU, aod::TracksExtra>;
Partition<TrksIU> tracksWithTPCIU = (aod::track::tpcNClsFindable > (uint8_t)0);
Partition<TrksIU> tracksWithTPCIU = (aod::track::tpcNClsFindable > static_cast<uint8_t>(0));
void processIU(aod::Collision const& collision, TrksIU const&)
{
if (!enableTable) {
Expand All @@ -73,7 +73,7 @@ struct PidMultiplicity {
PROCESS_SWITCH(PidMultiplicity, processIU, "Process with IU tracks, faster but works on Run3 only", false);

using Trks = soa::Join<aod::Tracks, aod::TracksExtra>;
Partition<Trks> tracksWithTPC = (aod::track::tpcNClsFindable > (uint8_t)0);
Partition<Trks> tracksWithTPC = (aod::track::tpcNClsFindable > static_cast<uint8_t>(0));
void processStandard(aod::Collision const& collision, Trks const&)
{
if (!enableTable) {
Expand Down
22 changes: 11 additions & 11 deletions Common/TableProducer/match-mft-ft0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&

int64_t minBCId = bcIt.globalIndex();

if ((int64_t)bcIt.globalBC() < firstBC + deltaBC) {
while (bcIt != bcs.end() && (int64_t)bcIt.globalBC() < firstBC + deltaBC) {
if (static_cast<int64_t>(bcIt.globalBC()) < firstBC + deltaBC) {
while (bcIt != bcs.end() && static_cast<int64_t>(bcIt.globalBC()) < firstBC + deltaBC) {
minBCId = bcIt.globalIndex();

++bcIt;
Expand All @@ -163,11 +163,11 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&
} else {
// here bcIt.globalBC() >= firstBC + deltaBC

while (bcIt != bcs.begin() && (int64_t)bcIt.globalBC() >= (int64_t)firstBC + deltaBC) {
while (bcIt != bcs.begin() && static_cast<int64_t>(bcIt.globalBC()) >= firstBC + deltaBC) {
minBCId = bcIt.globalIndex();
--bcIt;
}
if (bcIt == bcs.begin() && (int64_t)bcIt.globalBC() >= (int64_t)firstBC + deltaBC) {
if (bcIt == bcs.begin() && static_cast<int64_t>(bcIt.globalBC()) >= firstBC + deltaBC) {
minBCId = bcIt.globalIndex();
}
++bcIt; // retrieve the pointer which gave minBCId and minGlobalBC
Expand All @@ -178,12 +178,12 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&

int64_t maxBCId = bcIt.globalIndex();

if ((int64_t)bcIt.globalBC() > (int64_t)lastBC + deltaBC) {
if (static_cast<int64_t>(bcIt.globalBC()) > lastBC + deltaBC) {
// the previous minimum is actually bigger than the right boundary

if (bcIt != bcs.begin()) {
--bcIt; // let's check the previous element in the BC list
if ((int64_t)bcIt.globalBC() < (int64_t)firstBC + deltaBC) // if this previous element is smaller than the left boundary
--bcIt; // let's check the previous element in the BC list
if (static_cast<int64_t>(bcIt.globalBC()) < firstBC + deltaBC) // if this previous element is smaller than the left boundary
{
// means that the slice of compatible BCs is empty

Expand All @@ -192,18 +192,18 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const&
}
}

if ((int64_t)bcIt.globalBC() < (int64_t)firstBC + deltaBC) {
if (static_cast<int64_t>(bcIt.globalBC()) < firstBC + deltaBC) {
// the previous minimum is actually smaller than the right boundary
++bcIt;

if (bcIt != bcs.end() && ((int64_t)bcIt.globalBC() > (int64_t)lastBC + deltaBC)) {
if (bcIt != bcs.end() && (static_cast<int64_t>(bcIt.globalBC()) > lastBC + deltaBC)) {
// check the following element

return bcs.emptySlice();
}
}

while (bcIt != bcs.end() && (int64_t)bcIt.globalBC() <= (int64_t)lastBC + deltaBC) {
while (bcIt != bcs.end() && static_cast<int64_t>(bcIt.globalBC()) <= lastBC + deltaBC) {
maxBCId = bcIt.globalIndex();

++bcIt;
Expand Down Expand Up @@ -275,7 +275,7 @@ struct matchmftft0 {
o2::base::Propagator::initFieldFromGRP(grpmag); // for some reason this is necessary for the next next line
runNumber = bc.runNumber();

o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
o2::field::MagneticField* field = dynamic_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());

Bz = field->getBz(centerMFT); // gives error if the propagator is not initFielded
LOG(info) << "The field at the center of the MFT is Bz = " << Bz;
Expand Down
6 changes: 3 additions & 3 deletions Common/TableProducer/match-mft-mch-data-mc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ struct match_mft_mch_data_mc {
ccdbManager->get<TGeoManager>(geoPath);
}
o2::mch::TrackExtrap::setField();
fieldB = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
fieldB = dynamic_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
}

void init(o2::framework::InitContext&)
Expand Down Expand Up @@ -703,7 +703,7 @@ struct match_mft_mch_data_mc {

tableMatchingParams(matching.getGMPtAtDCA(),
matching.getGMEtaAtDCA(),
static_cast<int16_t>(matching.getGMQ()),
matching.getGMQ(),
matching.getDpt(),
matching.getDx(),
matching.getDy(),
Expand Down Expand Up @@ -732,7 +732,7 @@ struct match_mft_mch_data_mc {

tableMixMatchingParams(matching.getGMPtAtDCA(),
matching.getGMEtaAtDCA(),
static_cast<int16_t>(matching.getGMQ()),
matching.getGMQ(),
matching.getDpt(),
matching.getDx(),
matching.getDy(),
Expand Down
6 changes: 3 additions & 3 deletions Common/TableProducer/match-mft-mch-data.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ struct match_mft_mch_data_mc {
ccdbManager->get<TGeoManager>(geoPath);
}
o2::mch::TrackExtrap::setField();
fieldB = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
fieldB = dynamic_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
}

void init(o2::framework::InitContext&)
Expand Down Expand Up @@ -703,7 +703,7 @@ struct match_mft_mch_data_mc {

tableMatchingParams(matching.getGMPtAtDCA(),
matching.getGMEtaAtDCA(),
static_cast<int16_t>(matching.getGMQ()),
matching.getGMQ(),
matching.getDpt(),
matching.getDx(),
matching.getDy(),
Expand Down Expand Up @@ -732,7 +732,7 @@ struct match_mft_mch_data_mc {

tableMixMatchingParams(matching.getGMPtAtDCA(),
matching.getGMEtaAtDCA(),
static_cast<int16_t>(matching.getGMQ()),
matching.getGMQ(),
matching.getDpt(),
matching.getDx(),
matching.getDy(),
Expand Down
Loading
Loading