]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsimulationSSD.cxx
RC12, RC17 violation: suppression
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSSD.cxx
index 4a06149bc0559499ad1841536be0d1358714790d..e4293e2ed887065233ca0bf282094f9a4607e0f7 100644 (file)
@@ -34,7 +34,8 @@
 #include "AliITSgeom.h"
 #include "AliITSsimulationSSD.h"
 #include "AliITSTableSSD.h"
-//#include "AliITSresponseSSD.h"
+#include <TF1.h>
+
 
 ClassImp(AliITSsimulationSSD)
 ////////////////////////////////////////////////////////////////////////
@@ -52,7 +53,8 @@ AliITSsimulationSSD::AliITSsimulationSSD():AliITSsimulation(),
 fMapA2(0),
 fIonE(0.0),
 fDifConst(),
-fDriftVel(){
+fDriftVel(),
+fTimeResponse(NULL){
     //default Constructor
     //Inputs:
     // none.
@@ -68,7 +70,8 @@ AliITSsimulation(dettyp),
 fMapA2(0),
 fIonE(0.0),
 fDifConst(),
-fDriftVel(){
+fDriftVel(),
+fTimeResponse(NULL){
     // Constructor 
     // Input:
     //   AliITSDetTypeSim    Pointer to the SSD dettype to be used
@@ -77,6 +80,7 @@ fDriftVel(){
     // Return
     //   A standard constructed AliITSsimulationSSD class
 
+  fTimeResponse = new TF1("ftimeresponse",".5*x*exp(1.-.5*x)");
     Init();
 }
 //----------------------------------------------------------------------
@@ -111,6 +115,7 @@ AliITSsimulationSSD& AliITSsimulationSSD::operator=(
   this->fDifConst[1] = s.fDifConst[1];
   this->fDriftVel[0] = s.fDriftVel[0];
   this->fDriftVel[1] = s.fDriftVel[1];
+  this->fTimeResponse = s.fTimeResponse;
   return *this;
 }
 /*
@@ -132,7 +137,8 @@ AliITSsimulationSSD::AliITSsimulationSSD(const AliITSsimulationSSD &source):
 fMapA2(source.fMapA2),
 fIonE(source.fIonE),
 fDifConst(),
-fDriftVel(){
+fDriftVel(),
+fTimeResponse(source.fTimeResponse){
   // copy constructor
   fDifConst[0] = source.fDifConst[0];
   fDifConst[1] = source.fDifConst[1];
@@ -143,6 +149,7 @@ fDriftVel(){
 AliITSsimulationSSD::~AliITSsimulationSSD() {
   // destructor
   delete fMapA2;
+  delete fTimeResponse;
   //delete fDCS;
 }
 //______________________________________________________________________
@@ -219,6 +226,8 @@ void AliITSsimulationSSD::HitsToAnalogDigits(AliITSmodule *mod,
   Double_t x1=0.0, y1=0.0, z1=0.0;
   Double_t de=0.0;
   Int_t module = mod->GetIndex();
+  Double_t tof = 0.;
+  
   
   AliITSsegmentationSSD* seg = (AliITSsegmentationSSD*)GetSegmentationModel(2);
   
@@ -240,6 +249,16 @@ void AliITSsimulationSSD::HitsToAnalogDigits(AliITSmodule *mod,
       cout << endl;
     } // end if
     if (mod->LineSegmentL(i, x0, x1, y0, y1, z0, z1, de, idtrack)) {
+
+      // Scale down dE/dx according to the hit's TOF wrt to the trigger
+      // Necessary for pileup simulation
+      // EF - 21/04/09
+      tof = mod->GetHit(i)->GetTOF();
+      tof *= 1.E+6; // convert time in microsecond
+      if(tof<2.) de = de * fTimeResponse->Eval(-1.*tof+2.);
+      else de = 0.;
+      //
+
       HitToDigit(module, x0, y0, z0, x1, y1, z1, de,tav);
       if (lasttrack != idtrack || i==(nhits-1)) {
        GetList(idtrack,i,module,pList,tav);
@@ -397,7 +416,7 @@ void AliITSsimulationSSD::ApplyNoise(AliITSpList *pList,Int_t module){
   Int_t ix;
   Double_t signal,noise;
   AliITSCalibrationSSD* res =(AliITSCalibrationSSD*)GetCalibrationModel(module);
-  
+   
   // Pside
   for(ix=0;ix<GetNStrips();ix++){      // loop over strips
     
@@ -412,7 +431,7 @@ void AliITSsimulationSSD::ApplyNoise(AliITSpList *pList,Int_t module){
     
     // noise comes in ADC channels from the calibration database
     // It needs to be converted back to electronVolts
-    noise /= res->GetDEvToADC(1.);
+    noise /= res->GetSSDDEvToADC(1.);
     
     // Finally, noise is added to the signal
     signal = noise + fMapA2->GetSignal(0,ix);//get signal from map
@@ -424,7 +443,7 @@ void AliITSsimulationSSD::ApplyNoise(AliITSpList *pList,Int_t module){
   for(ix=0;ix<GetNStrips();ix++){      // loop over strips
     noise  = (Double_t) gRandom->Gaus(0,res->GetNoiseN(ix));// give noise to signal
     noise *= (Double_t) res->GetGainN(ix); 
-    noise /= res->GetDEvToADC(1.);
+    noise /= res->GetSSDDEvToADC(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);
@@ -436,37 +455,38 @@ void AliITSsimulationSSD::ApplyCoupling(AliITSpList *pList,Int_t module) {
   // Apply the effect of electronic coupling between channels
   Int_t ix;
   Double_t signal=0;
-  AliITSCalibrationSSD* res =(AliITSCalibrationSSD*)GetCalibrationModel(module);
-  
+  //AliITSCalibrationSSD* res =(AliITSCalibrationSSD*)GetCalibrationModel(module);
+  AliITSSimuParam* res = fDetType->GetSimuParam();
+    
   Double_t *contrLeft  = new Double_t[GetNStrips()];
   Double_t *contrRight = new Double_t[GetNStrips()];
   
   // P side coupling
   for(ix=0;ix<GetNStrips();ix++){
-    if(ix>0) contrLeft[ix] = fMapA2->GetSignal(0,ix-1)*res->GetCouplingPL();
+    if(ix>0) contrLeft[ix] = fMapA2->GetSignal(0,ix-1)*res->GetSSDCouplingPL();
     else contrLeft[ix] = 0.0;
-    if(ix<(GetNStrips()-1)) contrRight[ix] = fMapA2->GetSignal(0,ix+1)*res->GetCouplingPR();
+    if(ix<(GetNStrips()-1)) contrRight[ix] = fMapA2->GetSignal(0,ix+1)*res->GetSSDCouplingPR();
     else contrRight[ix] = 0.0;
   } // loop over strips 
   
   for(ix=0;ix<GetNStrips();ix++){
-    signal = contrLeft[ix] + contrRight[ix] - res->GetCouplingPL() * fMapA2->GetSignal(0,ix)
-      - res->GetCouplingPR() * fMapA2->GetSignal(0,ix);
+    signal = contrLeft[ix] + contrRight[ix] - res->GetSSDCouplingPL() * fMapA2->GetSignal(0,ix)
+      - res->GetSSDCouplingPR() * fMapA2->GetSignal(0,ix);
     fMapA2->AddSignal(0,ix,signal);
     if(signal>0.0) pList->AddNoise(0,ix,module,signal);
   } // loop over strips 
   
   // N side coupling
   for(ix=0;ix<GetNStrips();ix++){
-    if(ix>0) contrLeft[ix] = fMapA2->GetSignal(1,ix-1)*res->GetCouplingNL();
+    if(ix>0) contrLeft[ix] = fMapA2->GetSignal(1,ix-1)*res->GetSSDCouplingNL();
     else contrLeft[ix] = 0.0;
-    if(ix<(GetNStrips()-1)) contrRight[ix] = fMapA2->GetSignal(1,ix+1)*res->GetCouplingNR();
+    if(ix<(GetNStrips()-1)) contrRight[ix] = fMapA2->GetSignal(1,ix+1)*res->GetSSDCouplingNR();
     else contrRight[ix] = 0.0;
   } // loop over strips 
   
   for(ix=0;ix<GetNStrips();ix++){
-    signal = contrLeft[ix] + contrRight[ix] - res->GetCouplingNL() * fMapA2->GetSignal(0,ix)
-      - res->GetCouplingNR() * fMapA2->GetSignal(0,ix);
+    signal = contrLeft[ix] + contrRight[ix] - res->GetSSDCouplingNL() * fMapA2->GetSignal(0,ix)
+      - res->GetSSDCouplingNR() * fMapA2->GetSignal(0,ix);
     fMapA2->AddSignal(1,ix,signal);
     if(signal>0.0) pList->AddNoise(1,ix,module,signal);
   } // loop over strips 
@@ -640,6 +660,7 @@ void AliITSsimulationSSD::ChargeToSignal(Int_t module,AliITSpList *pList) {
     Float_t charges[3] = {0.0,0.0,0.0};
     Float_t signal;
     AliITSCalibrationSSD* res =(AliITSCalibrationSSD*)GetCalibrationModel(module);
+    AliITSSimuParam* simpar = fDetType->GetSimuParam();
 
     for(Int_t k=0;k<2;k++){         // both sides (0=Pside, 1=Nside)
       for(Int_t ix=0;ix<GetNStrips();ix++){     // loop over strips
@@ -656,15 +677,15 @@ void AliITSsimulationSSD::ChargeToSignal(Int_t module,AliITSpList *pList) {
        else signal /= res->GetGainN(ix);
 
        // signal is converted in unit of ADC
-       signal = res->GetDEvToADC(signal);
-       if(signal>4096.) signal = 4096.;//if exceeding, accumulate last one
+       signal = res->GetSSDDEvToADC(signal);
+       if(signal>4095.) signal = 4095.;//if exceeding, accumulate last one
 
        // threshold for zero suppression is set on the basis of the noise
        // A good value is 3*sigma_noise
        if(k==0) threshold = res->GetNoiseP(ix);
        else threshold = res->GetNoiseN(ix);
 
-       threshold *= res->GetZSThreshold(); // threshold at 3 sigma noise
+       threshold *= simpar->GetSSDZSThreshold(); // threshold at 3 sigma noise
 
        if(signal < threshold) continue;
        //cout<<signal<<" "<<threshold<<endl;
@@ -753,4 +774,3 @@ istream &operator>>(istream &os,AliITSsimulationSSD &source){
 
 
 
-