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: MJWaveformChargePoint.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 00024 // 00025 // CLASS IMPLEMENTATION: MJWaveformChargePoint.cc 00026 // 00027 //---------------------------------------------------------------------------// 00033 // 00034 //---------------------------------------------------------------------------// 00045 //---------------------------------------------------------------------------// 00046 // 00047 00048 #include <iostream> 00049 #include <CLHEP/Vector/ThreeVector.h> 00050 00051 #include "waveform/MJVWaveformCrystal.hh" 00052 00053 //---------------------------------------------------------------------------// 00054 00055 #include "waveform/MJWaveformChargePoint.hh" 00056 00057 using namespace std; 00058 00059 //---------------------------------------------------------------------------// 00060 00061 MJWaveformChargePoint::MJWaveformChargePoint(HepInt *location, 00062 HepInt sign, 00063 HepDouble eloss, 00064 MJVWaveformCrystal *Xtal): 00065 fChargeSign(sign), fEnergyLoss(eloss), 00066 fNextActiveChargePoint(0), fNextChargePoint(0), 00067 fPreviousActiveChargePoint(0), fPreviousChargePoint(0), 00068 fXtal(Xtal) 00069 { 00070 fGridLocation[0] = location[0]; 00071 fGridLocation[1] = location[1]; 00072 fGridLocation[2] = location[2]; 00073 } 00074 00075 //---------------------------------------------------------------------------// 00076 00077 MJWaveformChargePoint::MJWaveformChargePoint(const MJWaveformChargePoint&other) 00078 {;} 00079 00080 //---------------------------------------------------------------------------// 00081 00082 MJWaveformChargePoint::~MJWaveformChargePoint() 00083 {;} 00084 00085 //---------------------------------------------------------------------------// 00086 00087 void MJWaveformChargePoint::DoDiffusion(void) 00088 { 00089 if(!(fNumberOfSteps % fDiffusionStepInterval)) { 00090 // Do diffusion. Not implemented yet. 00091 } 00092 } 00093 00094 //---------------------------------------------------------------------------// 00095 00096 void MJWaveformChargePoint::DoOneStep(void) 00097 { 00098 if(fActive) { 00099 PropagateOneStep(); 00100 if(fTrappingOn) DoTrapping(); 00101 if(fDiffusionOn) DoDiffusion(); 00102 } 00103 } 00104 00105 //---------------------------------------------------------------------------// 00106 00107 void MJWaveformChargePoint::DoTrapping(void) 00108 { 00109 if(!(fNumberOfSteps % fTrappingStepInterval)) { 00110 // Do Trapping. Not implemented yet. 00111 } 00112 } 00113 00114 //---------------------------------------------------------------------------// 00115 00116 void MJWaveformChargePoint::Dump(void) 00117 { 00118 cout << "\n\nActive: " << fActive; 00119 cout << "\nEnergy loss (MeV): " << fEnergyLoss / MeV; 00120 cout << "\nCharge (C): " << fCharge / coulomb; 00121 cout << "\nCharge sign : " << fChargeSign; 00122 cout << "\nCurrent pos (cm): " << fCurrentPosition / cm; 00123 cout << "\nPrevious pos (cm): " << fPreviousPosition / cm; 00124 cout << "\nOriginal pos (cm): " << fOriginalPosition / cm; 00125 cout << "\nGridlocation : " << fGridLocation[0] << fGridLocation[1]; 00126 cout << fGridLocation[2]; 00127 cout << "\nGrid Point Size (cm) : " << fGridPointSize / cm; 00128 cout << "\nNumber Of Steps : " << fNumberOfSteps; 00129 cout << "\nSigma : " << fSigma; 00130 cout << "\nDiffusion Step Interval : " << fDiffusionStepInterval; 00131 cout << "\nTrapping Step Interval : " << fTrappingStepInterval; 00132 cout << "\nTime Step (ns): " << fTimeStep / ns; 00133 cout << "\nTotal Time (ns) : " << fTotalTime / ns; 00134 Hep3Vector vel; 00135 GetVelocity(&vel); 00136 cout << "\nVelocity (cm/us) : " << vel / cm * microsecond; 00137 cout << "\n\n"; 00138 } 00139 00140 //---------------------------------------------------------------------------// 00141 00142 void MJWaveformChargePoint::InitializePropagation(void) 00143 { 00144 fActive = !(fXtal->OutsideCrystal(&fCurrentPosition)); 00145 fCharge = fXtal->ConvertEnergyLossToCharge(fEnergyLoss); 00146 fOriginalPosition = fXtal->ConvertGridpointToCoordinate(fGridLocation); 00147 fPreviousPosition = fCurrentPosition = fOriginalPosition; 00148 fGridPointSize = fXtal->GetGridPointSize(); 00149 fNumberOfSteps = 0; 00150 fSigma = fXtal->GetInitialGridPointSigma(); 00151 if(fDiffusionOn = fXtal->DiffusionOn()) 00152 fDiffusionStepInterval = fXtal->GetDiffusionStepInterval(); 00153 if(fTrappingOn = fXtal->TrappingOn()) 00154 fTrappingStepInterval = fXtal->GetTrappingStepInterval(); 00155 fTimeStep = fXtal->GetTimeStep(); 00156 00157 } 00158 00159 //---------------------------------------------------------------------------// 00160 00161 void MJWaveformChargePoint::PropagateOneStep(void) 00162 { 00163 // Note: Calling method has to determine whether this charge point is still 00164 // active. 00165 static Hep3Vector vel; 00166 00167 GetVelocity(&vel); 00168 fPreviousPosition = fCurrentPosition; 00169 fCurrentPosition += -fTimeStep * fChargeSign * vel; 00170 fNumberOfSteps++; 00171 fTotalTime += fTimeStep; 00172 if(fXtal->OutsideCrystal(&fCurrentPosition)) { 00173 fActive = false; 00174 RemoveFromActiveList(); 00175 } 00176 } 00177 00178 //---------------------------------------------------------------------------// 00179 00180 void MJWaveformChargePoint::RemoveFromActiveList(void) 00181 { 00182 if(fPreviousActiveChargePoint && fNextActiveChargePoint) { 00183 fPreviousActiveChargePoint-> 00184 SetNextActiveChargePoint(fNextActiveChargePoint); 00185 fNextActiveChargePoint-> 00186 SetPreviousActiveChargePoint(fPreviousActiveChargePoint); 00187 } else { 00188 if(fNextActiveChargePoint) 00189 fNextActiveChargePoint->SetPreviousActiveChargePoint(NULL); 00190 else if (fPreviousActiveChargePoint) 00191 fPreviousActiveChargePoint->SetNextActiveChargePoint(NULL); 00192 } 00193 } 00194 00195 //---------------------------------------------------------------------------// 00196 //---------------------------------------------------------------------------//