#include <BesMucNoise.hh>
Public Member Functions | |
BesMucNoise () | |
~BesMucNoise () | |
void | Initialize (G4String filename, G4LogicalVolume *logicalMuc) |
void | Initialize (G4String filename, G4LogicalVolume *logicalMuc, G4String temp) |
void | CheckCalibSvc () |
G4int | AddNoise (int model, BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList) |
G4int | NoiseByCnt (BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList) |
G4int | NoiseByNosRatio (BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList) |
G4int | NoiseSampling (int level, int prt, int seg, int lay, int strip) |
G4int | GetStripNo (G4int, G4int, G4int) |
G4int | IsNearestStrip (G4int, G4int, G4int, G4int, G4float) |
bool | IsExist (BesMucHit *aNoiseHit, BesMucHitsCollection *aMucHitList) |
G4float | Factorial (G4int i) |
void | InitProb () |
Static Public Member Functions | |
static BesMucNoise * | Instance (void) |
Private Attributes | |
G4double | m_noise [3][8][9] |
G4double | m_noise_strip [3][8][9][112] |
G4float | area [3][8][9][112] |
G4float | strip_area [3][8][9][112] |
G4float | box_area [3][8][9] |
double | m_HitMean |
double | m_Prob [20][2] |
int | m_noiseLevel |
IMucCalibConstSvc * | m_ptrCalibSvc |
MucIdTransform * | m_ptrIdTr |
Static Private Attributes | |
static const int | m_kPart = 3 |
static const int | m_kSegment [m_kPart] = {4, 8, 4} |
static const int | m_kAbsorber [m_kPart] = {9, 9, 9} |
static const int | m_kGap [m_kPart] = {8, 9, 8} |
static const int | m_kPanel [m_kPart] = {4, 3, 4} |
static const int | m_kGasChamber = 2 |
static BesMucNoise * | fPointer = 0 |
Definition at line 29 of file BesMucNoise.hh.
BesMucNoise::BesMucNoise | ( | ) |
Definition at line 37 of file BesMucNoise.cc.
References fPointer.
Referenced by Instance().
00038 { 00039 if(fPointer) 00040 {G4Exception("BesMucNoise constructed twice.");} 00041 fPointer=this; 00042 00043 }
BesMucNoise::~BesMucNoise | ( | ) |
G4int BesMucNoise::AddNoise | ( | int | model, | |
BesMucHitsCollection * | MucHitCollection, | |||
BesMucHitsCollection * | MucHitList | |||
) |
Definition at line 220 of file BesMucNoise.cc.
References NoiseByCnt(), and NoiseByNosRatio().
Referenced by BesMucSD::BeginOfTruthEvent().
00221 { 00222 G4int noiseNum = 0; 00223 if( model == 1 ) noiseNum = NoiseByCnt(aMucHitCollection, aMucHitList); 00224 else noiseNum = NoiseByNosRatio(aMucHitCollection, aMucHitList); 00225 //G4cout << "Noise hit(s) produced:\t" << noiseNum << "\tby model:\t" << model << G4endl; 00226 return noiseNum; 00227 00228 }
void BesMucNoise::CheckCalibSvc | ( | ) |
Definition at line 190 of file BesMucNoise.cc.
References m_ptrCalibSvc.
Referenced by Initialize().
00191 { 00192 ISvcLocator* svcLocator = Gaudi::svcLocator(); 00193 StatusCode sc = svcLocator->service("MucCalibConstSvc", m_ptrCalibSvc, true); 00194 00195 if( sc != StatusCode::SUCCESS){ 00196 G4cout<< "Can not use MucCalibConstSvc!" << G4endl; 00197 } 00198 }
G4float BesMucNoise::Factorial | ( | G4int | i | ) |
Definition at line 375 of file BesMucNoise.cc.
Referenced by NoiseSampling().
00376 { 00377 G4float fact=1; 00378 if(i==0||i==1)return 1; 00379 else{ 00380 for(G4int ii=2;ii<=i;ii++){ 00381 fact=fact*ii;} 00382 return fact; 00383 } 00384 00385 }
G4int BesMucNoise::GetStripNo | ( | G4int | , | |
G4int | , | |||
G4int | ||||
) |
Definition at line 387 of file BesMucNoise.cc.
References area, IsNearestStrip(), max, and min.
Referenced by NoiseByCnt().
00388 { G4int stripno; 00389 //G4float random=G4UniformRand();//***use other random 00390 G4float random=(rand()%100000)/100000.0; 00391 if(part==1){ //berrel 00392 G4float width=area[part][seg][gap][3]-area[part][seg][gap][2]; 00393 stripno=G4int((random-area[part][seg][gap][1])/width)+2; 00394 if(stripno<1)stripno=1; 00395 if(stripno>111)stripno=111; 00396 // G4cout<<"---in noise::GetStripNo()---stripno= "<<stripno<<" "<<(random-area[part][seg][gap][1])/width<<G4endl; 00397 G4int step = IsNearestStrip(stripno,part,seg,gap,random); 00398 while(step!=0) { 00399 // G4cout<<"---in noise::GetStripNo()---while "<<G4endl; 00400 stripno += step; 00401 step = IsNearestStrip(stripno,part,seg,gap,random); 00402 }//endl while 00403 stripno--; //the first element is total strip number 00404 return stripno; 00405 } 00406 else{ //endcap 00407 G4int max,min,mid,pass; 00408 min=1; 00409 max=area[part][seg][gap][0]; 00410 mid=G4int((min+max)/2); 00411 //G4cout<<"---in noise first---"<<min<<" "<<mid<<" "<<max<<G4endl; 00412 do{ 00413 // G4cout<<"-----in noise---"<<random<<" "<<area[part][seg][gap][min]<<" "<<area[part][seg][gap][mid]<<" "<<area[part][seg][gap][max]<<G4endl; 00414 pass=0; 00415 if(random>area[part][seg][gap][mid]){ 00416 min=mid; 00417 mid=G4int((min+max)/2); 00418 } 00419 else if(random<area[part][seg][gap][mid-1]){ 00420 if(random<area[part][seg][gap][1]){ 00421 pass=1; mid=1;max=1; 00422 }else{ 00423 max=mid-1; 00424 mid=G4int((min+max)/2); 00425 } 00426 }else{pass=1;} 00427 00428 if(min==mid)mid=max; 00429 // G4cout<<"-----in noise---"<<min<<" "<<mid<<" "<<max<<G4endl; 00430 }while(pass==0&&(max>mid&&mid>min)); 00431 //G4cout<<"-----in noise--- "<<mid-1<<G4endl; 00432 return mid-1; 00433 00434 } 00435 00436 }
void BesMucNoise::Initialize | ( | G4String | filename, | |
G4LogicalVolume * | logicalMuc, | |||
G4String | temp | |||
) |
Definition at line 51 of file BesMucNoise.cc.
00052 { 00053 //m_noiseLevel = 2; // set to 2 temporary. In future, expected to get from cal servise, 00054 //like m_noiseLevel = m_ptrCalibSvc->getNoiseLevel(); 00055 /* 00056 m_noiseLevel = m_ptrCalibSvc->getLevel(); 00057 00058 if(m_noiseLevel!=2 && m_noiseLevel!=3){ 00059 G4cout<<"ERROR, In BesMucNoise, noise level should be 2 or 3 ..."<<G4endl; 00060 m_noiseLevel = 2; 00061 } 00062 00063 for(int i = 0; i < m_kPart; i++) { 00064 for(int j = 0; j < m_kSegment[i]; j++) { 00065 for(int k = 0; k < m_kGap[i]; k++) { 00066 m_noise[i][j][k] = m_ptrCalibSvc->getBoxCnt(i,j,k); 00067 int stripNum = 0; 00068 if(i != 1) stripNum = 64; //endcap; 00069 else{ 00070 if(k%2 == 0) stripNum = 48; 00071 if(k%2 == 1 && j != 2) stripNum = 96; 00072 if(k%2 == 1 && j == 2) stripNum = 112; 00073 } 00074 00075 for(int strip = 0; strip < stripNum; strip++){ 00076 m_noise_strip[i][j][k][strip] = m_ptrCalibSvc->getStripCnt(i,j,k,strip); 00077 } 00078 } 00079 } 00080 } 00081 */ 00082 }
void BesMucNoise::Initialize | ( | G4String | filename, | |
G4LogicalVolume * | logicalMuc | |||
) |
Definition at line 84 of file BesMucNoise.cc.
References area, box_area, CheckCalibSvc(), genRecEmupikp::i, InitProb(), ganga-rec::j, m_noise, m_ptrIdTr, strip_area, subSeperate::temp, and Width().
Referenced by BesMucSD::BesMucSD().
00085 { 00086 for(G4int part=0;part<3;part++){ 00087 for(G4int seg=0;seg<8;seg++){ 00088 for(G4int gap=0;gap<9;gap++){ 00089 m_noise[part][seg][gap]=1; //init -1 00090 } 00091 } 00092 } 00093 //read noise from file 00094 G4cout<<"filename: "<<filename<<G4endl; 00095 std::ifstream fin(filename); 00096 if(!fin){ 00097 G4cout<<"error opening muc_noise data"<<G4endl; 00098 } 00099 char buffer[200]; 00100 fin.getline(buffer,200,'\n'); //get info whether add noise or not! 00101 std::istringstream stringBuf(buffer); 00102 00103 //get strip area from logicalMuc! 00104 G4int tot_NoDaughter = logicalMuc->GetNoDaughters(); 00105 //G4cout<<"---in noise::Init()--- "<<tot_NoDaughter<<G4endl; 00106 for(G4int i=0; i<tot_NoDaughter;i++){ 00107 G4LogicalVolume* i_LogicalGap = logicalMuc->GetDaughter(i)->GetLogicalVolume(); 00108 G4String i_GapName = i_LogicalGap->GetName(); 00109 00110 if(i_GapName.find("G")==8){ 00111 G4LogicalVolume* i_LogicalBox = i_LogicalGap->GetDaughter(0)->GetLogicalVolume(); 00112 G4LogicalVolume* i_LogicalStripPlane = i_LogicalBox->GetDaughter(0)->GetLogicalVolume(); 00113 //G4cout<<"---in noise::Init()--- "<<i<<" "<<i_GapName<<" "<<i_LogicalStripPlane->GetDaughter(1)->GetLogicalVolume()->GetName()<<G4endl; 00114 G4String strPart = i_GapName.substr(5,1); 00115 G4String strSeg = i_GapName.substr(7,1); 00116 G4String strGap = i_GapName.substr(9,1); 00117 00118 std::istrstream partBuf(strPart.c_str(), strlen(strPart.c_str())); 00119 std::istrstream segBuf(strSeg.c_str(), strlen(strSeg.c_str())); 00120 std::istrstream gapBuf(strGap.c_str(), strlen(strGap.c_str())); 00121 00122 G4int part,seg,gap; 00123 00124 partBuf >> part; 00125 segBuf >> seg; 00126 gapBuf >> gap; 00127 //G4cout<<"-------in noise::Init()---- "<<part<<" "<<seg<<" "<<gap<<" "<<i_LogicalStripPlane->GetNoDaughters()<<G4endl; 00128 G4int tot_NoStrip = i_LogicalStripPlane->GetNoDaughters(); 00129 area[part][seg][gap][0]=tot_NoStrip; //the first element is the total strip number 00130 G4float tot_Area=0; 00131 // get width between two strip! 00132 G4LogicalVolume* i_LogicalStrip1 = i_LogicalStripPlane->GetDaughter(1)->GetLogicalVolume(); 00133 G4LogicalVolume* i_LogicalStrip2 = i_LogicalStripPlane->GetDaughter(2)->GetLogicalVolume(); 00134 G4Box *temp1; G4Box *temp2; 00135 00136 temp1=(G4Box *)i_LogicalStrip1->GetSolid();temp2=(G4Box *)i_LogicalStrip2->GetSolid(); 00137 G4float Width1 =temp1->GetXHalfLength()*2;G4float Width2 =temp2->GetXHalfLength()*2; 00138 G4float pos1 =i_LogicalStripPlane->GetDaughter(1)->GetObjectTranslation().x(); 00139 G4float pos2 =i_LogicalStripPlane->GetDaughter(2)->GetObjectTranslation().x(); 00140 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) { 00141 Width1=temp1->GetYHalfLength()*2; Width2 =temp2->GetYHalfLength()*2; 00142 pos1 =i_LogicalStripPlane->GetDaughter(1)->GetObjectTranslation().y(); 00143 pos2 =i_LogicalStripPlane->GetDaughter(2)->GetObjectTranslation().y(); 00144 } 00145 G4float width_between_strip=pos2-pos1-Width1/2-Width2/2; 00146 // G4cout<<"-----what I want---"<<width_between_strip<<" "<<pos2<<" "<<pos1<<" "<<Width1/2<<" "<<Width2/2<<G4endl; 00147 00148 for(G4int j=0;j<tot_NoStrip;j++){ 00149 G4LogicalVolume* i_LogicalStrip = i_LogicalStripPlane->GetDaughter(j)->GetLogicalVolume(); 00150 G4Box *temp; 00151 temp=(G4Box *)i_LogicalStrip->GetSolid(); 00152 G4float Width =temp->GetXHalfLength()*2; 00153 G4float Length=temp->GetYHalfLength()*2; 00154 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) { 00155 Width =temp->GetYHalfLength()*2; 00156 Length=temp->GetXHalfLength()*2; 00157 } //end if 00158 // G4cout<<"----in noise::init()---- "<<i_LogicalStrip->GetName()<<" "<<Width<<" "<<Length<<G4endl; 00159 if(j==0||j==(tot_NoStrip-1)) Width=Width+width_between_strip/2; 00160 else Width=Width+width_between_strip; 00161 G4float Strip_Area=fabs(Width*Length); 00162 tot_Area=tot_Area+Strip_Area; 00163 area[part][seg][gap][j+1]=tot_Area; 00164 strip_area[part][seg][gap][j] = Strip_Area; 00165 //G4cout<<" id: ( "<<part<<" "<<seg<<" "<<gap<<") "<<Strip_Area<<" , w: "<<Width<<" L: "<<Length<<G4endl; 00166 } //end for(j) 00167 // unitary 00168 00169 box_area[part][seg][gap] = tot_Area; 00170 00171 for(G4int k=1;k<tot_NoStrip+1;k++){ 00172 area[part][seg][gap][k]=area[part][seg][gap][k]/tot_Area; 00173 // G4cout<<"----in noise::init---"<<area[part][seg][gap][k]<<G4endl; 00174 } //end for(k) 00175 00176 } //end if(gap) 00177 } //end for(i) 00178 00179 // G4cout<<"---in noise::init()---area--"<<G4endl; 00180 //for(G4int kk=0;kk<96;kk++){ 00181 // G4cout<<area[1][0][0][kk+1]-area[1][0][0][kk]<<" ,"; 00182 // } 00183 00184 // init MucIdTransform and const pointer 00185 m_ptrIdTr = new MucIdTransform(); 00186 CheckCalibSvc(); 00187 InitProb(); 00188 }
void BesMucNoise::InitProb | ( | ) |
Definition at line 200 of file BesMucNoise.cc.
References genRecEmupikp::i, m_HitMean, and m_Prob.
Referenced by Initialize().
00201 { 00202 m_HitMean = 0.08; 00203 int NHIT = 20; 00204 00205 for( int i=0; i<NHIT; i++) { 00206 m_Prob[i][0] = m_Prob[i][1] = 0.; 00207 } 00208 00209 double sum = 0.; 00210 double EU = TMath::Power(TMath::Exp(1.0), -m_HitMean); 00211 for( int i=0; i<NHIT; i++) 00212 { 00213 m_Prob[i][0] = EU*TMath::Power(m_HitMean, i)/TMath::Factorial(i); 00214 sum += m_Prob[i][0]; 00215 m_Prob[i][1] = sum; 00216 //G4cout << i << "\tProb:\t" << m_Prob[i][0] << "\tSumProb:\t" << m_Prob[i][1] << G4endl; 00217 } 00218 }
BesMucNoise * BesMucNoise::Instance | ( | void | ) | [static] |
Definition at line 31 of file BesMucNoise.cc.
References BesMucNoise(), and fPointer.
Referenced by BesMucSD::BesMucSD().
00031 { 00032 if(!fPointer)fPointer = new BesMucNoise(); 00033 return fPointer; 00034 }
bool BesMucNoise::IsExist | ( | BesMucHit * | aNoiseHit, | |
BesMucHitsCollection * | aMucHitList | |||
) |
Definition at line 327 of file BesMucNoise.cc.
References BesMucHit::GetGap(), BesMucHit::GetPart(), BesMucHit::GetSeg(), BesMucHit::GetStrip(), and BesMucHit::GetTrackIndex().
Referenced by NoiseByCnt(), and NoiseByNosRatio().
00328 { 00329 bool isExist = false; 00330 G4int n_hit = aMucHitList->entries(); 00331 for(G4int iNoise=0;iNoise<n_hit;iNoise++) 00332 { 00333 if ( aNoiseHit->GetTrackIndex()%1000 == (*aMucHitList)[iNoise]->GetTrackIndex()%1000 && 00334 aNoiseHit->GetPart() == (*aMucHitList)[iNoise]->GetPart() && 00335 aNoiseHit->GetSeg() == (*aMucHitList)[iNoise]->GetSeg() && 00336 aNoiseHit->GetGap() == (*aMucHitList)[iNoise]->GetGap() && 00337 aNoiseHit->GetStrip() == (*aMucHitList)[iNoise]->GetStrip() ) 00338 { 00339 isExist = true; 00340 break; 00341 } 00342 } 00343 00344 return isExist; 00345 }
G4int BesMucNoise::IsNearestStrip | ( | G4int | , | |
G4int | , | |||
G4int | , | |||
G4int | , | |||
G4float | ||||
) |
Definition at line 438 of file BesMucNoise.cc.
References area.
Referenced by GetStripNo().
00439 { 00440 if(stripno==1){ 00441 return 0; 00442 }else{ 00443 if(area[part][seg][gap][stripno]!=0){ 00444 // G4cout<<"--in noise::IsNearestStrip()-- "<<area[part][seg][gap][stripno]<<" "<<area[part][seg][gap][stripno-1]<<" "<<random<<G4endl; 00445 if(random<=area[part][seg][gap][stripno]&&random>area[part][seg][gap][stripno-1])return 0; 00446 if(random<=area[part][seg][gap][stripno-1]) return -1; 00447 if(random>area[part][seg][gap][stripno]) return 1; 00448 }else{ 00449 return -1; 00450 } 00451 } //end else 00452 }
G4int BesMucNoise::NoiseByCnt | ( | BesMucHitsCollection * | MucHitCollection, | |
BesMucHitsCollection * | MucHitList | |||
) |
Definition at line 230 of file BesMucNoise.cc.
References IMucCalibConstSvc::getLevel(), MucIdTransform::GetStripMax(), GetStripNo(), genRecEmupikp::i, IsExist(), ganga-rec::j, m_kGap, m_kPart, m_kSegment, m_noiseLevel, m_ptrCalibSvc, m_ptrIdTr, and NoiseSampling().
Referenced by AddNoise().
00231 { 00232 G4int noiseNum = 0; 00233 m_noiseLevel = m_ptrCalibSvc->getLevel(); 00234 00235 for(int i = 0; i < m_kPart; i++) { 00236 for(int j = 0; j < m_kSegment[i]; j++) { 00237 for(int k = 0; k < m_kGap[i]; k++) { 00238 if(m_noiseLevel == 2) 00239 { 00240 G4int hitNum = NoiseSampling( m_noiseLevel, i, j, k, 0 ); 00241 for(G4int ii=0;ii<hitNum;ii++) 00242 { 00243 G4int strip = GetStripNo(i,j,k); 00244 BesMucHit *noiseHit=new BesMucHit(i, j, k, strip, -1, -1); 00245 BesMucHit *noiseHit2=new BesMucHit(i, j, k, strip, -1, -1); 00246 bool noiseHitExist = false; 00247 noiseHitExist = IsExist(noiseHit, MucHitList); 00248 MucHitCollection->insert(noiseHit); 00249 if(!noiseHitExist) { 00250 MucHitList->insert(noiseHit2); 00251 noiseNum += 1; 00252 //G4cout<<"-------insert------- "<<" "<<noiseHit2->GetStrip()<<" "<<i<<" "<<j<<" "<<k<<" "<<l<<" "<<m<<G4endl; 00253 } 00254 else delete noiseHit2; 00255 } // hitNum 00256 } //box level 00257 00258 if(m_noiseLevel == 3) 00259 { 00260 int stripNum = m_ptrIdTr->GetStripMax(i, j, k); 00261 for(int strip = 0; strip < stripNum; strip++) 00262 { 00263 G4int hitNum = NoiseSampling( m_noiseLevel, i, j, k, strip ); 00264 if(hitNum > 0){ 00265 BesMucHit *noiseHit=new BesMucHit(i, j, k, strip, -1, -1); 00266 BesMucHit *noiseHit2=new BesMucHit(i, j, k, strip, -1, -1); 00267 bool noiseHitExist = false; 00268 noiseHitExist = IsExist(noiseHit, MucHitList); 00269 MucHitCollection->insert(noiseHit); 00270 if(!noiseHitExist) { 00271 MucHitList->insert(noiseHit2); 00272 noiseNum += 1; 00273 //G4cout<<"-------insert------- "<<" "<<noiseHit2->GetStrip()<<" "<<i<<" "<<j<<" "<<k<<" "<<l<<" "<<m<<G4endl; 00274 } 00275 else delete noiseHit2; 00276 } 00277 } // stripNum 00278 } // strip level 00279 } // part 00280 } // segment 00281 } // layer 00282 00283 return noiseNum; 00284 }
G4int BesMucNoise::NoiseByNosRatio | ( | BesMucHitsCollection * | MucHitCollection, | |
BesMucHitsCollection * | MucHitList | |||
) |
Definition at line 286 of file BesMucNoise.cc.
References IMucCalibConstSvc::getNosRatio(), genRecEmupikp::i, IsExist(), m_Prob, m_ptrCalibSvc, m_ptrIdTr, prt, MucIdTransform::SetStripPos(), and STRIP_MAX.
Referenced by AddNoise().
00287 { 00288 G4int noiseNum = 0; 00289 G4float random = 0; 00290 00291 //sample noise hit number; 00292 random = G4UniformRand(); 00293 for(int i=0; i<20; i++) { 00294 if(random<m_Prob[i][1]) {noiseNum = i; break;} 00295 } 00296 //G4cout << "Random for noiseNum:\t" << random << "\tProbSum:\t" << m_Prob[noiseNum][1] << "\t" << noiseNum << G4endl; 00297 00298 int prt, seg, lay, str, tmp_strip; 00299 G4float nosRatio = 0.; 00300 00301 for(int i=0; i<noiseNum; i++) 00302 { 00303 do{ 00304 random = G4UniformRand(); 00305 tmp_strip = TMath::Nint(random*STRIP_MAX); //9152 00306 m_ptrIdTr->SetStripPos(tmp_strip, &prt, &seg, &lay, &str); 00307 nosRatio = m_ptrCalibSvc->getNosRatio(prt, seg, lay, str); 00308 random = G4UniformRand(); 00309 if( random<nosRatio ) break; 00310 }while( 1 ); 00311 00312 //G4cout<<"Strip:\t"<<prt<<"\t"<<seg<<"\t"<<lay<<"\t"<<str<<"\t"<<random<<" "<<nosRatio<<G4endl; 00313 00314 BesMucHit *noiseHit = new BesMucHit(prt, seg, lay, str, -1, -1); 00315 BesMucHit *noiseHit2 = new BesMucHit(prt, seg, lay, str, -1, -1); 00316 00317 bool noiseHitExist = false; 00318 noiseHitExist = IsExist(noiseHit, MucHitList); 00319 MucHitCollection->insert(noiseHit); 00320 if(!noiseHitExist) MucHitList->insert(noiseHit2); 00321 else delete noiseHit2; 00322 } // noiseNum; 00323 00324 return noiseNum; 00325 }
G4int BesMucNoise::NoiseSampling | ( | int | level, | |
int | prt, | |||
int | seg, | |||
int | lay, | |||
int | strip | |||
) |
Definition at line 347 of file BesMucNoise.cc.
References box_area, Factorial(), IMucCalibConstSvc::getBoxCnt(), IMucCalibConstSvc::getStripCnt(), lambda, m_ptrCalibSvc, strip_area, and t().
Referenced by NoiseByCnt().
00348 { 00349 G4int hitNum = 0; 00350 G4double lambda; 00351 //must get the time of this event 00352 G4double t=800; //800ns temporary! 00353 G4double e=2.71828182845904590; 00354 00355 if( level == 2 ) 00356 lambda = m_ptrCalibSvc->getBoxCnt(prt,seg,lay) * box_area[prt][seg][lay] * 1E-2 * 1E-9; //1E-2:mm2->cm2 1E-9:ns 00357 else if( level == 3) 00358 lambda = m_ptrCalibSvc->getStripCnt(prt,seg,lay,strip) * strip_area[prt][seg][lay][strip] * 1E-2 * 1E-9; //1E-2:mm2->cm2 1E-9:ns 00359 else 00360 lambda = 0.; 00361 00362 //sample noise hit number; 00363 G4float random=G4UniformRand(); //***use other random 00364 G4double prob = 0; 00365 do{ 00366 prob=prob+pow(e,-lambda*t)*pow(lambda*t,hitNum)/Factorial(hitNum); 00367 if(random<prob) break; 00368 hitNum++; 00369 }while(1); 00370 00371 // G4cout<<" hitNum: "<<hitNum<<G4endl; 00372 return hitNum; 00373 }
G4float BesMucNoise::area[3][8][9][112] [private] |
Definition at line 61 of file BesMucNoise.hh.
Referenced by GetStripNo(), Initialize(), and IsNearestStrip().
G4float BesMucNoise::box_area[3][8][9] [private] |
BesMucNoise * BesMucNoise::fPointer = 0 [static, private] |
double BesMucNoise::m_HitMean [private] |
const int BesMucNoise::m_kAbsorber = {9, 9, 9} [static, private] |
Definition at line 54 of file BesMucNoise.hh.
const int BesMucNoise::m_kGap = {8, 9, 8} [static, private] |
const int BesMucNoise::m_kGasChamber = 2 [static, private] |
Definition at line 57 of file BesMucNoise.hh.
const int BesMucNoise::m_kPanel = {4, 3, 4} [static, private] |
Definition at line 56 of file BesMucNoise.hh.
const int BesMucNoise::m_kPart = 3 [static, private] |
const int BesMucNoise::m_kSegment = {4, 8, 4} [static, private] |
G4double BesMucNoise::m_noise[3][8][9] [private] |
G4double BesMucNoise::m_noise_strip[3][8][9][112] [private] |
Definition at line 60 of file BesMucNoise.hh.
int BesMucNoise::m_noiseLevel [private] |
double BesMucNoise::m_Prob[20][2] [private] |
IMucCalibConstSvc* BesMucNoise::m_ptrCalibSvc [private] |
Definition at line 69 of file BesMucNoise.hh.
Referenced by CheckCalibSvc(), NoiseByCnt(), NoiseByNosRatio(), and NoiseSampling().
MucIdTransform* BesMucNoise::m_ptrIdTr [private] |
Definition at line 70 of file BesMucNoise.hh.
Referenced by Initialize(), NoiseByCnt(), NoiseByNosRatio(), and ~BesMucNoise().
G4float BesMucNoise::strip_area[3][8][9][112] [private] |