laura is hosted by Hepforge, IPPP Durham
Laura++  v3r4
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauKMatrixPropFactory.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2008 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
29 // Class for storing K-matrix propagator objects
30 // using the factory method.
31 
32 #include "LauKMatrixPropFactory.hh"
33 #include "LauKMatrixPropagator.hh"
34 
35 #include <iostream>
36 using std::cout;
37 using std::endl;
38 
39 // the singleton instance
41 
43 {
44  // Constructor
45  map_.clear();
46 }
47 
49 {
50  // Destructor
51  KMatrixPropMap::iterator iter;
52  for (iter = map_.begin(); iter != map_.end(); ++iter) {
53  LauKMatrixPropagator* thePropagator = iter->second;
54  delete thePropagator;
55  }
56  map_.clear();
57 }
58 
60 {
61  if (theFactory_ == 0) {
63  }
64  return theFactory_;
65 }
66 
67 LauKMatrixPropagator* LauKMatrixPropFactory::getPropagator(const TString& name, const TString& paramFileName,
68  Int_t resPairAmpInt, Int_t nChannels,
69  Int_t nPoles, Int_t rowIndex)
70 {
71  LauKMatrixPropagator* thePropagator(0);
72 
73  KMatrixPropMap::iterator iter = map_.find(name);
74 
75  if ( iter != map_.end() ) {
76  // We have already made this propagator
77  thePropagator = iter->second;
78  } else {
79  // The propagator does not exist. Create it and store it in the map.
80  thePropagator = new LauKMatrixPropagator(name, paramFileName, resPairAmpInt,
81  nChannels, nPoles, rowIndex);
82  map_[name] = thePropagator;
83  }
84 
85  return thePropagator;
86 }
87 
File containing declaration of LauKMatrixPropFactory class.
KMatrixPropMap map_
The map used to store the propagator information.
const TString & name() const
The parameter name.
LauKMatrixPropFactory()
Private constructor (to ensure the singleton nature of this class)
LauKMatrixPropagator * getPropagator(const TString &name, const TString &paramFileName, Int_t resPairAmpInt, Int_t nChannels, Int_t nPoles, Int_t rowIndex)
Retrieve the propagator if it already exists, otherwise create one.
File containing declaration of LauKMatrixPropagator class.
static LauKMatrixPropFactory * getInstance()
Get a static instance of this factory class. Only one is created per application. ...
virtual ~LauKMatrixPropFactory()
Destructor.
static LauKMatrixPropFactory * theFactory_
The singleton instance.
Factory class for the K-matrix propagators.
Class for defining a K-matrix propagator.