ATLAS Offline Software
Loading...
Searching...
No Matches
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
22namespace 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
55 IShowerLib * iterateTTree(TFile *fname)
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}
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Class for shower library shower lib interface.
Definition IShowerLib.h:40
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Namespace for the ShowerLib related classes.
Definition StepInfo.h:17
std::vector< readTTree > vectorTTree
vectorTTree vectorTTreeFull()
std::vector< readStruct > vectorStruct
vectorStruct vectorStructFull()
IShowerLib * iterateStruct(const std::string &fname)
IShowerLib * iterateTTree(TFile *fname)