Skip to content
Snippets Groups Projects
Commit d30f9bab authored by Administrator's avatar Administrator
Browse files

Apply clang format

parent 990a7fa4
No related branches found
No related tags found
No related merge requests found
......@@ -6,13 +6,17 @@
#include "TFile.h" // for TFile
#include "TObjArray.h"
#include <string> // for string, find, substr
#include <string> // for string, find, substr
#include <sys/stat.h> // for stcuct stat
namespace Cbm {
namespace File {
bool IsRootFile(std::string filename) {
namespace Cbm
{
namespace File
{
bool IsRootFile(std::string filename)
{
// Currently plain root files and root files stored in a zip file are supported.
// The destiction between the two is a "#" in the filename string which separates the
// name of the zip file from the name of the root file which is inside the zip file.
......@@ -30,7 +34,8 @@ namespace Cbm {
if (found != std::string::npos) {
checkFilename = filename.substr(0, found);
membername = filename.substr(found + 1);
} else {
}
else {
checkFilename = filename;
}
......@@ -40,9 +45,8 @@ namespace Cbm {
// In case of a root file contained in a zip archive check if the zip file
// exist
struct stat buffer;
if (stat(checkFilename.c_str(), &buffer) == 0) {
wasfound = kTRUE;
} else {
if (stat(checkFilename.c_str(), &buffer) == 0) { wasfound = kTRUE; }
else {
wasfound = kFALSE;
LOG(error) << "Input File " << checkFilename << " not found";
}
......@@ -55,31 +59,33 @@ namespace Cbm {
if (archive) {
TObjArray* members = archive->GetMembers();
if (members->FindObject(membername.c_str()) == 0) {
LOG(error) << "File " << membername << " not found in zipfile "
<< checkFilename;
LOG(error) << "File " << membername << " not found in zipfile " << checkFilename;
wasfound = kFALSE;
} else {
LOG(info) << "File " << membername << " found in zipfile "
<< checkFilename;
}
else {
LOG(info) << "File " << membername << " found in zipfile " << checkFilename;
wasfound = kTRUE;
}
} else {
LOG(error) << "Zipfile " << checkFilename
<< " does not contain an archive";
}
else {
LOG(error) << "Zipfile " << checkFilename << " does not contain an archive";
wasfound = kFALSE;
}
fzip->Close();
delete fzip;
} else {
}
else {
LOG(error) << "Could not open zipfile " << checkFilename;
wasfound = kFALSE;
}
} else {
}
else {
TFile* rootfile = TFile::Open(checkFilename.c_str());
if (rootfile->IsOpen()) {
LOG(info) << "File " << checkFilename << " is a ROOT file.";
wasfound = kTRUE;
} else {
}
else {
LOG(error) << "File " << checkFilename << " is no ROOT file.";
wasfound = kFALSE;
}
......
......@@ -3,8 +3,10 @@
#include <string> // for string
namespace Cbm {
namespace File {
namespace Cbm
{
namespace File
{
/**
* \brief Check if a the file exist and is a root file
* \param[in] filename The filename of the file to be checked
......
......@@ -9,10 +9,6 @@
#include "FairLogger.h"
#include "FairPrimaryGenerator.h" // for FairPrimaryGenerator
#include "PDataBase.h" // for PDataBase
#include "PParticle.h" // for PParticle
#include "PStaticData.h" // for PStaticData
#include "TArchiveFile.h" // for TArchiveFile
#include "TChain.h" // for TChain
#include "TClonesArray.h" // for TClonesArray
......@@ -21,7 +17,12 @@
#include "TLorentzVector.h" // for TLorentzVector
#include "TTree.h" // for TTree
#include "TVector3.h" // for TVector3
#include <iosfwd> // for ostream
#include <iosfwd> // for ostream
#include "PDataBase.h" // for PDataBase
#include "PParticle.h" // for PParticle
#include "PStaticData.h" // for PStaticData
//#include <stddef.h> // for NULL
#include <iostream> // for operator<<, basic_ostream, etc
......@@ -54,9 +55,9 @@ CbmPlutoGenerator::CbmPlutoGenerator(const Char_t* fileName)
if (Cbm::File::IsRootFile(fileName)) {
fInputChain->Add(fileName);
fInputChain->SetBranchAddress("Particles", &fParticles);
LOG(info) << "CbmPlutoGenerator: Add file " << fileName
<< " to input chain";
} else {
LOG(info) << "CbmPlutoGenerator: Add file " << fileName << " to input chain";
}
else {
LOG(fatal) << "Problem opening file " << fileName;
}
}
......@@ -77,7 +78,8 @@ CbmPlutoGenerator::CbmPlutoGenerator(std::vector<std::string> fileNames)
if (Cbm::File::IsRootFile(name)) {
fInputChain->Add(name.c_str());
LOG(info) << "CbmPlutoGenerator: Add file " << name << " to input chain";
} else {
}
else {
LOG(fatal) << "Problem opening file " << name;
}
}
......
......@@ -5,6 +5,27 @@
#include "CbmTransport.h"
#include "CbmBeamProfile.h"
#include "CbmEventGenerator.h"
#include "CbmFieldMap.h"
#include "CbmFieldPar.h"
#include "CbmFileUtils.h"
#include "CbmGeant3Settings.h"
#include "CbmGeant4Settings.h"
#include "CbmPlutoGenerator.h"
#include "CbmSetup.h"
#include "CbmStack.h"
#include "CbmTarget.h"
#include "CbmUnigenGenerator.h"
#include "FairLogger.h"
#include "FairMonitor.h"
#include "FairParRootFileIo.h"
#include "FairRunSim.h"
#include "FairRuntimeDb.h"
#include "FairSystemInfo.h"
#include "FairUrqmdGenerator.h"
#include "TDatabasePDG.h"
#include "TG4RunConfiguration.h"
#include "TGeant3.h"
......@@ -18,35 +39,15 @@
#include "TSystem.h"
#include "TVector3.h"
#include "TVirtualMC.h"
#include <array>
#include <boost/filesystem.hpp>
#include <array>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include "FairLogger.h"
#include "FairMonitor.h"
#include "FairParRootFileIo.h"
#include "FairRunSim.h"
#include "FairRuntimeDb.h"
#include "FairSystemInfo.h"
#include "FairUrqmdGenerator.h"
#include "CbmBeamProfile.h"
#include "CbmEventGenerator.h"
#include "CbmFieldMap.h"
#include "CbmFieldPar.h"
#include "CbmFileUtils.h"
#include "CbmPlutoGenerator.h"
#include "CbmSetup.h"
#include "CbmStack.h"
#include "CbmTarget.h"
#include "CbmUnigenGenerator.h"
#include "CbmGeant3Settings.h"
#include "CbmGeant4Settings.h"
using std::stringstream;
......@@ -110,7 +111,8 @@ void CbmTransport::AddInput(const char* fileName, ECbmGenerator genType) {
LOG(fatal) << GetName() << ": Input file " << fileName << " not found!";
return;
}
} else {
}
else {
if (!Cbm::File::IsRootFile(fileName)) {
LOG(fatal) << GetName() << ": Input file " << fileName << " not found!";
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment