Go to the documentation of this file.00001
00002
00003
00004
00005
00007 #include "SimRomanPot/SimFP420/interface/ChargeDrifterFP420.h"
00008 using namespace std;
00009
00010 ChargeDrifterFP420::ChargeDrifterFP420( double mt,
00011 double tn,
00012 double dc,
00013 double tm,
00014 double cdr,
00015 double dv,
00016 double av,
00017 double ptx,
00018 double pty, int verbosity) {
00019
00020
00021 verbo=verbosity;
00022 modulePath = mt;
00023 constTe = tn;
00024 constDe = dc;
00025 temperature = tm;
00026 startT0 = cdr;
00027 depV = dv;
00028 appV = av;
00029
00030 ldriftcurrX = ptx;
00031 ldriftcurrY = pty;
00032
00033
00034
00035
00036
00037
00038 if(verbo>0) {
00039 std::cout << "ChargeDrifterFP420: call constructor" << std::endl;
00040 std::cout << "ldriftcurrX= " << ldriftcurrX << "ldriftcurrY= " << ldriftcurrY << std::endl;
00041 std::cout << "modulePath= " << modulePath << "constTe= " << constTe << std::endl;
00042 std::cout << "ChargeDrifterFP420:----------------------" << std::endl;
00043 }
00044 }
00045
00046
00047
00048 CDrifterFP420::collection_type ChargeDrifterFP420::drift(const CDrifterFP420::ionization_type ion, const G4ThreeVector& driftDir,const int& xytype){
00049
00050
00051 if(verbo>0) {
00052 std::cout << "ChargeDrifterFP420: collection_type call drift" << std::endl;
00053 }
00054
00055
00056 collection_type _temp;
00057 _temp.resize(ion.size());
00058
00059 for (unsigned int i=0; i<ion.size(); i++){
00060 _temp[i] = drift(ion[i], driftDir, xytype);
00061 }
00062 return _temp;
00063 }
00064
00065 AmplitudeSegmentFP420 ChargeDrifterFP420::drift
00066 (const EnergySegmentFP420& edu, const G4ThreeVector& drift, const int& xytype){
00067
00068
00069
00070
00071
00072
00073 double sliX = (edu).x();
00074 double sliY = (edu).y();
00075 double sliZ = (edu).z();
00076
00077 double currX = sliX;
00078 double currY = sliY;
00079 double currZ = sliZ;
00080
00081 double pathFraction=0., pathValue=0.;
00082 double tanShiftAngleX=0.,tanShiftAngleY=0.,tanShiftAngleZ=0.;
00083 double xDriftDueToField=0.,yDriftDueToField=0.,zDriftDueToField=0.;
00084 if(verbo>0) {
00085 std::cout << "=================================================================== " << std::endl;
00086 std::cout << "ChargeDrifterFP420: xytype= " << xytype << std::endl;
00087 std::cout << "constTe= " << constTe << "ldriftcurrX= " << ldriftcurrX << "ldriftcurrY= " << ldriftcurrY << std::endl;
00088 std::cout << "1currX = " << currX << " 1currY = " << currY << " 1currZ = " << currZ << std::endl;
00089 std::cout << "drift.x() = " << drift.x() << " drift.y() = " << drift.y() << " drift.z() = " << drift.z() << std::endl;
00090 }
00091
00092
00093
00094
00095
00096
00097 if(xytype == 2) {
00098 tanShiftAngleY = drift.y()/drift.x();
00099 tanShiftAngleZ = drift.z()/drift.x();
00100
00101
00102 pathValue = fabs(sliX)-int(fabs(sliX/(2*ldriftcurrX))+0.5)*(2*ldriftcurrX);
00103 pathValue = fabs(pathValue);
00104 pathFraction = pathValue/ldriftcurrX;
00105 if(verbo>0) {
00106 std::cout << "==================================" << std::endl;
00107 std::cout << "fabs(sliX)= " << fabs(sliX) << "ldriftcurrX= " << ldriftcurrX << std::endl;
00108 std::cout << "fabs(sliX/(2*ldriftcurrX))+0.5= " << fabs(sliX/(2*ldriftcurrX))+0.5 << std::endl;
00109 std::cout << "int(fabs(sliX/(2*ldriftcurrX))+0.5)*(2*ldriftcurrX)= " << int(fabs(sliX/(2*ldriftcurrX))+0.5)*(2*ldriftcurrX) << std::endl;
00110 std::cout << "pathValue= " << pathValue << std::endl;
00111 std::cout << "pathFraction= " << pathFraction << std::endl;
00112 std::cout << "==================================" << std::endl;
00113 }
00114
00115 pathFraction = pathFraction>0. ? pathFraction : 0. ;
00116 pathFraction = pathFraction<1. ? pathFraction : 1. ;
00117
00118 yDriftDueToField
00119 = pathValue*tanShiftAngleY;
00120 zDriftDueToField
00121 = pathValue*tanShiftAngleZ;
00122
00123 currY = sliY + yDriftDueToField;
00124 currZ = sliZ + zDriftDueToField;
00125 }
00126
00127
00128
00129 else if(xytype == 1) {
00130 tanShiftAngleX = drift.x()/drift.y();
00131 tanShiftAngleZ = drift.z()/drift.y();
00132
00133
00134 pathValue = fabs(sliY)-int(fabs(sliY/(2*ldriftcurrY))+0.5)*(2*ldriftcurrY);
00135 pathValue = fabs(pathValue);
00136 pathFraction = pathValue/ldriftcurrY;
00137
00138
00139
00140 if(verbo>0) {
00141 std::cout << "==================================" << std::endl;
00142 std::cout << "fabs(sliY)= " << fabs(sliY) << "ldriftcurrY= " << ldriftcurrY << std::endl;
00143 std::cout << "fabs(sliY/(2*ldriftcurrY))+0.5= " << fabs(sliY/(2*ldriftcurrY))+0.5 << std::endl;
00144 std::cout << "int(fabs(sliY/(2*ldriftcurrY))+0.5)*(2*ldriftcurrY)= " << int(fabs(sliY/(2*ldriftcurrY))+0.5)*(2*ldriftcurrY) << std::endl;
00145 std::cout << "pathValue= " << pathValue << std::endl;
00146 std::cout << "pathFraction= " << pathFraction << std::endl;
00147 std::cout << "==================================" << std::endl;
00148 }
00149
00150 if(pathFraction<0. || pathFraction>1.) std::cout << "ChargeDrifterFP420: ERROR:pathFraction=" << pathFraction << std::endl;
00151 pathFraction = pathFraction>0. ? pathFraction : 0. ;
00152 pathFraction = pathFraction<1. ? pathFraction : 1. ;
00153 xDriftDueToField
00154 = pathValue*tanShiftAngleX;
00155
00156 zDriftDueToField
00157 = pathValue*tanShiftAngleZ;
00158
00159 currX = sliX + xDriftDueToField;
00160 currZ = sliZ + zDriftDueToField;
00161 }
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 double bbb = 1.-2*depV*pathFraction/(depV+appV);
00179 if(bbb<0.) std::cout << "ChargeDrifterFP420:ERROR: check your Voltage for log(bbb) bbb=" << bbb << std::endl;
00180 double driftTime = -constTe*log(bbb) + startT0;
00181
00182
00183 double sigma = sqrt(2.*constDe*driftTime*100.);
00184
00185
00186 if(verbo>0) {
00187 std::cout << "ChargeDrifterFP420: drift: xytype=" << xytype << "pathFraction=" << pathFraction << std::endl;
00188 std::cout << " constTe= " << constTe << " driftTime = " << driftTime << " startT0 = " << startT0 << std::endl;
00189 std::cout << " log = " << log(1.-2*depV*pathFraction/(depV+appV)) << std::endl;
00190 std::cout << " negativ inside log = " << -2*depV*pathFraction/(depV+appV) << std::endl;
00191 std::cout << " constDe = " << constDe << " sigma = " << sigma << std::endl;
00192
00193 std::cout << "ChargeDrifterFP420: drift: xytype=" << xytype << "pathValue=" << pathValue << std::endl;
00194 std::cout << " tanShiftAngleX = " << tanShiftAngleX << " tanShiftAngleY = " << tanShiftAngleY << " tanShiftAngleZ = " << tanShiftAngleZ << std::endl;
00195 std::cout << "sliX = " << sliX << " sliY = " << sliY << " sliZ = " << sliZ << std::endl;
00196 std::cout << "pathFraction = " << pathFraction << " driftTime = " << driftTime << std::endl;
00197 std::cout << "sigma = " << sigma << std::endl;
00198 std::cout << "xDriftDueToField = " << xDriftDueToField << " yDriftDueToField = " << yDriftDueToField << " zDriftDueToField = " << zDriftDueToField << std::endl;
00199 std::cout << "2currX = " << currX << " 2currY = " << currY << " 2currZ = " << currZ << std::endl;
00200 std::cout << "ChargeDrifterFP420: drift; finally, rETURN AmplitudeSlimentFP420" << std::endl;
00201 std::cout << "===================================================================" << std::endl;
00202 std::cout << " (edu).energy()= " << (edu).energy() << std::endl;
00203 std::cout << "==" << std::endl;
00204 }
00205
00206 return AmplitudeSegmentFP420(currX,currY,currZ,sigma,
00207 (edu).energy());
00208 }
00209