Main Page   File List  

ReactorFsim.cpp

00001 #include "ReactorFortran.hh"
00002 #include "ReactorConstants.hh"
00003 #include "ReactorEvent.hh"
00004 #include "ReactorDetector.hh"
00005 #include "ReactorXC.hh"
00006 #include "ReactorNtuple.hh"
00007 #include <iostream.h>
00008 #include <math.h>
00009 #include <string.h>
00010 
00011 int main(){
00012 
00013   //  ReactorNeutrons Neutrons;
00014   //
00015   //  Set number of events, paw file name, and ntuple name
00016   //
00017   int nevents = 40000;
00018   double rmaxgen=225;
00019   int fast=0;
00020   char* fileName="th13.ntuple";
00021   char* ntName="event data";
00022   //
00023   // init random number seed
00024   //
00025   int luxury = 2;
00026   int seed = 8796896;
00027   int k1=0;
00028   int k2=0;
00029   rluxgo_(luxury,seed,k1,k2);
00030   //
00031   // Paw setup.  
00032   //
00033   hbook_init__();
00034   //
00035   int iostat;
00036   int ntLun=99;
00037   int ntBuf=1024;
00038   char* dirName = "TEST";
00039   char* chopt = "N";
00040   hropen_(ntLun,dirName,fileName,chopt,ntBuf,iostat,
00041           strlen(dirName),strlen(fileName),strlen(chopt));
00042   //
00043   // Set up simple detector models
00044   // Set up simple Ntuple and histogranms 
00045   // See ReactorNtuple.hh for ntuple/histogram details.
00046   //
00047   ReactorDetector DetectorA;
00048   DetectorA.SetParam_FastNeutronOption(fast);
00049   DetectorA.SetParam_R0(175);
00050   DetectorA.SetParam_R1(200);
00051   DetectorA.SetParam_R2(275);
00052   ReactorNtuple ModelA(1,"model A",dirName);
00053   //
00054   ReactorDetector DetectorB;
00055   DetectorB.SetParam_FastNeutronOption(fast);
00056   DetectorB.SetParam_R0(175);
00057   DetectorB.SetParam_R1(200);
00058   DetectorB.SetParam_R2(275);
00059   DetectorB.SetParam_GdConcentration(0.11);
00060   ReactorNtuple ModelB(2,"10%higher f-Gd",dirName);
00061   //
00062   ReactorDetector DetectorC;
00063   DetectorC.SetParam_FastNeutronOption(fast);
00064   DetectorC.SetParam_R0(175);
00065   DetectorC.SetParam_R1(200);
00066   DetectorC.SetParam_R2(275);
00067   DetectorC.SetParam_attenlGd(440);
00068   ReactorNtuple ModelC(3,"10% higher l-Gd",dirName);
00069   //
00070   ReactorDetector DetectorD;
00071   DetectorD.SetParam_FastNeutronOption(fast);
00072   DetectorD.SetParam_R0(175);
00073   DetectorD.SetParam_R1(200);
00074   DetectorD.SetParam_R2(275);
00075   DetectorD.SetParam_attenlSc(1100);
00076   ReactorNtuple ModelD(4,"10% higher l-Sc",dirName);
00077   //
00078   ReactorDetector DetectorE;
00079   DetectorE.SetParam_FastNeutronOption(fast);
00080   DetectorE.SetParam_R0(175);
00081   DetectorE.SetParam_R1(200);
00082   DetectorE.SetParam_R2(275);
00083   ReactorNtuple ModelE(5,"-20% f-Gd vs t",dirName);
00084   //
00085   ReactorDetector DetectorF;
00086   DetectorF.SetParam_FastNeutronOption(fast);
00087   DetectorF.SetParam_R0(175);
00088   DetectorF.SetParam_R1(200);
00089   DetectorF.SetParam_R2(275);
00090   ReactorNtuple ModelF(6,"-20% l-Gd vs t",dirName);
00091   //
00092   // event loop
00093   //
00094   for (int events = 0;events<nevents;events++){
00095     //
00096     // create neutrino event
00097     //
00098     ReactorEvent Event(rmaxgen);
00099     //
00100     // create fast detector simulation
00101     //
00102     DetectorA.LightsOut(Event);
00103     ModelA.Fill(Event,DetectorA);
00104     //
00105     DetectorB.LightsOut(Event);
00106     ModelB.Fill(Event,DetectorB);
00107     //
00108     DetectorC.LightsOut(Event);
00109     ModelC.Fill(Event,DetectorC);
00110     //
00111     DetectorD.LightsOut(Event);
00112     ModelD.Fill(Event,DetectorD);
00113     //
00114     DetectorE.SetParam_GdConcentration(0.01-0.002*events/nevents);
00115     DetectorE.LightsOut(Event);
00116     ModelE.Fill(Event,DetectorE);
00117     //
00118     DetectorF.SetParam_attenlGd(400-80*events/nevents);
00119     DetectorF.LightsOut(Event);
00120     ModelF.Fill(Event,DetectorF);
00121   }
00122   //
00123   // close up paw
00124   //
00125   hldir_(" "," ",strlen(" "),strlen(" "));
00126   char dirName2[strlen(dirName)+2];
00127   *dirName2='\0';
00128   strcat(dirName2,"//");
00129   strcat(dirName2,dirName);
00130   hcdir_(dirName2," ",strlen(dirName2),strlen(" "));
00131   int outopt = 0;
00132   int icycle;
00133   hrout_(outopt,icycle," ",strlen(" "));
00134   hrend_(dirName,strlen(dirName));
00135 }

Generated on Sat Jul 17 14:45:42 2004 for ReactorFsim by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002