- Double_t sigma[2] = {0.,0.};// standard deviation of the diffusion gaussian
-
- Double_t D[2] = {11.,30.}; // diffusion constant {h,e} (cm**2/sec)
- Double_t tdrift[2] = {0.,0.}; // time of drift
- Double_t vdrift[2] = {0.86E6,2.28E6}; // drift velocity (cm/sec)
- Double_t w;
- Double_t inf[2], sup[2], par0[2];
- // Steps in the module are determined "manually" (i.e. No Geant)
- // NumOfSteps divide path between entering and exiting hits in steps
- Int_t numOfSteps = NumOfSteps(x1, y1, z1, dex, dey, dez);
+ for(Int_t k=0; k<2; k++) { // both sides remember: 0=Pside 1=Nside
+
+ tang[k]=TMath::Tan(tang[k]);
+
+ // w is the coord. perpendicular to the strips
+ Float_t xp=x*1.e+4,zp=z*1.e+4; // microns
+ seg->GetPadTxz(xp,zp);
+ if(k==0) w = xp; // P side strip number
+ else w = zp; // N side strip number
+
+ if((w<(-0.5)) || (w>(GetNStrips()-0.5))) {
+ // this check rejects hits in regions not covered by strips
+ // 0.5 takes into account boundaries
+ if(GetDebug(4)) cout << "x,z="<<x<<","<<z<<" w="<<w
+ <<" Nstrips="<<GetNStrips()<<endl;
+ return; // There are dead region on the SSD sensitive volume.
+ } // end if
+
+ // sigma is the standard deviation of the diffusion gaussian
+ if(tdrift[k]<0) return;
+ sigma[k] = TMath::Sqrt(2*GetDiffConst(k)*tdrift[k]);
+ sigma[k] /= (GetStripPitch()*1.0E-4); //units of Pitch
+ if(sigma[k]==0.0) {
+ Error("HitToDigit"," sigma[%d]=0",k);
+ exit(0);
+ } // end if
+
+ par0[k] = pairs;
+ // we integrate the diffusion gaussian from -3sigma to 3sigma
+ inf[k] = w - 3*sigma[k]; // 3 sigma from the gaussian average
+ sup[k] = w + 3*sigma[k]; // 3 sigma from the gaussian average
+ // IntegrateGaussian does the actual
+ // integration of diffusion gaussian
+ IntegrateGaussian(k, par0[k], w, sigma[k], inf[k], sup[k],tav);
+ } // end for loop over side (0=Pside, 1=Nside)
+ } // end stepping
+}
+
+//______________________________________________________________________
+void AliITSsimulationSSD::ApplyNoise(AliITSpList *pList,Int_t module){
+ // Apply Noise.
+ Int_t ix;
+ Double_t signal,noise;
+ AliITSCalibrationSSD* res =(AliITSCalibrationSSD*)GetCalibrationModel(module);
+
+ // Pside
+ for(ix=0;ix<GetNStrips();ix++){ // loop over strips
+
+ // noise is gaussian
+ noise = (Double_t) gRandom->Gaus(0,res->GetNoiseP().At(ix));
+
+ // need to calibrate noise
+ // NOTE. noise from the calibration database comes uncalibrated,
+ // it needs to be calibrated in order to be added
+ // to the signal. It will be decalibrated later on together with the noise
+ noise *= (Double_t) res->GetGainP(ix);
+
+ // noise comes in ADC channels from the calibration database
+ // It needs to be converted back to electronVolts
+ noise /= res->GetDEvToADC(1.);
+
+ // Finally, noise is added to the signal
+ signal = noise + fMapA2->GetSignal(0,ix);//get signal from map
+ fMapA2->SetHit(0,ix,signal); // give back signal to map
+ if(signal>0.0) pList->AddNoise(0,ix,module,noise);
+ } // loop over strip
+
+ // Nside
+ for(ix=0;ix<GetNStrips();ix++){ // loop over strips
+ noise = (Double_t) gRandom->Gaus(0,res->GetNoiseN().At(ix));// give noise to signal
+ noise *= (Double_t) res->GetGainN(ix);
+ noise /= res->GetDEvToADC(1.);
+ signal = noise + fMapA2->GetSignal(1,ix);//get signal from map
+ fMapA2->SetHit(1,ix,signal); // give back signal to map
+ if(signal>0.0) pList->AddNoise(1,ix,module,noise);
+ } // loop over strip