ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GIDI_settings.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GIDI_settings.hh
1 /*
2 # <<BEGIN-copyright>>
3 # <<END-copyright>>
4 */
5 
6 #define GIDI_USE_BDFLS 0
7 
8 #ifndef GIDI_settings_hpp_included
9 #define GIDI_settings_hpp_included 1
10 
11 #include <string>
12 #include <vector>
13 #include <map>
14 
15 #include <ptwX.h>
16 #include <ptwXY.h>
17 #include <statusMessageReporting.h>
18 
19 /* Disable Effective C++ warnings in GIDI header files. */
20 #if defined( __INTEL_COMPILER )
21 #pragma warning( push )
22 
23 #if __INTEL_COMPILER > 1399
24 #pragma warning( disable:2021 )
25 #elif __INTEL_COMPILER > 1199
26 #pragma warning( disable:2304 )
27 #endif
28 
29 #endif
30 
31 #define GIDI_settings_projectileEnergyMode_continuousEnergy 1
32 #define GIDI_settings_projectileEnergyMode_grouped ( 1 << 1 )
33 #define GIDI_settings_projectileEnergyMode_fixedGrid ( 1 << 2 )
34 
36 
37  private:
38  std::string mLabel;
39  std::vector<double> mBoundaries;
40 
41  public:
42  GIDI_settings_group( std::string const &label = "empty", int size = 0 );
43  GIDI_settings_group( std::string const &label, int length, double const *values );
44  GIDI_settings_group( std::string const &label, std::vector<double> const &boundaries );
48 
49  inline double operator[]( int const index ) const { return( mBoundaries[index] ); }
50  inline int size( void ) const { return( (int) mBoundaries.size( ) ); }
51  inline int getNumberOfGroups( void ) const { return( (int) ( mBoundaries.size( ) - 1 ) ); }
52  inline double const *pointer( void ) const { return( &(mBoundaries[0]) ); }
53 
54  void setFromCDoubleArray( int length, double *values );
55  inline std::string getLabel( ) const { return( mLabel ); }
56  int getGroupIndexFromEnergy( double energy, bool encloseOutOfRange ) const;
57  inline bool isLabel( std::string &label ) const { return( label == mLabel ); }
58  void print( bool outline = false, int valuesPerLine = 10 ) const;
59 
60  private:
61  void initialize( std::string const &label, int size, int length, double const *values );
62 };
63 
64 #if GIDI_USE_BDFLS
65 #include <cbdfls.h>
66 
67 class GIDI_settings_groups_from_bdfls {
68 
69  private:
70  std::vector<GIDI_settings_group> mGroups;
71 
72  public:
73  GIDI_settings_groups_from_bdfls( std::string const &fileName );
74  GIDI_settings_groups_from_bdfls( char const *fileName );
75  GIDI_settings_groups_from_bdfls( cbdfls_file const *bdfls );
76  ~GIDI_settings_groups_from_bdfls( );
77 
78  GIDI_settings_group getViaGID( int gid ) const;
79  std::vector<std::string> getLabels( void ) const;
80  std::vector<int> getGIDs( void ) const;
81  void print( bool outline = true, int valuesPerLine = 10 ) const;
82 
83  private:
84  void initialize( char const *fileName );
85  void initialize2( cbdfls_file const *bdfls );
86 };
87 #endif
88 
93 
94  private:
95  int mOrder;
96  std::vector<double> mEnergies;
97  std::vector<double> mFluxes;
99  public:
100  GIDI_settings_flux_order( int order );
101  GIDI_settings_flux_order( int order ,
102  int length ,
103  double const *energies ,
104  double const *fluxes );
105  GIDI_settings_flux_order( int order ,
106  std::vector<double> const &energies ,
107  std::vector<double> const &fluxes );
111 
112  inline int getOrder( void ) const { return( mOrder ); }
113  inline int size( void ) const { return( (int) mEnergies.size( ) ); }
114  inline double const *getEnergies( void ) const { return( &(mEnergies[0]) ); }
115  inline double const *getFluxes( void ) const { return( &(mFluxes[0]) ); }
116  void print( int valuesPerLine = 10 ) const;
117 
118  private:
119  void initialize( int order, int length, double const *energies, double const *fluxes );
120 };
121 
123 
124  private:
125  std::string mLabel;
126  double mTemperature;
127  std::vector<GIDI_settings_flux_order> mFluxOrders;
129  public:
130  GIDI_settings_flux( std::string const &label, double temperature_MeV );
131  GIDI_settings_flux( char const *label, double temperature_MeV );
132  GIDI_settings_flux( GIDI_settings_flux const &flux );
135 
136  GIDI_settings_flux_order const *operator[]( int order ) const;
137  inline int getMaxOrder( void ) const { return( (int) mFluxOrders.size( ) - 1 ); }
138  inline int size( void ) const { return( (int) mFluxOrders.size( ) ); }
139 
140  inline std::string getLabel( ) const { return( mLabel ); }
141  inline bool isLabel( std::string const &label ) const { return( label == mLabel ); }
142  inline bool isLabel( char const *label ) const { return( label == mLabel ); }
143  inline double getTemperature( ) const { return( mTemperature ); }
144  void addFluxOrder( GIDI_settings_flux_order const &fluxOrder );
145  void print( bool outline = true, int valuesPerLine = 10 ) const;
146 };
147 
148 #if GIDI_USE_BDFLS
149 class GIDI_settings_fluxes_from_bdfls {
150 
151  private:
152  std::vector<GIDI_settings_flux> mFluxes;
153 
154  public:
155  GIDI_settings_fluxes_from_bdfls( std::string const &fileName, double temperature_MeV );
156  GIDI_settings_fluxes_from_bdfls( char const *fileName, double temperature_MeV );
157  GIDI_settings_fluxes_from_bdfls( cbdfls_file const *bdfls, double temperature_MeV );
158  ~GIDI_settings_fluxes_from_bdfls( );
159 
160  GIDI_settings_flux getViaFID( int fid );
161  std::vector<std::string> getLabels( void );
162  std::vector<int> getFIDs( void );
163  void print( bool outline = true, int valuesPerLine = 10 );
164 
165  private:
166  void initialize( char const *fileName, double temperature_MeV );
167  void initialize2( cbdfls_file const *bdfls, double temperature_MeV );
168 };
169 #endif
170 
172 
173  private:
175  std::vector<GIDI::ptwXYPoints *> mFluxXY; /* Same as mFlux but stored as ptwXYPoints for each l-order. */
176  std::vector<GIDI::ptwXPoints *> mGroupedFlux; /* mFlux grouped using mGroupX, and stored as ptwXPoints for each l-order. */
177 
178  public:
183 
184  inline double getTemperature( ) const { return( mFlux.getTemperature( ) ); }
186 };
187 
189 
190  private:
191  int mPoPId;
195  GIDI::ptwXPoints *mGroupX; /* Same as mGroup but stored as ptwXPoints. */
196  std::vector<GIDI_settings_processedFlux> mProcessedFluxes;
197 
198  public:
199  GIDI_settings_particle( int PoPId, bool transporting, int energyMode );
201  int initialize( int PoPId, bool transporting, int energyMode );
203 
205  GIDI_settings_processedFlux const *nearestFluxToTemperature( double temperature ) const;
206  inline int getGroupIndexFromEnergy( double e_in, bool encloseOutOfRange ) const { return( mGroup.getGroupIndexFromEnergy( e_in, encloseOutOfRange ) ); };
207  inline int getNumberOfGroups( void ) const { return( mGroup.getNumberOfGroups( ) ); };
208  inline int getPoPId( void ) const { return( mPoPId ); }
209  inline int getEnergyMode( void ) const { return( mEnergyMode ); }
210  inline bool getTransporting( void ) const { return( mTransporting ); }
211  inline GIDI_settings_group getGroup( void ) const { return( mGroup ); }
212  GIDI_settings_flux const *getFlux( double temperature ) const;
213  GIDI::ptwXPoints *groupFunction( GIDI::statusMessageReporting *smr, GIDI::ptwXYPoints *ptwXY1, double temperature, int order ) const;
214  void setGroup( GIDI_settings_group const &group );
215 
217  inline bool isEnergyMode_grouped( void ) const { return( this->mEnergyMode & GIDI_settings_projectileEnergyMode_grouped ); }
218  inline bool isEnergyMode_fixedGrid( void ) const { return( this->mEnergyMode & GIDI_settings_projectileEnergyMode_fixedGrid ); }
219 
220  private:
221  GIDI_settings_flux const *getProcessedFlux( double temperature ) const;
222 };
223 
225 
226  private:
227  std::map<int, GIDI_settings_particle> mParticles;
228 
229  public:
230  GIDI_settings( );
231  ~GIDI_settings( );
232 
234  GIDI_settings_particle const *getParticle( int PoPId ) const;
235  int eraseParticle( int PoPId );
236  void releaseMemory( ) { mParticles.clear( ); }
237 };
238 
239 #if defined( __INTEL_COMPILER )
240 #pragma warning( pop )
241 #endif
242 
243 #endif // End of GIDI_settings_hpp_included