28 for (
unsigned int iChain = 0; iChain < _chains.size(); iChain++) {
29 delete _chains[iChain];
37 static const std::string nullFile(
"");
46 bool GGSTFilesHandler::_AddFile(
const std::string &fileName,
bool force) {
47 static const std::string routineName(
"GGSTFilesHandler::_AddFile");
49 _files.push_back(fileName);
52 TFile *file = TFile::Open(fileName.data());
54 GGSCOUT(WARNING) <<
"File " << fileName <<
" not found. File discarded." <<
GGSENDL;
59 if (file->IsZombie()) {
60 GGSCOUT(WARNING) <<
"File " << fileName <<
" cannot be opened. File discarded." <<
GGSENDL;
69 std::unique_ptr<GGSTSimInfo> simInfo((
GGSTSimInfo *)(file->Get(
"GGSSimInfo")));
70 if (simInfo == NULL) {
71 GGSCOUT(WARNING) <<
"GGS simulation info not present in file " << fileName <<
". File discarded." <<
GGSENDL;
77 std::unique_ptr<GGSTGeoParams> geoParams((
GGSTGeoParams *)(file->Get(
"GGSGeoParams")));
78 std::unique_ptr<GGSTParameters> genParams((
GGSTParameters *)(file->Get(
"GGSGenParams")));
79 if (_files.size() == 1) {
84 _geoParams = *geoParams;
87 _genParams = *genParams;
90 if (!(simInfo->IsSameSimAs(_simInfo))) {
91 GGSCOUT(WARNING) <<
"Simulation info in file " << fileName <<
" are inconsistent with those in file "
92 << _files[0] <<
". File discarded." <<
GGSENDL;
94 }
else if (!(geoParams->AreSameParamsAs(_geoParams))) {
95 GGSCOUT(WARNING) <<
"Geometry parameters in file " << fileName <<
" are inconsistent with those in file "
96 << _files[0] <<
". File discarded." <<
GGSENDL;
98 }
else if (!(genParams->AreSameParamsAs(_genParams))) {
99 GGSCOUT(WARNING) <<
"Generator parameters in file " << fileName <<
" are inconsistent with those in file "
100 << _files[0] <<
". File discarded." <<
GGSENDL;
111 void GGSTFilesHandler::_SortFiles() {
112 static const std::string routineName(
"GGSTFilesHandler::_SortFiles");
114 if (_chains.size() > 0) {
115 GGSCOUT(WARNING) <<
"Can't sort files after chain creation." <<
GGSENDL;
119 sort(_files.begin(), _files.end());
121 TFile *file0 = TFile::Open(_files[0].data());
122 _simInfo = *((
GGSTSimInfo *)(file0->Get(
"GGSSimInfo")));
~GGSTFilesHandler()
Destructor.
GGSTFilesHandler()
Constructor.
Class for storing the geometry parameters on Root output file.
unsigned int GetNFiles()
The number of files handled by this object.
A class to store simulation informations.
const std::string & GetFileName(unsigned int iFile)
Fetch the name of a handled file.
Class for writing parameters into the output Root file.