Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BesMucNoise Class Reference

#include <BesMucNoise.hh>

List of all members.

Public Member Functions

G4int AddNoise (int model, BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList)
G4int AddNoise (int model, BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList)
 BesMucNoise ()
 BesMucNoise ()
void CheckCalibSvc ()
void CheckCalibSvc ()
G4float Factorial (G4int i)
G4float Factorial (G4int i)
G4int GetStripNo (G4int, G4int, G4int)
G4int GetStripNo (G4int, G4int, G4int)
void Initialize (G4String filename, G4LogicalVolume *logicalMuc, G4String temp)
void Initialize (G4String filename, G4LogicalVolume *logicalMuc)
void Initialize (G4String filename, G4LogicalVolume *logicalMuc, G4String temp)
void Initialize (G4String filename, G4LogicalVolume *logicalMuc)
void InitProb ()
void InitProb ()
bool IsExist (BesMucHit *aNoiseHit, BesMucHitsCollection *aMucHitList)
bool IsExist (BesMucHit *aNoiseHit, BesMucHitsCollection *aMucHitList)
G4int IsNearestStrip (G4int, G4int, G4int, G4int, G4float)
G4int IsNearestStrip (G4int, G4int, G4int, G4int, G4float)
G4int NoiseByCnt (BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList)
G4int NoiseByCnt (BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList)
G4int NoiseByNosRatio (BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList)
G4int NoiseByNosRatio (BesMucHitsCollection *MucHitCollection, BesMucHitsCollection *MucHitList)
G4int NoiseSampling (int level, int prt, int seg, int lay, int strip)
G4int NoiseSampling (int level, int prt, int seg, int lay, int strip)
 ~BesMucNoise ()
 ~BesMucNoise ()

Static Public Member Functions

BesMucNoiseInstance (void)
BesMucNoiseInstance (void)

Private Attributes

G4float area [3][8][9][112]
G4float box_area [3][8][9]
double m_HitMean
G4double m_noise [3][8][9]
G4double m_noise_strip [3][8][9][112]
int m_noiseLevel
double m_Prob [20][2]
IMucCalibConstSvcm_ptrCalibSvc
IMucCalibConstSvcm_ptrCalibSvc
MucIdTransformm_ptrIdTr
MucIdTransformm_ptrIdTr
G4float strip_area [3][8][9][112]

Static Private Attributes

BesMucNoisefPointer
BesMucNoisefPointer = 0
const int m_kAbsorber [m_kPart] = {9, 9, 9}
const int m_kGap [m_kPart] = {8, 9, 8}
const int m_kGasChamber = 2
const int m_kPanel [m_kPart] = {4, 3, 4}
const int m_kPart = 3
const int m_kSegment [m_kPart] = {4, 8, 4}


Constructor & Destructor Documentation

BesMucNoise::BesMucNoise  ) 
 

00038 {
00039  if(fPointer)
00040   {G4Exception("BesMucNoise constructed twice.");}
00041   fPointer=this;
00042   
00043 }

BesMucNoise::~BesMucNoise  ) 
 

00046 {
00047   if( m_ptrIdTr != NULL ) delete m_ptrIdTr;
00048 
00049 }

BesMucNoise::BesMucNoise  ) 
 

BesMucNoise::~BesMucNoise  ) 
 


Member Function Documentation

G4int BesMucNoise::AddNoise int  model,
BesMucHitsCollection MucHitCollection,
BesMucHitsCollection MucHitList
 

G4int BesMucNoise::AddNoise int  model,
BesMucHitsCollection MucHitCollection,
BesMucHitsCollection MucHitList
 

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  ) 
 

void BesMucNoise::CheckCalibSvc  ) 
 

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  ) 
 

G4float BesMucNoise::Factorial G4int  i  ) 
 

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 
 

G4int BesMucNoise::GetStripNo G4int  ,
G4int  ,
G4int 
 

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
 

void BesMucNoise::Initialize G4String  filename,
G4LogicalVolume *  logicalMuc
 

void BesMucNoise::Initialize G4String  filename,
G4LogicalVolume *  logicalMuc,
G4String  temp
 

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
 

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  ) 
 

void BesMucNoise::InitProb  ) 
 

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]
 

BesMucNoise * BesMucNoise::Instance void   )  [static]
 

00031                                        {
00032   if(!fPointer)fPointer = new BesMucNoise();
00033   return fPointer;
00034 }

bool BesMucNoise::IsExist BesMucHit aNoiseHit,
BesMucHitsCollection aMucHitList
 

bool BesMucNoise::IsExist BesMucHit aNoiseHit,
BesMucHitsCollection aMucHitList
 

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 
 

G4int BesMucNoise::IsNearestStrip G4int  ,
G4int  ,
G4int  ,
G4int  ,
G4float 
 

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
 

G4int BesMucNoise::NoiseByCnt BesMucHitsCollection MucHitCollection,
BesMucHitsCollection MucHitList
 

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
 

G4int BesMucNoise::NoiseByNosRatio BesMucHitsCollection MucHitCollection,
BesMucHitsCollection MucHitList
 

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
 

G4int BesMucNoise::NoiseSampling int  level,
int  prt,
int  seg,
int  lay,
int  strip
 

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 }


Member Data Documentation

G4float BesMucNoise::area [private]
 

G4float BesMucNoise::box_area [private]
 

BesMucNoise* BesMucNoise::fPointer [static, private]
 

BesMucNoise * BesMucNoise::fPointer = 0 [static, private]
 

double BesMucNoise::m_HitMean [private]
 

const int BesMucNoise::m_kAbsorber = {9, 9, 9} [static, private]
 

const int BesMucNoise::m_kGap = {8, 9, 8} [static, private]
 

const int BesMucNoise::m_kGasChamber = 2 [static, private]
 

const int BesMucNoise::m_kPanel = {4, 3, 4} [static, private]
 

const int BesMucNoise::m_kPart = 3 [static, private]
 

const int BesMucNoise::m_kSegment = {4, 8, 4} [static, private]
 

G4double BesMucNoise::m_noise [private]
 

G4double BesMucNoise::m_noise_strip [private]
 

int BesMucNoise::m_noiseLevel [private]
 

double BesMucNoise::m_Prob [private]
 

IMucCalibConstSvc* BesMucNoise::m_ptrCalibSvc [private]
 

IMucCalibConstSvc* BesMucNoise::m_ptrCalibSvc [private]
 

MucIdTransform* BesMucNoise::m_ptrIdTr [private]
 

MucIdTransform* BesMucNoise::m_ptrIdTr [private]
 

G4float BesMucNoise::strip_area [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 15:52:58 2011 for BOSS6.5.5 by  doxygen 1.3.9.1