laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
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 
40 // the singleton instance
42 
44 
46 {
47  // Constructor
48  map_.clear();
49 }
50 
52 {
53  // Destructor
54  KMatrixPropMap::iterator iter;
55  for (iter = map_.begin(); iter != map_.end(); ++iter) {
56  LauKMatrixPropagator* thePropagator = iter->second;
57  delete thePropagator;
58  }
59  map_.clear();
60 }
61 
63 {
64  if (theFactory_ == 0) {
66  }
67  return theFactory_;
68 }
69 
70 LauKMatrixPropagator* LauKMatrixPropFactory::getPropagator(const TString& name, const TString& paramFileName,
71  Int_t resPairAmpInt, Int_t nChannels,
72  Int_t nPoles, Int_t rowIndex)
73 {
74  LauKMatrixPropagator* thePropagator(0);
75 
76  KMatrixPropMap::iterator iter = map_.find(name);
77 
78  if ( iter != map_.end() ) {
79  // We have already made this propagator
80  thePropagator = iter->second;
81  } else {
82  // The propagator does not exist. Create it and store it in the map.
83  thePropagator = new LauKMatrixPropagator(name, paramFileName, resPairAmpInt,
84  nChannels, nPoles, rowIndex);
85  map_[name] = thePropagator;
86  }
87 
88  return thePropagator;
89 }
90 
File containing declaration of LauKMatrixPropFactory class.
ClassImp(LauAbsCoeffSet)
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.