]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsimulationSDD.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSDD.cxx
index 3c06b4dd8a26f00e332b321c4e387c727f716e77..6214c498502e81348065599bd40595e16f929663 100644 (file)
@@ -28,7 +28,6 @@
 #include <TROOT.h>
 #include "AliITS.h"
 #include "AliITSMapA2.h"
-#include "AliITSRawData.h"
 #include "AliITSdigitSPD.h"
 #include "AliITSetfSDD.h"
 #include "AliITSmodule.h"
@@ -40,6 +39,8 @@
 #include "AliLog.h"
 #include "AliRun.h"
 
+using std::endl;
+using std::cout;
 ClassImp(AliITSsimulationSDD)
 ////////////////////////////////////////////////////////////////////////
 // Version: 0                                                         //
@@ -74,49 +75,7 @@ fScaleSize(0){
     SetCrosstalkFlag();
     SetDoFFT();
 }
-//______________________________________________________________________
-AliITSsimulationSDD::AliITSsimulationSDD(const AliITSsimulationSDD &source) :
-    AliITSsimulation(source),
-fITS(source.fITS),
-fHitMap2(source.fHitMap2),
-fHitSigMap2(source.fHitSigMap2),
-fHitNoiMap2(source.fHitNoiMap2),
-fElectronics(source.fElectronics),
-fInZR(source.fInZR),
-fInZI(source.fInZI),
-fOutZR(source.fOutZR),
-fOutZI(source.fOutZI),
-fAnodeFire(source.fAnodeFire),
-fHis(source.fHis),
-fFlag(source.fFlag),
-fCrosstalkFlag(source.fCrosstalkFlag),
-fDoFFT(source.fDoFFT),
-fNofMaps(source.fNofMaps),
-fMaxNofSamples(source.fMaxNofSamples),
-fScaleSize(source.fScaleSize){
-    // Copy constructor to satify Coding roules only.
-
-}
-//______________________________________________________________________
-AliITSsimulationSDD& AliITSsimulationSDD::operator=(const AliITSsimulationSDD &src){
-    // Assignment operator to satify Coding roules only.
-
-    if(this==&src) return *this;
-    Error("AliITSsimulationSDD","Not allowed to make a = with "
-          "AliITSsimulationSDD Using default creater instead");
-    return *this ;
-}
-/*
-//______________________________________________________________________
-AliITSsimulation& AliITSsimulationSDD::operator=(const AliITSsimulation &src){
-    // Assignment operator to satify Coding roules only.
 
-    if(this==&src) return *this;
-    Error("AliITSsimulationSSD","Not allowed to make a = with "
-          "AliITSsimulationSDD Using default creater instead");
-    return *this ;
-}
-*/
 //______________________________________________________________________
 AliITSsimulationSDD::AliITSsimulationSDD(AliITSDetTypeSim* dettyp):
 AliITSsimulation(dettyp),
@@ -399,9 +358,13 @@ void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
   Double_t  nsigma     = simpar->GetNSigmaIntegration(); //
   Int_t     nlookups   = simpar->GetGausNLookUp();       //
   Float_t   jitter     = simpar->GetSDDJitterError(); // 
+  Float_t   mapsmear   = simpar->GetSDDCorrMapPrecision(); // 
   Float_t   trigDelay  = simpar->GetSDDTrigDelay(); // compensation for MC time zero
   if(res->IsAMAt20MHz()) trigDelay+=12.5; // compensation for discretization step
+
   Float_t   timeZero=fDetType->GetResponseSDD()->GetTimeZero(fModule);
+  Float_t   adcscale   = fDetType->GetResponseSDD()->GetADCtokeV(fModule);
+  adcscale/=simpar->GetSDDkeVtoADC();
 
   // Piergiorgio's part (apart for few variables which I made float
   // when i thought that can be done
@@ -450,12 +413,11 @@ void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
     if(!mod->LineSegmentL(ii,xL[0],dxL[0],xL[1],dxL[1],xL[2],dxL[2],
                          depEnergy,itrack)) continue;
     Float_t xloc=xL[0];
-    if(xloc>0) iWing=0; // left side, carlos channel 0
-    else iWing=1; // right side
-    
     Float_t zloc=xL[2]+0.5*dxL[2];
     zAnode=seg->GetAnodeFromLocal(xloc,zloc); // anode number in the range 0.-511.
     driftSpeed = res->GetDriftSpeedAtAnode(zAnode);
+    driftSpeed+= fDetType->GetResponseSDD()->GetDeltaVDrift(fModule,zAnode>255);
+
     if(timeStep*fMaxNofSamples < sddLength/driftSpeed) {
       AliWarning("Time Interval > Allowed Time Interval");
     }
@@ -476,14 +438,20 @@ void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
       AliDebug(1,Form("TOF for hit %d on mod %d (particle %d)=%g",ii,fModule,h->Track(),tof));
     }
 
+    Float_t corrx=0, corrz=0;
+    res->GetShiftsForSimulation(xL[2],xL[0],corrz,corrx,seg);
+    xL[2]-=corrz;
+    xL[0]-=corrx;
+    xL[0] += 0.0001*gRandom->Gaus( 0, mapsmear); //
     xL[0] += 0.0001*gRandom->Gaus( 0, jitter ); //
+
     pathInSDD = TMath::Sqrt(dxL[0]*dxL[0]+dxL[1]*dxL[1]+dxL[2]*dxL[2]);
     
     if (fFlag && pathInSDD) { depEnergy *= (0.03/pathInSDD); }
     drPath = TMath::Abs(10000.*(dxL[0]+2.*xL[0])*0.5);
     drPath = sddLength-drPath;
     if(drPath < 0) {
-      AliDebug(1, // this should be fixed at geometry level
+      AliInfo( // this should be fixed at geometry level
               Form("negative drift path drPath=%e sddLength=%e dxL[0]=%e xL[0]=%e",
                    drPath,sddLength,dxL[0],xL[0]));
       continue;
@@ -507,7 +475,11 @@ void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
       theSteps+=1.;
       theAverage+=avAnode;
       zAnode = seg->GetAnodeFromLocal(avDrft,avAnode);
+      //      if(avDrft*xloc<0) AliDebug(1,Form("Swap of side xloc_orig=%f  xloc_now=%f",xloc,avDrft));
+      iWing = seg->GetSideFromLocalX(avDrft);
+    
       driftSpeed = res->GetDriftSpeedAtAnode(zAnode);  
+      driftSpeed+= fDetType->GetResponseSDD()->GetDeltaVDrift(fModule,zAnode>255);
       driftPath = TMath::Abs(10000.*avDrft);
       driftPath = sddLength-driftPath;
       if(driftPath < 0) {
@@ -533,6 +505,7 @@ void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
        (timeStep*eVpairs*2.*acos(-1.));
       chargeloss = 1.-cHloss*driftPath/1000.;
       amplitude *= chargeloss;
+      amplitude *= adcscale;
       width  = 2.*nsigma/(nlookups-1);
       // Spread the charge 
       nsplitAn = 4; 
@@ -1002,3 +975,4 @@ void AliITSsimulationSDD::PrintStatus() const {
     cout << "Scale size factor: " << fScaleSize << endl;
     cout << "**************************************************" << endl;
 }
+