AmpTools
IntensityManager.h
Go to the documentation of this file.
1 #if !defined(INTENSITYMANAGER)
2 #define INTENSITYMANAGER
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 "IUAmpTools/AmpVecs.h"
42 
43 #include <string>
44 #include <vector>
45 #include <map>
46 #include <complex>
47 
48 class ConfigurationInfo;
49 class NormIntInterface;
50 
51 using namespace std;
52 
54 
55 public:
56 
57  enum Type { kAmplitude, kMoment };
58 
59  IntensityManager( const vector< string >& reaction,
60  const string& reactionName);
61 
62  virtual ~IntensityManager() {}
63 
70  virtual Type type() const = 0;
71 
72 
79  virtual unsigned int maxFactorStoragePerEvent() const = 0;
80 
92  virtual unsigned int termStoragePerEvent() const = 0;
93 
94  /*
95  * These functions perform computations based on the current state
96  * of the IntensityManager and should be defined by the the derived class.
97  */
98 
112  virtual bool calcTerms( AmpVecs& ampVecs ) const = 0;
113 
127  virtual double calcIntensities( AmpVecs& ampVecs ) const = 0;
128 
141  virtual double calcSumLogIntensity( AmpVecs& ampVecs ) const = 0;
142 
156  virtual void calcIntegrals( AmpVecs& ampVecs, int iNGenEvents ) const = 0;
157 
166  double calcIntensity( const Kinematics* kinematics ) const;
167 
168  //
169  // The functions below all return information that describes the
170  // state and configuration of the AmplitudeManager.
171  //
172 
181  const vector< string >& getTermNames() const;
182 
189  const AmpParameter& getScale( const string& name ) const;
190 
191 
201  virtual bool hasTermWithFreeParam() const = 0;
202 
211  int termIndex( const string& termName ) const;
212 
217  string reactionName() const {return m_reactionName;}
218 
231  complex< double > productionFactor( const string& termName ) const;
232 
238  complex< double > productionFactor( int termIndex ) const;
239 
248  void prodFactorArray( double* array ) const;
249 
261  bool hasTerm( const string& termName ) const;
262 
263  //
264  // The functions below modify the state of the AmplitudeManager
265  //
266 
275  virtual void setupFromConfigurationInfo( const ConfigurationInfo* configInfo ) = 0;
276 
292  int addTerm( const string& termName, const string& scale = "1.0" );
293 
312  void setDefaultProductionFactor( const string& termName,
313  complex< double > prodAmp );
314 
335  void setExternalProductionFactor( const string& ampName,
336  const complex< double >* prodAmpPtr );
337 
359  virtual void setParPtr( const string& termName, const string& parName,
360  const double* ampParPtr );
361 
382  virtual void setParValue( const string& termName, const string& parName,
383  double ampParValue );
384 
390  virtual void updatePar( const string& parName ) const {}
391 
398  void resetProductionFactors();
399 
429  // void renormalizeTerms( const NormIntInterface* normInt );
430 
441  // void disableRenormalization();
442 
450  bool termsAreRenormalized() const { return m_renormalizeTerms; }
451 
452 protected:
453 
454  const NormIntInterface* normInt() const { return m_normInt; }
455 
456 private:
457 
458  string m_reactionName;
459 
460  // term name -> production term
461  map< string, const complex< double >* > m_prodFactor;
462 
463  // term index -> production amplitude
464  vector< const complex< double >* > m_prodFactorVec;
465 
466  // a vector of amplitude names -- keep also a set of amplitude indices
467  // these can be useful speeding up intesity calculations by removing
468  // slower map element look-ups
469  vector< string > m_termNames;
470  map< string, int > m_termIndex;
471 
472  // a map to hold a set of default production factors
473  map< string, complex< double > > m_defaultProdFactor;
474 
475  // a flag to track if we are renormalizing the terms
476  bool m_renormalizeTerms;
477  const NormIntInterface* m_normInt;
478 
479  vector< AmpParameter > m_termScaleVec;
480 
481 };
482 
483 
484 #endif
string reactionName() const
virtual void updatePar(const string &parName) const
const NormIntInterface * normInt() const
bool termsAreRenormalized() const
virtual ~IntensityManager()