Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

MJWaveformCoaxialDetector.cc

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00003 //                                                                           //
00004 //                         MAJORANA Simulation                               //
00005 //                                                                           //
00006 //      This code implementation is the intellectual property of the         //
00007 //      MAJORANA Collaboration. It is based on Geant4, an intellectual       //
00008 //      property of the RD44 GEANT4 collaboration.                           //
00009 //                                                                           //
00010 //                        *********************                              //
00011 //                                                                           //
00012 //    Neither the authors of this software system, nor their employing       //
00013 //    institutes, nor the agencies providing financial support for this      //
00014 //    work  make  any representation or  warranty, express or implied,       //
00015 //    regarding this software system or assume any liability for its use.    //
00016 //    By copying, distributing or modifying the Program (or any work based   //
00017 //    on on the Program) you indicate your acceptance of this statement,     //
00018 //    and all its terms.                                                     //
00019 //                                                                           //
00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00021 //---------------------------------------------------------------------------//
00022 //                                                          
00023 // $Id: MJWaveformCoaxialDetector.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 
00024 //      
00025 // CLASS IMPLEMENTATION:  MJWaveformCoaxialDetector.cc
00026 //
00027 //---------------------------------------------------------------------------//
00033 // 
00034 //---------------------------------------------------------------------------//
00045 //---------------------------------------------------------------------------//
00046 //
00047 
00048 #include <CLHEP/Units/SystemOfUnits.h>
00049 
00050 #include "io/MJLogger.hh"
00051 #include "waveform/MJWaveformChargePoint.hh"
00052 #include "waveform/MJWaveformCoaxialCrystal.hh"
00053 #include "waveform/MJWaveformCoaxialSegment.hh"
00054 
00055 //---------------------------------------------------------------------------//
00056 
00057 #include "waveform/MJWaveformCoaxialDetector.hh"
00058 
00059 //---------------------------------------------------------------------------//
00060 
00061 MJWaveformCoaxialDetector::MJWaveformCoaxialDetector():
00062   fData(0), fCoaxialCrystal(0)
00063 {;}
00064 
00065 //---------------------------------------------------------------------------//
00066 
00067 MJWaveformCoaxialDetector::MJWaveformCoaxialDetector(const MJWaveformCoaxialDetector & other)
00068 {;}
00069 
00070 //---------------------------------------------------------------------------//
00071 
00072 MJWaveformCoaxialDetector::~MJWaveformCoaxialDetector()
00073 {
00074   delete fData;
00075 }
00076 
00077 //---------------------------------------------------------------------------//
00078 
00079 MJWaveformCoaxialDetector::BeginOfEventAction()
00080 {
00081   Hep3Vector coord;
00082 
00083   coord.setX(1.0 * cm);
00084   coord.setY(1.0 * cm);
00085   coord.setZ(0.0 * cm);
00086   HepInt crap[3];
00087   HepInt *location;
00088   location = crap;
00089   fCoaxialCrystal->ConvertCoordinateToGridpoint(&coord, location);
00090   HepInt sign;
00091   HepDouble Eloss;
00092   MJWaveformChargePoint *epoint =  new MJWaveformChargePoint(
00093                                        location,
00094                                        sign = -1,
00095                                        Eloss = 2.0 * MeV,
00096                                        fCoaxialCrystal);
00097   MJWaveformChargePoint *hpoint =  new MJWaveformChargePoint(
00098                                        location,
00099                                        sign = +1,
00100                                        Eloss = 2.0 * MeV,
00101                                        fCoaxialCrystal);
00102   epoint->InitializePropagation();
00103   hpoint->InitializePropagation();
00104   fCoaxialCrystal->AddChargePoint(epoint);
00105   fCoaxialCrystal->AddChargePoint(hpoint);
00106 }
00107 
00108 //---------------------------------------------------------------------------//
00109 
00110 MJWaveformCoaxialDetector::Construct()
00111 {
00112   fCoaxialCrystal = new MJWaveformCoaxialCrystal)->Construct();
00113   AddCrystal(fCoaxialCrystal);
00114 
00115   fData = new TreeStructure;
00116   fRootFile = new TFile("coaxial.root", "RECREATE");
00117   fRootTree = new TTree(x"fTree", "Coaxial Detector Tree");
00118   fRootTree->Branch("Time", fData->Time, "Time[500]/F");
00119   fRootTree->Branch("Current", fData->Current, "Current[2][500]/F");
00120   fRootTree->Branch("Charge", fData->Charge, "Charge[2][500]/F");
00121   fRootTree->Branch("InitialPosition", fData->InitialPosition, 
00122                     "InitialPosition[10][3]/F");
00123   fRootTree->Branch("InitialCharge", fData->InitialCharge, 
00124                     "InitialCharge[10]/F");
00125   fRootTree->Branch("NumberOfPoints", &fData->NumberOfPoints,
00126                     "NumberOfPoints/I");
00127 }
00128 
00129 //---------------------------------------------------------------------------//
00130 
00131 MJWaveformCoaxialDetector::EndOfEventAction()
00132 {  
00133   GenerateSignals();
00134   MJVWaveformSegment *seg1 = fCoaxialCrystal->GetFirstSegment();
00135   MJVWaveformSegment *seg2 = seg1->GetNextSegment();
00136   HepDouble timestep = fCoaxialCrystal1->GetTimeStep();
00137   HepDouble *curr1 = seg1->GetCurrentSignal();
00138   HepDouble *chrg1 = seg1->GetChargeSignal();
00139   HepDouble *curr2 = seg2->GetCurrentSignal();
00140   HepDouble *chrg2 = seg2->GetChargeSignal();
00141   HepInt np = fData->NumberOfPoints = seg1->GetChargeStep();
00142   for(HepInt i = 0; i < np; i++) {
00143     fData->Time[i] = CLHEPtoROOT(timestep * i / ns);
00144     fData->Current[0][i] = CLHEPtoROOT(curr1[i] / microampere);
00145     fData->Current[1][i] = CLHEPtoROOT(curr2[i] / microampere);
00146     fData->Charge[0][i] = CLHEPtoROOT(chrg1[i] / eplus);
00147     fData->Charge[1][i] = CLHEPtoROOT(chrg2[i] / eplus);
00148   }
00149   fRootTree->Fill();
00150 }
00151 
00152 //---------------------------------------------------------------------------//
00153 
00154 void MJWaveformCoaxialDetector::EndOfRunAction()
00155 {
00156   fRootTree->Write();
00157   fRootFile->Write();
00158   fRootFile->Close();
00159   fRootFile->Delete();
00160 }
00161 
00162 //---------------------------------------------------------------------------//
00163 //---------------------------------------------------------------------------//
00164 
00165 
00166 

Generated on Mon Nov 29 16:58:53 2004 for Majorana Simulation by  doxygen 1.3.9.1