laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
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 
34 #include "LauKMatrixPropagator.hh"
35 
36 #include <iostream>
37 using std::cout;
38 using std::endl;
39 
40 // the singleton instance
42 
44 {
45  // Constructor
46  map_.clear();
47 }
48 
50 {
51  // Destructor
52  KMatrixPropMap::iterator iter;
53  for ( iter = map_.begin(); iter != map_.end(); ++iter ) {
54  LauKMatrixPropagator* thePropagator = iter->second;
55  delete thePropagator;
56  }
57  map_.clear();
58 }
59 
61 {
62  if ( theFactory_ == 0 ) {
64  }
65  return theFactory_;
66 }
67 
69  const TString& paramFileName,
70  Int_t resPairAmpInt,
71  Int_t nChannels,
72  Int_t nPoles,
73  Int_t rowIndex )
74 {
75  LauKMatrixPropagator* thePropagator( 0 );
76 
77  KMatrixPropMap::iterator iter = map_.find( name );
78 
79  if ( iter != map_.end() ) {
80  // We have already made this propagator
81  thePropagator = iter->second;
82  } else {
83  // The propagator does not exist. Create it and store it in the map.
84  thePropagator =
85  new LauKMatrixPropagator( name, paramFileName, resPairAmpInt, nChannels, nPoles, rowIndex );
86  map_[name] = thePropagator;
87  }
88 
89  return thePropagator;
90 }
KMatrixPropMap map_
The map used to store the propagator information.
static LauKMatrixPropFactory * theFactory_
The singleton instance.
LauKMatrixPropFactory()
Private constructor (to ensure the singleton nature of this class)
virtual ~LauKMatrixPropFactory()
Destructor.
File containing declaration of LauKMatrixPropFactory class.
Class for defining a K-matrix propagator.
Factory class for the K-matrix propagators.
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.
const TString & name() const
The parameter name.
File containing declaration of LauKMatrixPropagator class.
static LauKMatrixPropFactory * getInstance()
Get a static instance of this factory class. Only one is created per application.