]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDmcmSim.cxx
Move the diffusion coefficients, the time structure, omegaTau for ExB, and switches...
[u/mrichter/AliRoot.git] / TRD / AliTRDmcmSim.cxx
index 39b1eb25570fab7d3cb7d691baae710fba0ba03e..41ed94532dff0ce30574b21955c9d5cd730bc608 100644 (file)
@@ -99,6 +99,7 @@ The default raw version is 2.
 #include "AliTRDmcmSim.h"
 #include "AliTRDfeeParam.h"
 #include "AliTRDSimParam.h"
+#include "AliTRDCommonParam.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDcalibDB.h"
 #include "AliTRDdigitsManager.h"
@@ -610,7 +611,7 @@ Int_t AliTRDmcmSim::ProduceRawStream( UInt_t *buf, Int_t maxSize )
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
+Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize, UInt_t iEv )
 {
   //
   // Produce raw data stream from this MCM and put in buf
@@ -619,7 +620,7 @@ Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
   //
 
   UInt_t  x;
-  UInt_t  iEv = 0;
+  //UInt_t  iEv = 0;
   Int_t   nw  = 0;  // Number of written words
   Int_t   of  = 0;  // Number of overflowed words
   Int_t   rawVer   = fFeeParam->GetRAWversion();
@@ -634,8 +635,13 @@ Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
     adc = fADCF;
   }
 
-  // Produce MCM header
-  x = (1<<31) | ((fRobPos * fFeeParam->GetNmcmRob() + fMcmPos) << 24) | ((iEv % 0x100000) << 4) | 0xC;
+  // Produce MCM header : xrrr mmmm eeee eeee eeee eeee eeee 1100
+  //                      x : 0 before , 1 since 10.2007
+  //                      r : Readout board position (Alice numbering)
+  //                      m : MCM posi
+  //                      e : Event counter from 1
+  //x = (1<<31) | ((fRobPos * fFeeParam->GetNmcmRob() + fMcmPos) << 24) | ((iEv % 0x100000) << 4) | 0xC;
+  x = (1<<31) | (fRobPos << 28) | (fMcmPos << 24) | ((iEv % 0x100000) << 4) | 0xC;
   if (nw < maxSize) {
     buf[nw++] = x;
        //printf("\nMCM header: %X ",x);
@@ -673,7 +679,7 @@ Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
 
   for (Int_t iAdc = 0; iAdc < 21; iAdc++ ) {
     if( rawVer>= 3 && fZSM1Dim[iAdc] != 0 ) continue; // Zero Suppression, 0 means not suppressed
-    aa = !(iAdc & 1) + 2;
+    aa = !(iAdc & 1) + 2;      // 3 for the even ADC channel , 2 for the odd ADC channel
     for (Int_t iT = 0; iT < fNTimeBin; iT+=3 ) {
       a1 = ((iT    ) < fNTimeBin ) ? adc[iAdc][iT  ] : 0;
       a2 = ((iT + 1) < fNTimeBin ) ? adc[iAdc][iT+1] : 0;
@@ -837,8 +843,9 @@ void AliTRDmcmSim::FilterTail()
     break;
   }
 
-  delete dtarg;
-  delete itarg;
+  delete [] dtarg;
+  delete [] itarg;
+
 }
 
 //_____________________________________________________________________________
@@ -2181,7 +2188,7 @@ void AliTRDmcmSim::Tracklet(){
   Int_t    nrOfAmplTimeBins  = 2;                           // the number of time bins between anode wire and cathode wires in ampl.region (3.5mm)(guess)(suppose v_drift+3.5cm/us there=>all clusters arrive at anode wire within one time bin (100ns))
   Int_t    nrOfOffsetCorrTimeBins = tFS - nrOfAmplTimeBins - 1; // -1 is  to be conservative; offset correction will not remove the shift but is supposed to improve it; if tFS = 5, 2 drift time bins before tFS are assumed
   if(nrOfOffsetCorrTimeBins < 0) nrOfOffsetCorrTimeBins = 0;// don't apply offset correction if no drift time bins before tFS can be assumed 
-  Double_t lorTan     = fCal->GetOmegaTau(vdrift,magField); // tan of the Lorentz-angle for this detector; could be evaluated and set as a parameter for each mcm
+  Double_t lorTan     = AliTRDCommonParam::Instance()->GetOmegaTau(vdrift); // tan of the Lorentz-angle for this detector; could be evaluated and set as a parameter for each mcm
   //Double_t lorAngle   =  7.0;                             // Lorentz-angle in degrees
   Double_t tiltAngle  = padPlane->GetTiltingAngle();        // sign-respecting tilting angle of pads in actual layer
   Double_t tiltTan    = TMath::Tan(TMath::Pi()/180.0 * tiltAngle);
@@ -2537,7 +2544,7 @@ void AliTRDmcmSim::Tracklet(){
   Int_t u = 0;
 
   AliTRDdigitsManager *digman = new AliTRDdigitsManager();
-  digman->ReadDigits(gAlice->GetRunLoader()->GetLoader("TRDLoader")->TreeD());
+  digman->ReadDigits(AliRunLoader::Instance()->GetLoader("TRDLoader")->TreeD());
   digman->SetUseDictionaries(kTRUE);
   AliTRDfeeParam *feeParam = AliTRDfeeParam::Instance();
 
@@ -2582,7 +2589,7 @@ void AliTRDmcmSim::Tracklet(){
       }
   }
 
AliDataLoader *dl = gAlice->GetRunLoader()->GetLoader("TRDLoader")->GetDataLoader("tracklets");
 AliDataLoader *dl = AliRunLoader::Instance()->GetLoader("TRDLoader")->GetDataLoader("tracklets");
   if (!dl) {
     AliError("Could not get the tracklets data loader!");
   }
@@ -2734,5 +2741,25 @@ void AliTRDmcmSim::FlagDigitsArray(AliTRDarrayADC *tempdigs, Int_t valrow)
        }
     }
 }
+//_______________________________________________________________________________________
+void AliTRDmcmSim::RestoreZeros()
+{
+  //
+  // Restore the zero-suppressed values (set as -1) to the value 0
+  //
+
+  for( Int_t iadc = 1 ; iadc < fNADC-1; iadc++ ) 
+    {
+      for( Int_t it = 0 ; it < fNTimeBin ; it++ ) 
+       {
+         
+         if(fADCF[iadc][it]==-1)  //if is a supressed zero, reset to zero
+           {
+             fADCF[iadc][it]=0;
+             fADCR[iadc][it]=0;
+           }     
+       }
+    }
 
+}