AmpTools
LikelihoodCalculatorMPI.h
Go to the documentation of this file.
1 #if !defined(LIKELIHOODCALCULATORMPI)
2 #define LIKELIHOODCALCULATORMPI
3 
4 //******************************************************************************
5 // This file is part of AmpTools, a package for performing Amplitude Analysis
6 //
7 // Copyright Trustees of Indiana University 2010, all rights reserved
8 //
9 // This software written by Matthew Shepherd, Ryan Mitchell, and
10 // Hrayr Matevosyan at Indiana University, Bloomington
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions
14 // are met:
15 // 1. Redistributions of source code must retain the above copyright
16 // notice and author attribution, this list of conditions and the
17 // following disclaimer.
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice and author attribution, this list of conditions and the
20 // following disclaimer in the documentation and/or other materials
21 // provided with the distribution.
22 // 3. Neither the name of the University nor the names of its contributors
23 // may be used to endorse or promote products derived from this software
24 // without specific prior written permission.
25 //
26 // Creation of derivative forms of this software for commercial
27 // utilization may be subject to restriction; written permission may be
28 // obtained from the Trustees of Indiana University.
29 //
30 // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES,
31 // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA
32 // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR
33 // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR
34 // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS,
35 // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be
36 // held liable for any liability with respect to any claim by the user or
37 // any other party arising from use of the program.
38 //******************************************************************************
39 
40 #include "IUAmpToolsMPI/MPITag.h"
43 
45 class MISubject;
46 
58 {
59 
60  friend class LikelihoodManagerMPI;
61 
62  public:
63 
74 
99  LikelihoodCalculatorMPI( const IntensityManager& intenManager,
100  const NormIntInterface& normInt,
101  DataReader* dataReaderSignal,
102  DataReader* dataReaderBkgnd,
103  ParameterManagerMPI& parManager );
104 
113 
124  double operator()();
125 
126 private:
127 
128  // the following functions are used by the LikelihoodManager to trigger
129  // portions of the likeihood calculation -- they should only be called
130  // on the worker nodes
131  void updateParameters();
132  void updateAmpParameter();
133  void computeLikelihood();
134 
135  static int m_idCounter;
136 
137  void setupMPI();
138 
139  const IntensityManager& m_intenManager;
140 
141  ParameterManagerMPI& m_parManager;
142  int m_thisId;
143 
144  int m_rank;
145  int m_numProc;
146  bool m_isMaster;
147  bool m_firstPass;
148 };
149 
150 #endif
LikelihoodCalculatorMPI(const IntensityManager &intenManager, const NormIntInterface &normInt, DataReader *dataReaderSignal, DataReader *dataReaderBkgnd, ParameterManagerMPI &parManager)