Skip to content

Commit 810add2

Browse files
ChristianTackeGSIdennisklein
authored andcommitted
chore: Remove useless casts
Casting to the exact same type is quite useless.
1 parent e0a47d5 commit 810add2

12 files changed

Lines changed: 32 additions & 34 deletions

fairroot/base/sim/FairVolumeList.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -58,7 +58,7 @@ FairVolume* FairVolumeList::findObject(TString name)
5858
obj = static_cast<FairVolume*>(fData->At(i));
5959
if (obj) {
6060
if (obj->GetName() == name) {
61-
return static_cast<FairVolume*>(obj);
61+
return obj;
6262
}
6363
}
6464
}
@@ -68,7 +68,7 @@ FairVolume* FairVolumeList::findObject(TString name)
6868

6969
void FairVolumeList::addVolume(FairVolume* elem)
7070
{
71-
FairVolume* v = static_cast<FairVolume*>(findObject(elem->GetName()));
71+
FairVolume* v = findObject(elem->GetName());
7272

7373
if (v) {
7474
LOG(error) << "FairVolumeList element: " << elem->GetName() << " VolId : " << elem->getVolumeId()

fairroot/base/source/FairFileSource.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -296,7 +296,7 @@ void FairFileSource::SetInTree(TTree* tempTree)
296296
{
297297
fInTree = nullptr;
298298
fInTree = tempTree;
299-
fRootFile = static_cast<TFile*>(tempTree->GetCurrentFile());
299+
fRootFile = tempTree->GetCurrentFile();
300300
fInChain->Reset();
301301
IsInitialized = kFALSE;
302302
Init();
@@ -387,7 +387,7 @@ void FairFileSource::AddFriendsToChain()
387387
friendType++;
388388
}
389389

390-
TChain* chain = static_cast<TChain*>(fFriendTypeList[inputLevel]);
390+
TChain* chain = fFriendTypeList[inputLevel];
391391
chain->AddFile(fileName, 1234567890, FairRootManager::GetTreeName());
392392
}
393393

fairroot/base/steer/FairRingSorterTask.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -97,7 +97,7 @@ void FairRingSorterTask::FinishTask()
9797
}
9898
for (int i = 0; i < fInputArray->GetEntriesFast(); i++) {
9999
FairTimeStamp* myDigi = static_cast<FairTimeStamp*>(fInputArray->At(i));
100-
fSorter->AddElement(myDigi, (static_cast<FairTimeStamp*>(myDigi))->GetTimeStamp());
100+
fSorter->AddElement(myDigi, myDigi->GetTimeStamp());
101101
}
102102
fSorter->Print();
103103
fSorter->WriteOutAll();

fairroot/base/steer/FairTSBufferFunctional.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -49,7 +49,7 @@ TClonesArray* FairTSBufferFunctional::GetData(Double_t stopParameter)
4949

5050
if (fStopFunction == 0) { // no function is given ==> read in data in traditional way event by event
5151
ReadInNextEntry();
52-
fOutputArray->AbsorbObjects(static_cast<TClonesArray*>(fInputArray), 0, fInputArray->GetEntriesFast() - 1);
52+
fOutputArray->AbsorbObjects(fInputArray, 0, fInputArray->GetEntriesFast() - 1);
5353
return fOutputArray;
5454
}
5555
if (fVerbose > 1) {

fairroot/geobase/FairGeoMedium.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -99,7 +99,7 @@ void FairGeoMedium::setNComponents(Int_t n)
9999
cz = new Double_t[k];
100100
cw = new Double_t[k];
101101
}
102-
weightFac = static_cast<Int_t>(n / nComponents);
102+
weightFac = n / nComponents;
103103
}
104104

105105
Bool_t FairGeoMedium::setComponent(Int_t i, Double_t a, Double_t z, Double_t weight)

fairroot/geobase/FairGeoNode.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -202,14 +202,14 @@ Bool_t FairGeoNode::write(std::fstream& fout)
202202
// Writes all parameters of a volume to file
203203
fout << fName.Data() << '\n';
204204
if (pMother) {
205-
fout << (const_cast<const char*>(mother.Data())) << '\n';
205+
fout << mother.Data() << '\n';
206206
} else {
207207
Error("write", "Unknown mother for %s\n", fName.Data());
208208
return kFALSE;
209209
}
210210
if (!copyNode) {
211211
if (pShape) {
212-
fout << (const_cast<const char*>(shape.Data())) << '\n';
212+
fout << shape.Data() << '\n';
213213
} else {
214214
Error("write", "Unknown shape for %s\n", fName.Data());
215215
return kFALSE;

fairroot/geobase/FairGeoNode.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -64,10 +64,10 @@ class FairGeoNode : public FairGeoVolume
6464
void AddDaughter(FairGeoNode* fNode) { fDaughterList->AddLast(fNode); }
6565
TObjArray* GetListOfDaughters() { return fDaughterList; }
6666
EFairGeoNodeType getVolumeType() { return volumeType; }
67-
Bool_t isTopNode() { return static_cast<Bool_t>((volumeType == kFairGeoTopNode)); }
68-
Bool_t isRefNode() { return static_cast<Bool_t>((volumeType == kFairGeoRefNode)); }
69-
Bool_t isKeepin() { return static_cast<Bool_t>((volumeType == kFairGeoKeepin)); }
70-
Bool_t isModule() { return static_cast<Bool_t>((volumeType == kFairGeoModule)); }
67+
Bool_t isTopNode() { return volumeType == kFairGeoTopNode; }
68+
Bool_t isRefNode() { return volumeType == kFairGeoRefNode; }
69+
Bool_t isKeepin() { return volumeType == kFairGeoKeepin; }
70+
Bool_t isModule() { return volumeType == kFairGeoModule; }
7171
Int_t getCopyNo();
7272
FairGeoBasicShape* getShapePointer() { return pShape; }
7373
FairGeoNode* getMotherNode() { return pMother; }

fairroot/geobase/FairGeoVolume.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -128,9 +128,7 @@ void FairGeoVolume::clear()
128128
void FairGeoVolume::print()
129129
{
130130
// prints all parameters of a volume
131-
cout << "Volume: " << (const_cast<const char*>(fName.Data()))
132-
<< " Shape: " << (const_cast<const char*>(shape.Data()))
133-
<< " Mother: " << (const_cast<const char*>(mother.Data())) << '\n';
131+
cout << "Volume: " << fName.Data() << " Shape: " << shape.Data() << " Mother: " << mother.Data() << '\n';
134132
cout << "Points definition " << endl;
135133
if (points) {
136134
for (Int_t i = 0; i < nPoints; i++) {

fairroot/parbase/FairDetParRootFileIo.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -61,7 +61,7 @@ Bool_t FairDetParRootFileIo::read(FairParSet *pPar)
6161
return kTRUE;
6262
}
6363

64-
TKey *key = dynamic_cast<TKey *>(gDirectory->GetKey(name, version));
64+
TKey* key = gDirectory->GetKey(name, version);
6565
if (key) {
6666
pPar->clear();
6767
key->Read(pPar);

fairroot/parbase/FairParRootFileIo.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -211,7 +211,7 @@ void FairParRootFileIo::MergeFiles(TFile* newParFile, const TList* fnamelist)
211211
continue;
212212
}
213213

214-
TList* inputKeys = static_cast<TList*>(inFile->GetListOfKeys());
214+
TList* inputKeys = inFile->GetListOfKeys();
215215

216216
TListIter keyIter(inputKeys);
217217
TKey* inpKey;

0 commit comments

Comments
 (0)