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 @@ ...@@ -6,13 +6,17 @@
#include "TFile.h" // for TFile #include "TFile.h" // for TFile
#include "TObjArray.h" #include "TObjArray.h"
#include <string> // for string, find, substr #include <string> // for string, find, substr
#include <sys/stat.h> // for stcuct stat #include <sys/stat.h> // for stcuct stat
namespace Cbm { namespace Cbm
namespace File { {
bool IsRootFile(std::string filename) { namespace File
{
bool IsRootFile(std::string filename)
{
// Currently plain root files and root files stored in a zip file are supported. // 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 // 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. // name of the zip file from the name of the root file which is inside the zip file.
...@@ -30,7 +34,8 @@ namespace Cbm { ...@@ -30,7 +34,8 @@ namespace Cbm {
if (found != std::string::npos) { if (found != std::string::npos) {
checkFilename = filename.substr(0, found); checkFilename = filename.substr(0, found);
membername = filename.substr(found + 1); membername = filename.substr(found + 1);
} else { }
else {
checkFilename = filename; checkFilename = filename;
} }
...@@ -40,9 +45,8 @@ namespace Cbm { ...@@ -40,9 +45,8 @@ namespace Cbm {
// In case of a root file contained in a zip archive check if the zip file // In case of a root file contained in a zip archive check if the zip file
// exist // exist
struct stat buffer; struct stat buffer;
if (stat(checkFilename.c_str(), &buffer) == 0) { if (stat(checkFilename.c_str(), &buffer) == 0) { wasfound = kTRUE; }
wasfound = kTRUE; else {
} else {
wasfound = kFALSE; wasfound = kFALSE;
LOG(error) << "Input File " << checkFilename << " not found"; LOG(error) << "Input File " << checkFilename << " not found";
} }
...@@ -55,31 +59,33 @@ namespace Cbm { ...@@ -55,31 +59,33 @@ namespace Cbm {
if (archive) { if (archive) {
TObjArray* members = archive->GetMembers(); TObjArray* members = archive->GetMembers();
if (members->FindObject(membername.c_str()) == 0) { if (members->FindObject(membername.c_str()) == 0) {
LOG(error) << "File " << membername << " not found in zipfile " LOG(error) << "File " << membername << " not found in zipfile " << checkFilename;
<< checkFilename;
wasfound = kFALSE; wasfound = kFALSE;
} else { }
LOG(info) << "File " << membername << " found in zipfile " else {
<< checkFilename; LOG(info) << "File " << membername << " found in zipfile " << checkFilename;
wasfound = kTRUE; wasfound = kTRUE;
} }
} else { }
LOG(error) << "Zipfile " << checkFilename else {
<< " does not contain an archive"; LOG(error) << "Zipfile " << checkFilename << " does not contain an archive";
wasfound = kFALSE; wasfound = kFALSE;
} }
fzip->Close(); fzip->Close();
delete fzip; delete fzip;
} else { }
else {
LOG(error) << "Could not open zipfile " << checkFilename; LOG(error) << "Could not open zipfile " << checkFilename;
wasfound = kFALSE; wasfound = kFALSE;
} }
} else { }
else {
TFile* rootfile = TFile::Open(checkFilename.c_str()); TFile* rootfile = TFile::Open(checkFilename.c_str());
if (rootfile->IsOpen()) { if (rootfile->IsOpen()) {
LOG(info) << "File " << checkFilename << " is a ROOT file."; LOG(info) << "File " << checkFilename << " is a ROOT file.";
wasfound = kTRUE; wasfound = kTRUE;
} else { }
else {
LOG(error) << "File " << checkFilename << " is no ROOT file."; LOG(error) << "File " << checkFilename << " is no ROOT file.";
wasfound = kFALSE; wasfound = kFALSE;
} }
......
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
#include <string> // for string #include <string> // for string
namespace Cbm { namespace Cbm
namespace File { {
namespace File
{
/** /**
* \brief Check if a the file exist and is a root file * \brief Check if a the file exist and is a root file
* \param[in] filename The filename of the file to be checked * \param[in] filename The filename of the file to be checked
......
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
#include "FairLogger.h" #include "FairLogger.h"
#include "FairPrimaryGenerator.h" // for FairPrimaryGenerator #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 "TArchiveFile.h" // for TArchiveFile
#include "TChain.h" // for TChain #include "TChain.h" // for TChain
#include "TClonesArray.h" // for TClonesArray #include "TClonesArray.h" // for TClonesArray
...@@ -21,7 +17,12 @@ ...@@ -21,7 +17,12 @@
#include "TLorentzVector.h" // for TLorentzVector #include "TLorentzVector.h" // for TLorentzVector
#include "TTree.h" // for TTree #include "TTree.h" // for TTree
#include "TVector3.h" // for TVector3 #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 <stddef.h> // for NULL
#include <iostream> // for operator<<, basic_ostream, etc #include <iostream> // for operator<<, basic_ostream, etc
...@@ -54,9 +55,9 @@ CbmPlutoGenerator::CbmPlutoGenerator(const Char_t* fileName) ...@@ -54,9 +55,9 @@ CbmPlutoGenerator::CbmPlutoGenerator(const Char_t* fileName)
if (Cbm::File::IsRootFile(fileName)) { if (Cbm::File::IsRootFile(fileName)) {
fInputChain->Add(fileName); fInputChain->Add(fileName);
fInputChain->SetBranchAddress("Particles", &fParticles); fInputChain->SetBranchAddress("Particles", &fParticles);
LOG(info) << "CbmPlutoGenerator: Add file " << fileName LOG(info) << "CbmPlutoGenerator: Add file " << fileName << " to input chain";
<< " to input chain"; }
} else { else {
LOG(fatal) << "Problem opening file " << fileName; LOG(fatal) << "Problem opening file " << fileName;
} }
} }
...@@ -77,7 +78,8 @@ CbmPlutoGenerator::CbmPlutoGenerator(std::vector<std::string> fileNames) ...@@ -77,7 +78,8 @@ CbmPlutoGenerator::CbmPlutoGenerator(std::vector<std::string> fileNames)
if (Cbm::File::IsRootFile(name)) { if (Cbm::File::IsRootFile(name)) {
fInputChain->Add(name.c_str()); fInputChain->Add(name.c_str());
LOG(info) << "CbmPlutoGenerator: Add file " << name << " to input chain"; LOG(info) << "CbmPlutoGenerator: Add file " << name << " to input chain";
} else { }
else {
LOG(fatal) << "Problem opening file " << name; LOG(fatal) << "Problem opening file " << name;
} }
} }
......
...@@ -5,6 +5,27 @@ ...@@ -5,6 +5,27 @@
#include "CbmTransport.h" #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 "TDatabasePDG.h"
#include "TG4RunConfiguration.h" #include "TG4RunConfiguration.h"
#include "TGeant3.h" #include "TGeant3.h"
...@@ -18,35 +39,15 @@ ...@@ -18,35 +39,15 @@
#include "TSystem.h" #include "TSystem.h"
#include "TVector3.h" #include "TVector3.h"
#include "TVirtualMC.h" #include "TVirtualMC.h"
#include <array>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <array>
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <string> #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; using std::stringstream;
...@@ -110,7 +111,8 @@ void CbmTransport::AddInput(const char* fileName, ECbmGenerator genType) { ...@@ -110,7 +111,8 @@ void CbmTransport::AddInput(const char* fileName, ECbmGenerator genType) {
LOG(fatal) << GetName() << ": Input file " << fileName << " not found!"; LOG(fatal) << GetName() << ": Input file " << fileName << " not found!";
return; return;
} }
} else { }
else {
if (!Cbm::File::IsRootFile(fileName)) { if (!Cbm::File::IsRootFile(fileName)) {
LOG(fatal) << GetName() << ": Input file " << fileName << " not found!"; LOG(fatal) << GetName() << ": Input file " << fileName << " not found!";
return; 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