MollerAnalysis.hh

Go to the documentation of this file.
00001 
00002 /**********************************************************/
00003 /*      This header creates the ROOT TNtuple and          */
00004 /*      initializes the RootAnalysis class.               */
00005 /**********************************************************/
00006 
00007 
00008 
00009 #ifndef MollerAnalysis_h
00010 #define MollerAnalysis_h 1
00011 
00012 #include "RootAnalysis.hh"
00013 #include "MollerAnalysisMessenger.hh"
00014 #include "MollerDetectorConstruction.hh"
00015 #include "MollerDetectorHit.hh"
00016 #include "G4ClassificationOfNewTrack.hh"
00017 #include "G4TrackStatus.hh"
00018 #include "G4Material.hh"
00019 #include "G4Types.hh"
00020 #include "TNtuple.h"
00021 #include "G4ThreeVector.hh"
00022 
00023 #include <time.h>
00024 
00025 #if defined (G4UI_USE_ROOT) || defined (G4UI_BUILD_ROOT_SESSION)
00026 #if !defined (G4ANALYSIS_USE_ROOT)
00027 #define G4ANALYSIS_USE_ROOT 1
00028 #endif /* !defined (G4ANALYSIS_USE_ROOT) */
00029 #endif /* defined (G4UI_USE_ROOT) || defined (G4UI_BUILD_ROOT_SESSION) */
00030 
00031 class G4VPhysicalVolume;
00032 class G4Event;
00033 class G4Run;
00034 class G4Track;
00035 class G4Material;
00036 class G4Step;
00037 
00038 class TNtuple;
00039 class MollerAnalysisMessenger;
00040 class MollerDetectorConstruction;
00041 class MollerAnalysis : public RootAnalysis {
00042 
00043 public:
00044   MollerAnalysis();
00045   MollerAnalysis(MollerDetectorConstruction*);
00046   MollerAnalysis(const MollerAnalysis &right);
00047   const MollerAnalysis& operator=(const MollerAnalysis &right);
00048   ~MollerAnalysis();
00049 
00050 public:
00051   // G4UserRunAction
00052   void BeginOfRunAction(const G4Run*); //used
00053   void EndOfRunAction(const G4Run*);   //used
00054   
00055   // G4UserEventAction
00056   void BeginOfEventAction(const G4Event*); //used
00057   void EndOfEventAction(const G4Event*); //used
00058   
00059   // G4UserSteppingAction
00060   void UserSteppingAction(const G4Step*); //used
00061 
00062   void SetRootFileName(const G4String&);
00063 
00064   void SetMomentum0(G4double E0, G4double px, G4double py, G4double pz) {
00065     kineE0=E0;
00066     px0=px;
00067     py0=py;
00068     pz0=pz;
00069     theta0 = sqrt(px0*px0 + py0*py0);
00070   }
00071   void SetMomentum1(G4double E1, G4double px, G4double py, G4double pz) {
00072     kineE1=E1;
00073     px1=px;
00074     py1=py;
00075     pz1=pz;
00076     theta1 = sqrt(px1*px1 + py1*py1);
00077   }
00078   void SetMomentum2(G4double E2, G4double px, G4double py, G4double pz) {
00079     kineE2=E2;
00080     px2=px;
00081     py2=py;
00082     pz2=pz;
00083     theta2 = sqrt(px2*px2 + py2*py2);
00084   }
00085 
00086   void SetDiffXS(G4double diffXS_in) {
00087     diffXS = diffXS_in;
00088   }
00089 
00090   void SetTotXS(G4double totXS_in) {
00091     totXS = totXS_in;
00092   }
00093 
00094   void SetRate(G4double rate_in) {
00095     rate = rate_in;
00096   }
00097 
00098   void SetProcess(G4int i) {
00099     index=i;
00100   }
00101 
00102   void AddData(MollerDetectorHit *aHit){
00103 
00104   fntup[0] = aHit->GetIon();
00105   fntup[1] = aHit->GetWorldPos().x();
00106   fntup[2] = aHit->GetWorldPos().y();
00107   fntup[3] = aHit->GetWorldPos().z();
00108   //fntup[4] = (Float_t)x0;
00109   //fntup[5] = (Float_t)y0;
00110   //fntup[6] = (Float_t)z0;
00111   fntup[4] = aHit->GetVertexPos().x();
00112   fntup[5] = aHit->GetVertexPos().y();
00113   fntup[6] = aHit->GetVertexPos().z();
00114   fntup[7] = aHit->GetKineticEnergy();
00115   fntup[8] = aHit->GetMomentum().x();
00116   fntup[9] = aHit->GetMomentum().y();
00117   fntup[10] = aHit->GetMomentum().z();
00118   
00119   fntup[11] = (Float_t)kineE0;
00120   fntup[12] = (Float_t)px0;
00121   fntup[13] = (Float_t)py0;
00122   fntup[14] = (Float_t)pz0;
00123   fntup[15] = (Float_t)kineE1;
00124   fntup[16] = (Float_t)px1;
00125   fntup[17] = (Float_t)py1;
00126   fntup[18] = (Float_t)pz1;
00127   
00128   fntup[19] = (Float_t)kineE2;
00129   fntup[20] = (Float_t)px2;
00130   fntup[21] = (Float_t)py2;
00131   fntup[22] = (Float_t)pz2;
00132   
00133   fntup[23] = aHit->GetType();
00134   fntup[24] = aHit->GetVolume();
00135   fntup[25] = (Float_t)theta0;
00136   fntup[26] = (Float_t)theta1;
00137   fntup[27] = (Float_t)theta2;
00138   fntup[28] = (Float_t)ev_num;
00139   fntup[29] = (Float_t)splitProcess;
00140   fntup[30] = (Float_t)event;
00141   fntup[31] = (Float_t)creatorProcess;
00142   
00143   if (!index&&
00144       (aHit->GetIon()||splitProcess==0)&&
00145       kineE0>0&&
00146       aHit->GetType()==0
00147       ) {
00148     
00149     if (aHit->GetIon()) {
00150       fntup[32] = 2;
00151       fntup[33] = kineE2;
00152       fntup[34] = theta2;
00153     }
00154     else {
00155       fntup[32] = 1;
00156       fntup[33] = kineE1;
00157       fntup[34] = theta1;
00158     }
00159   }
00160   else if (aHit->GetTrackID()==1){ 
00161     fntup[32] = 1;
00162     fntup[33] = kineE1;
00163     fntup[34] = theta1;
00164   }
00165   else if (aHit->GetTrackID()==2){ 
00166     fntup[32] = 2;
00167     fntup[33] = kineE2;
00168     fntup[34] = theta2;
00169   }
00170   else { 
00171     fntup[32] = 0;
00172     fntup[33] = 0;
00173     fntup[34] = 0;
00174   }
00175   
00176   fntup[35] = aHit->GetTrackID();
00177   
00178   fntup[36] = diffXS;
00179   fntup[37] = totXS;
00180   fntup[38] = rate;
00181 
00182   ntup->Fill(fntup);
00183 }
00184 
00185 private:
00186 
00187   static const G4bool doDIPS=0;
00188   static const G4bool doCOLS=0;
00189   static const G4bool doQUADS=0;
00190 
00191   // When adding additional collimators this number must be increased
00192   //static const G4int NUM_DETS = 17;
00193   MollerDetectorConstruction*    myDetector;  //pointer to the geometry
00194 
00195   G4int NUM_DETS;
00196 
00197   MollerAnalysisMessenger*  analysisMessenger;   //messenger of this class
00198   G4String rootfileName;
00199 
00200   G4int ev_num, index;
00201   G4int partType, splitProcess, creatorProcess; 
00202 
00203   TNtuple *ntup;
00204   Float_t fntup[39];
00205 
00206   std::vector<G4int> hitsCollID;
00207 
00208   G4int verboseLevel;
00209   
00210   G4double generator, event;
00211 
00212   G4double kineE0;
00213   G4double kineE1;
00214   G4double kineE2;
00215 
00216   G4double px0;
00217   G4double py0;
00218   G4double pz0;
00219   G4double px1;
00220   G4double py1;
00221   G4double pz1;
00222   G4double px2;
00223   G4double py2;
00224   G4double pz2;
00225 
00226   G4double theta0;
00227   G4double theta1;
00228   G4double theta2;
00229 
00230   G4double x0;
00231   G4double y0;
00232   G4double z0;
00233 
00234   G4double rate;
00235   G4double totXS;
00236   G4double diffXS;
00237 };
00238 
00239 
00240 #endif
00241   
00242 
00243 

Generated on 16 Jun 2013 for mollersim by  doxygen 1.6.1