AmpTools
AmpToolsInterface.h
Go to the documentation of this file.
1 #if !defined(AMPTOOLSINTERFACE)
2 #define AMPTOOLSINTERFACE
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 <iostream>
41 #include <utility>
42 #include <string>
43 #include <vector>
44 #include <map>
45 #include <complex>
46 #include <fstream>
47 
50 #include "IUAmpTools/Amplitude.h"
51 #include "IUAmpTools/AmpVecs.h"
52 #include "IUAmpTools/Kinematics.h"
58 
59 class FitResults;
60 
61 using namespace std;
62 
87 
88  public:
89 
90  enum FunctionalityFlag { kFull, kMCGeneration, kPlotGeneration };
91 
92  AmpToolsInterface( FunctionalityFlag flag = kFull );
93 
102  AmpToolsInterface( ConfigurationInfo* cfgInfo, FunctionalityFlag flag = kFull );
103 
107  virtual ~AmpToolsInterface() { clear(); }
108 
114  static void registerAmplitude( const Amplitude& defaultAmplitude);
115 
121  static void registerDataReader( const DataReader& defaultDataReader);
122 
127  void resetConfigurationInfo(ConfigurationInfo* cfgInfo);
128 
129 
136  { return m_configurationInfo; }
137 
138 
144  { return m_minuitMinimizationManager; }
145 
151  { return m_parameterManager;}
152 
153 
158  IntensityManager* intensityManager (const string& reactionName) const;
159 
160 
165  DataReader* dataReader (const string& reactionName) const;
166 
171  DataReader* bkgndReader (const string& reactionName) const;
172 
177  DataReader* accMCReader (const string& reactionName) const;
178 
179 
184  DataReader* genMCReader (const string& reactionName) const;
185 
186 
191  NormIntInterface* normIntInterface (const string& reactionName) const;
192 
197  const FitResults* fitResults() const { return m_fitResults; }
198 
199 
208  LikelihoodCalculator* likelihoodCalculator (const string& reactionName) const;
209 
210 
218  double likelihood() const;
219 
223  double likelihood(const string& reactionName) const;
224 
225 
229  virtual void finalizeFit();
230 
231 
243  void clearEvents(unsigned int iDataSet = 0);
244 
255  void loadEvents(DataReader* dataReader,
256  unsigned int iDataSet = 0);
257 
271  void loadEvent(Kinematics* kin, int iEvent = 0, int nEventsTotal = 1,
272  unsigned int iDataSet = 0);
273 
286  double processEvents(string reactionName,
287  unsigned int iDataSet = 0);
288 
289 
298  int numEvents(unsigned int iDataSet = 0) const;
299 
300 
310  double intensity(int iEvent,
311  unsigned int iDataSet = 0) const;
312 
313 
325  double alternateIntensity(int iEvent,
326  unsigned int iDataSet = 0) const;
327 
328 
341  complex<double> decayAmplitude (int iEvent, string ampName,
342  unsigned int iDataSet = 0) const;
343 
344 
358  complex<double> scaledProductionAmplitude (string ampName,
359  unsigned int iDataSet = 0) const;
360 
361 
371  Kinematics* kinematics(int iEvent,
372  unsigned int iDataSet = 0);
373 
374 
379  void printKinematics (string reactionName, Kinematics* kin) const;
380 
381 
386  void printAmplitudes (string reactionName, Kinematics* kin) const;
387 
392  void printIntensity (string reactionName, Kinematics* kin) const;
393 
398  void printEventDetails (string reactionName, Kinematics* kin) const;
399 
400 
401  protected:
402 
403  AmpToolsInterface( const AmpToolsInterface& ati );
404  AmpToolsInterface& operator=( AmpToolsInterface& ati );
405 
407 
408  void clear();
409 
413 
414  vector<IntensityManager*> m_intensityManagers;
415 
416 
417  map<string,DataReader*> m_dataReaderMap;
418  map<string,DataReader*> m_bkgndReaderMap;
419  map<string,DataReader*> m_genMCReaderMap;
420  map<string,DataReader*> m_accMCReaderMap;
421 
422  map<string,NormIntInterface*> m_normIntMap;
423  map<string,LikelihoodCalculator*> m_likCalcMap;
424 
425  static vector<Amplitude*> m_userAmplitudes;
426  static vector<DataReader*> m_userDataReaders;
427 
428  static const int MAXAMPVECS = 50;
429  AmpVecs m_ampVecs[MAXAMPVECS];
430  string m_ampVecsReactionName[MAXAMPVECS];
431 
433 
434 };
435 
436 
437 
438 #endif
static vector< Amplitude * > m_userAmplitudes
vector< IntensityManager * > m_intensityManagers
static vector< DataReader * > m_userDataReaders
virtual ~AmpToolsInterface()
FunctionalityFlag m_functionality
ParameterManager * parameterManager() const
map< string, NormIntInterface * > m_normIntMap
map< string, DataReader * > m_dataReaderMap
map< string, DataReader * > m_accMCReaderMap
ParameterManager * m_parameterManager
MinuitMinimizationManager * minuitMinimizationManager() const
map< string, DataReader * > m_genMCReaderMap
ConfigurationInfo * m_configurationInfo
map< string, DataReader * > m_bkgndReaderMap
ConfigurationInfo * configurationInfo() const
map< string, LikelihoodCalculator * > m_likCalcMap
FitResults * m_fitResults
const FitResults * fitResults() const
MinuitMinimizationManager * m_minuitMinimizationManager