laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauKMatrixPropFactory.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2008 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
15 // Class for storing K-matrix propagator objects
16 // using the factory method.
17 
18 #include "LauKMatrixPropFactory.hh"
19 #include "LauKMatrixPropagator.hh"
20 
21 #include <iostream>
22 using std::cout;
23 using std::endl;
24 
25 // the singleton instance
27 
29 {
30  // Constructor
31  map_.clear();
32 }
33 
35 {
36  // Destructor
37  KMatrixPropMap::iterator iter;
38  for (iter = map_.begin(); iter != map_.end(); ++iter) {
39  LauKMatrixPropagator* thePropagator = iter->second;
40  delete thePropagator;
41  }
42  map_.clear();
43 }
44 
46 {
47  if (theFactory_ == 0) {
49  }
50  return theFactory_;
51 }
52 
53 LauKMatrixPropagator* LauKMatrixPropFactory::getPropagator(const TString& name, const TString& paramFileName,
54  Int_t resPairAmpInt, Int_t nChannels,
55  Int_t nPoles, Int_t rowIndex)
56 {
57  LauKMatrixPropagator* thePropagator(0);
58 
59  KMatrixPropMap::iterator iter = map_.find(name);
60 
61  if ( iter != map_.end() ) {
62  // We have already made this propagator
63  thePropagator = iter->second;
64  } else {
65  // The propagator does not exist. Create it and store it in the map.
66  thePropagator = new LauKMatrixPropagator(name, paramFileName, resPairAmpInt,
67  nChannels, nPoles, rowIndex);
68  map_[name] = thePropagator;
69  }
70 
71  return thePropagator;
72 }
73 
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.