00001
00006 #ifndef REACTORDETECTOR_HH
00007 #define REACTORDETECTOR_HH
00008 #include <math.h>
00009 #include <iostream.h>
00010 #include <string.h>
00011 #include <vector>
00012 #include <fstream>
00013 #include "ReactorEvent.hh"
00014 #include "ReactorFortran.hh"
00015 #include "ReactorConstants.hh"
00016 #include "ReactorXC.hh"
00017
00023 class ReactorDetector{
00024
00025
00026
00027 friend class PMToutput;
00028
00029 public:
00030
00036 ReactorDetector();
00038 ~ReactorDetector();
00040 ReactorDetector(const ReactorDetector& Detector);
00042 ReactorDetector& operator=(const ReactorDetector& rhs);
00043
00047 void LightsOut(ReactorEvent& Event, int eventnum);
00048
00049
00050 void CleanPMTOutputArray();
00051
00052
00053
00054 double GetPHelectron() const {return PHelectron;}
00055 double GetPHpositron() const {return PHpositron;}
00056 double GetPHneutron() const {return PHneutron;}
00057 double GetPHthallium() const {return PHthallium;}
00058 double GetPHbismuth() const {return PHbismuth;}
00059 double GetPHcalifornium() const {return PHcalifornium;}
00060 double GetPHmuon() const {return PHmuon;}
00061
00062 double GetPHeleReco() const {return PHeleReco;}
00063 double GetPHposReco() const {return PHposReco;}
00064 double GetPHneuReco() const {return PHneuReco;}
00065 double GetPHthaReco() const {return PHthaReco;}
00066 double GetPHbisReco() const {return PHbisReco;}
00067 double GetPHcalReco() const {return PHcalReco;}
00068 double GetPHmuoReco() const {return PHmuoReco;}
00069
00070 double GetMeanNpePos()const {return MeanNpe[0];}
00071 double GetMeanQPos()const {return MeanQ[0];}
00072 double GetMeanAttenPos() const {return MeanAtten[0];}
00073 double GetMeanSfactorPos() const {return MeanSfactor[0];}
00074 double GetMeanNpeNeu()const {return MeanNpe[1];}
00075 double GetMeanQNeu()const {return MeanQ[1];}
00076 double GetMeanAttenNeu() const {return MeanAtten[1];}
00077 double GetMeanSfactorNeu() const {return MeanSfactor[1];}
00078
00079 double GetMeanNpeTl()const {return MeanNpe[2];}
00080 double GetMeanQTl()const {return MeanQ[2];}
00081 double GetMeanAttenTl() const {return MeanAtten[2];}
00082 double GetMeanSfactorTl() const {return MeanSfactor[2];}
00083 double GetMeanNpeBi()const {return MeanNpe[3];}
00084 double GetMeanQBi()const {return MeanQ[3];}
00085 double GetMeanAttenBi() const {return MeanAtten[3];}
00086 double GetMeanSfactorBi() const {return MeanSfactor[3];}
00087
00088 double GetRefracSc() const {return refracSc;}
00089
00090 double GetMeanNpeCf()const {return MeanNpe[4];}
00091 double GetMeanQCf()const {return MeanQ[4];}
00092 double GetMeanAttenCf() const {return MeanAtten[4];}
00093 double GetMeanSfactorCf() const {return MeanSfactor[4];}
00094 double GetMeanNpeMuon()const {return MeanNpe[5];}
00095 double GetMeanQMuon()const {return MeanQ[5];}
00096 double GetMeanAttenMuon() const {return MeanAtten[5];}
00097 double GetMeanSfactorMuon() const {return MeanSfactor[5];}
00098
00099 double GetMeanNpeEle()const {return MeanNpe[6];}
00100 double GetMeanQEle()const {return MeanQ[6];}
00101 double GetMeanAttenEle() const {return MeanAtten[6];}
00102 double GetMeanSfactorEle() const {return MeanSfactor[6];}
00103
00104 double GetHitFracEle() {return GetHitFrac("E");}
00105 double GetHitFracPos() {return GetHitFrac("P");}
00106 double GetHitFracNeu() {return GetHitFrac("N");}
00107 double GetHitFracTl() {return GetHitFrac("Tl");}
00108 double GetHitFracBi() {return GetHitFrac("Bi");}
00109 double GetHitFracCf() {return GetHitFrac("Cf");}
00110 double GetHitFracMuon() {return GetHitFrac("muon");}
00111
00112 double GetAbsorber(int& n) const {return Absorber[n];}
00113 double GetNeutronSteps(int& n) const {return NeutronSteps[n];}
00114
00115 int GetNcosbins() const {return Ncosbins;}
00116 int GetNphibins() const {return Nphibins;}
00117
00118 int GetNgamma() const {return Ngamma;}
00119 double* const GetEgamma() {return Egamma;}
00120 double* const GetTgamma() {return Tgamma;}
00121 int GetNgamma(std::string parent);
00122 void GetGamma(std::string parent,double* xyz);
00123 void GetGamma(std::string parent,double* e,double* t,double* r,
00124 double* c, double* f);
00125
00126 double* const GetPositronDipole() {return DipolePositron;}
00127 double* const GetNeutronDipole() {return DipoleNeutron;}
00128
00129 int GetNpmt() const {return Npmt;}
00130 void ReactorDetector::GetPMTdata(int npmt,double* XYZpmt,
00131 int& nele,double* PHele,double* Tele,
00132 int& npos,double* PHpos,double* Tpos,
00133 int& nneu,double* PHneu,double* Tneu,
00134 int& ntha,double* PHtha,double* Ttha,
00135 int& nbis,double* PHbis,double* Tbis,
00136 int& ncal,double* PHcal,double* Tcal,
00137 int& nmuo,double* PHmuo,double* Tmuo,
00138 int* npepos, int* npeneu, int* npetha,
00139 int* npebis, int* npecal, int* npemuo,
00140 int* npeele);
00141 void ReactorDetector::GetPMTdata(std::string parent,int pmtindex,
00142 double* XYZpmt, int* hits,
00143 double* PH, double* Q, double* Time,
00144 int* npe);
00145 int ReactorDetector::GetHitPMTsPos();
00146 int ReactorDetector::GetHitPMTsNeu();
00147 int ReactorDetector::GetHitPMTsTha();
00148 int ReactorDetector::GetHitPMTsBis();
00149 int ReactorDetector::GetHitPMTsCal();
00150 int ReactorDetector::GetHitPMTsMuo();
00151 int ReactorDetector::GetHitPMTsEle();
00152
00153
00154
00155
00156 void SetParam_R0(double x) {R0=x;}
00157 void SetParam_R1(double x) {R1 =x;}
00158 void SetParam_R2(double x) {R2 =x;SetPMT();}
00159 void SetParam_GdConcentration(double x);
00160 void SetParam_refracGd(double x) {refracGd =x;}
00161 void SetParam_refracSc(double x) {refracSc =x;}
00162 void SetParam_mfpGd(double x) {mfpGd=x;}
00163 void SetParam_mfpSc(double x) {mfpSc =x;}
00164 void SetParam_MeanNeuDispl(double x) {MeanNeuDispl =x;}
00165 void SetParam_FastNeutronOption(bool x) {FastNeutronOption =x;}
00166 void SetParam_PMTDebugOption(bool x) {PMTDebugOption =x;}
00167 void SetParam_PMTMergeTime(double x) {MergeTime =x;}
00168 void SetParam_Temperature(double x) {Temperature =x;}
00169 void SetParam_tGd(double x) {tGd =x;}
00170 void SetParam_tSc(double x) {tSc =x;}
00171 void SetParam_GdCaptureFraction(double x) {GdCaptureFraction =x;}
00172 void SetParam_GammasPerGd(double x) {GammasPerGd =x;}
00173 void SetParam_attenlGd(double x) {attenlGd =x;}
00174 void SetParam_attenlSc(double x) {attenlSc =x;}
00175 void SetParam_PhotonsPerMeV(double x) {PhotonsPerMeV =x;}
00176 void SetParam_PMTcoverage(double x){PMTcoverage=x;SetPMT();}
00177 void SetParam_PMTdiameter(double x){PMTdiameter=x;SetPMT();}
00178 void SetParam_PMTqe(double x) {PMTqe =x;}
00179 void SetParam_ScintDecayTime(double x) {ScintDecayTime =x;}
00180
00181 double* TranslateRadialDistance(double, double, double, double);
00182
00183 private:
00184
00185
00186
00187
00188 double R0;
00189 double R1;
00190 double R2;
00191 double GdConcentration;
00192 double refracGd;
00193 double refracSc;
00194 double mfpGd;
00195 double mfpSc;
00196 double MeanNeuDispl;
00197 bool FastNeutronOption;
00198 bool PMTDebugOption;
00199 double MergeTime;
00200 double Temperature;
00201 double tGd;
00202 double tSc;
00203 double GdCaptureFraction;
00204 double GammasPerGd;
00205 double attenlGd;
00206 double attenlSc;
00207 double PhotonsPerMeV;
00208 double EScale;
00209 double PMTcoverage;
00210 double PMTdiameter;
00211 double PMTqe;
00212 double ScintDecayTime;
00213 double a[4];
00214 double z[4];
00215 double nn[4];
00216
00217
00218
00219 int Npmt;
00220 int Ncosbins;
00221 int Nphibins;
00222 int pmtRadCount;
00223
00224 double* Xpmt;
00225 double* Ypmt;
00226 double* Zpmt;
00227 PMToutput** PMTOutputArray;
00228
00229 double PHelectron;
00230 double PHpositron;
00231 double PHneutron;
00232 double PHthallium;
00233 double PHbismuth;
00234 double PHcalifornium;
00235 double PHmuon;
00236
00237 double PHposReco;
00238 double PHeleReco;
00239 double PHneuReco;
00240 double PHthaReco;
00241 double PHbisReco;
00242 double PHcalReco;
00243 double PHmuoReco;
00244
00245 double TimePositron;
00246 double TimeNeutron;
00247
00248 double DipolePositron[3];
00249 double DipoleNeutron[3];
00250
00251 int HitPmtsPos;
00252 int HitPmtsNeu;
00253 int HitPmtsTha;
00254 int HitPmtsBis;
00255 int HitPmtsCal;
00256 int HitPmtsMuo;
00257 int HitPmtsEle;
00258
00259 double MeanNpe[7];
00260 double MeanQ[7];
00261 double MeanAtten[7];
00262 double MeanSfactor[7];
00263
00264 int Nneutron;
00265 double* Absorber;
00266 double* NeutronSteps;
00267
00268 int Ngamma;
00269 double* Rgamma;
00270 double* Egamma;
00271 double* Tgamma;
00272 std::string* Ogamma;
00273
00274 class PMT;
00275 int PMTsize;
00276 int PMTlen;
00277 PMT* PMTdata;
00278 PMT* ResizePMT();
00279 PMT* PMTelectron;
00280 PMT* PMTpositron;
00281 PMT* PMTneutron;
00282 PMT* PMTthallium;
00283 PMT* PMTbismuth;
00284 PMT* PMTcalifornium;
00285 PMT* PMTmuon;
00286 void ConsolidatePMT();
00287
00288 void SetNominalParameters();
00289 void SetPMT();
00290 void SetNeutronPropStuff();
00291
00292 double GetHitFrac(std::string parent);
00293 float GenerateQ(int npe);
00294 float Qspace[200];
00295 static float QSpectrum(float const& Q);
00296
00297 void GenerateSecondaries(ReactorEvent& Event);
00298 void GenerateResponse(ReactorEvent& Event);
00299 void GenerateGammas(ReactorEvent& Event);
00300 void CalculateQPosition(std::string parent);
00301 void ImproveQPosition(std::string parent);
00302 void CalculateEnergy(std::string parent);
00303
00304 class PMT{
00305 public:
00306 PMT();
00307 ~PMT();
00308 PMT(const PMT& p);
00309 PMT& operator=(const PMT& rhs);
00310 PMT operator+(const PMT& rhs);
00311 PMT& operator+=(const PMT& rhs);
00312
00313 int npmt;
00314 double xyz[3];
00315 double TimeGen;
00316 double TimeSmr;
00317 double PHgen;
00318 double PHsmr;
00319 double PathGd;
00320 double PathSc;
00321 double Atten;
00322 double Sfactor;
00323 int Npe;
00324 double Xpe;
00325 float Q;
00326 std::string Parent;
00327
00328 int SubHits;
00329 PMT** SubHitsPtr;
00330
00331 void SetSubHitsPtr(int subhits);
00332
00333 };
00334 };
00335
00336 struct PMTinfo{
00337 double time;
00338 double energy;
00339
00340 PMTinfo& operator+=(const PMTinfo& rhs);
00341
00342 };
00343
00344 class PMToutput{
00345
00346
00347
00348
00349 friend class ReactorDetector;
00350
00351 public:
00352
00353
00354 PMToutput(int ID);
00355
00356 ~PMToutput();
00357
00358 PMToutput(const PMToutput& PMTout);
00359
00360 PMToutput& operator=(const PMToutput& rhs);
00361
00362
00363 void incout(ReactorDetector::PMT *input, double MergeTime);
00364
00365 void testdump(int event);
00366
00367 void cleanup();
00368 private:
00369 std::vector<PMTinfo> output;
00370 std::vector<ReactorDetector::PMT*> events;
00371 int PMTid;
00372 int eventsin;
00373 int eventsdetected;
00374 PMTinfo temp;
00375 };
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387 #endif
00388
00389
00390
00391