particle.h
Go to the documentation of this file.00001
00009 #ifndef _PARTICLE_H
00010 #define _PARTICLE_H
00011
00012 #include <iostream>
00013 #include <cmath>
00014 #include <vector>
00015 #include <map>
00016 #include <algorithm>
00017 #include <utility>
00018
00019 #include "fitsio.h"
00020
00021 class Galaxy;
00022 class TInelasticCrossSection;
00023 class TSpallationNetwork;
00024 class TNucleiList;
00025 class TCREvolutorBasis;
00026 class TIonizationLoss;
00027 class TCoulombLoss;
00028 class TBremsstrahlungLoss;
00029 class TSynchrotronLoss;
00030 class TICSLoss;
00031 class TSpectrum;
00032 class Input;
00033 class TXSecBase;
00034 class TEnergyLoss;
00035
00036 using namespace std;
00037
00046 class TParticle {
00047
00048 public:
00049 TParticle() {}
00050 TParticle(TParticle& part) :
00051 A(part.A),
00052 Z(part.Z),
00053 uid(part.uid),
00054 dimr(part.dimr),
00055 dimz(part.dimz),
00056 dimE(part.dimE),
00057 daughter(part.daughter),
00058 lifetime(part.lifetime) {
00059 _fGalaxy = part._fGalaxy;
00060 _fInXSec = part._fInXSec;
00061 eloss = part.eloss;
00062 density = part.density;
00063 sp = part.sp;
00064 issec = part.issec;
00065 }
00068 TParticle(int A_ , int Z_ , Galaxy* gal , Input* in , int uid_prec, TXSecBase* xsecmodel, TNucleiList* l);
00071 ~TParticle();
00074 TParticle& operator += (const TParticle& addendum) {
00075 if (uid != addendum.uid) {
00076 cerr << "You are summing apples with bananas. Check your routines!" << endl;
00077 return *this;
00078 }
00079 for (int i = 0; i < density.size(); ++i) density[i] += addendum.density[i];
00080 return *this;
00081 }
00084 void Evolve(vector<TParticle*> , vector<TCREvolutorBasis*> , TSpallationNetwork* spnet);
00086 void Print(fitsfile* , double );
00087 void PrintSpectrum(fitsfile* , double );
00088 double FindNormalization();
00096 inline TSpectrum* GetSpectrum() { return sp; }
00097 inline double GetDensity(int ir , int iz , int ip ) { return density[index(ir,iz,ip)]; }
00099 inline vector<double>& GetDensity() { return density; }
00100 inline double GetDensity(int i ) { return density[i]; }
00102 inline int GetUid() { return uid; }
00103 inline const double GetLifetime() const { return lifetime; }
00104 inline const int GetDaughter() const { return daughter; }
00105 inline int GetA() { return A; }
00106 inline int GetZ() { return Z; }
00107 inline int GetIsSec() { return issec; }
00108
00109 protected:
00110 int A;
00111 int Z;
00112 int uid;
00113 int dimr;
00114 int dimz;
00115 int dimE;
00116 double lifetime;
00117 int daughter;
00118 int issec;
00119 Galaxy* _fGalaxy;
00120 TInelasticCrossSection* _fInXSec;
00121 TSpectrum* sp;
00122 vector<TEnergyLoss*> eloss;
00123 vector<double> density;
00124 vector<double> ComputeSecondarySource(vector<TParticle*> , TSpallationNetwork* spnet);
00132 inline int index(int ir , int iz , int ip ) { return (ir*dimz+iz)*dimE+ip; }
00138 };
00139 #endif