ATLAS Offline Software
ShowerLibList.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * ShowerLibList.cpp
7  *
8  * Created on: Mar 24, 2011
9  * Author: sedov
10  */
11 
13 #include <vector>
14 
15 
16 // list of all libraries
21 
22 namespace ShowerLib {
23 
24  typedef IShowerLib* (*readTTree)(TFile*);
25  typedef std::vector<readTTree> vectorTTree;
26  typedef IShowerLib* (*readStruct)(const std::string&);
27  typedef std::vector<readStruct> vectorStruct;
28 
30  {
31  vectorTTree ttreeVector;
32 
33  // List all TTree reader functions
34  ttreeVector.push_back(&(EtaEnergyShowerLib::readFromROOTFile));
35  ttreeVector.push_back(&(FCALDistEnergyShowerLib::readFromROOTFile));
36  ttreeVector.push_back(&(FCALDistEtaEnergyShowerLib::readFromROOTFile));
37  ttreeVector.push_back(&(TestShowerLib::readFromROOTFile));
38 
39  return ttreeVector;
40  }
41 
43  {
44  vectorStruct structVector;
45 
46  // List all Struct reader functions
47  structVector.push_back(&(EtaEnergyShowerLib::createEmptyLib));
48  structVector.push_back(&(FCALDistEnergyShowerLib::createEmptyLib));
49  structVector.push_back(&(FCALDistEtaEnergyShowerLib::createEmptyLib));
50  structVector.push_back(&(TestShowerLib::createEmptyLib));
51 
52  return structVector;
53  }
54 
56  {
57  IShowerLib* library = nullptr;
58  vectorTTree ttreeVector = vectorTTreeFull();
59  vectorTTree::const_iterator libiter;
60  for (libiter = ttreeVector.begin(); libiter != ttreeVector.end(); ++libiter) {
61  library = (**libiter)(fname);
62  if (library != nullptr) break;
63  }
64  return library;
65  }
66 
67  IShowerLib * iterateStruct(const std::string & fname)
68  {
69  IShowerLib* library = nullptr;
70  vectorStruct structVector = vectorStructFull();
71  vectorStruct::const_iterator libiter;
72  for (libiter = structVector.begin(); libiter != structVector.end(); ++libiter) {
73  library = (**libiter)(fname);
74  if (library != nullptr) break;
75  }
76  return library;
77  }
78 }
ShowerLib::TestShowerLib::readFromROOTFile
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Definition: TestShowerLib.cxx:41
FCALDistEnergyShowerLib.h
TestShowerLib.h
ShowerLib::iterateTTree
IShowerLib * iterateTTree(TFile *fname)
Definition: ShowerLibList.cxx:55
ShowerLib::EtaEnergyShowerLib::createEmptyLib
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
Definition: EtaEnergyShowerLib.cxx:62
ShowerLib::TestShowerLib::createEmptyLib
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
Definition: TestShowerLib.cxx:67
ShowerLib::vectorTTree
std::vector< readTTree > vectorTTree
Definition: ShowerLibList.cxx:25
ShowerLib::iterateStruct
IShowerLib * iterateStruct(const std::string &fname)
Definition: ShowerLibList.cxx:67
ShowerLib::EtaEnergyShowerLib::readFromROOTFile
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Definition: EtaEnergyShowerLib.cxx:36
ShowerLib::vectorStruct
std::vector< readStruct > vectorStruct
Definition: ShowerLibList.cxx:27
ShowerLib::FCALDistEtaEnergyShowerLib::createEmptyLib
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
Definition: FCALDistEtaEnergyShowerLib.cxx:94
ShowerLib::FCALDistEnergyShowerLib::createEmptyLib
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
Definition: FCALDistEnergyShowerLib.cxx:79
ShowerLib::IShowerLib
Class for shower library shower lib interface.
Definition: IShowerLib.h:40
ShowerLib::FCALDistEtaEnergyShowerLib::readFromROOTFile
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Definition: FCALDistEtaEnergyShowerLib.cxx:56
ShowerLibList.h
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
ShowerLib::vectorTTreeFull
vectorTTree vectorTTreeFull()
Definition: ShowerLibList.cxx:29
FCALDistEtaEnergyShowerLib.h
ShowerLib
Namespace for the ShowerLib related classes.
Definition: LArG4GenShowerLib.h:19
ShowerLib::FCALDistEnergyShowerLib::readFromROOTFile
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Definition: FCALDistEnergyShowerLib.cxx:53
EtaEnergyShowerLib.h
ShowerLib::vectorStructFull
vectorStruct vectorStructFull()
Definition: ShowerLibList.cxx:42