]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDdigitizer.cxx
BlockFilter component added; minor corrections
[u/mrichter/AliRoot.git] / TRD / AliTRDdigitizer.cxx
index 2f033f0ec7275be1468e7d78cf8d71f51dc9e209..2e36683d57216c3dfb2c4a72888536f86c0e9ba1 100644 (file)
@@ -31,7 +31,6 @@
 //      - Electronics noise                                                  //
 //      - Electronics gain                                                   //
 //      - Digitization                                                       //
-//      - ADC threshold                                                      //
 //  The corresponding parameter can be adjusted via the various              //
 //  Set-functions. If these parameters are not explicitly set, default       //
 //  values are used (see Init-function).                                     //
@@ -73,6 +72,7 @@
 #include "AliTRDcalibDB.h"
 #include "AliTRDSimParam.h"
 #include "AliTRDCommonParam.h"
+#include "AliTRDfeeParam.h"
 
 #include "Cal/AliTRDCalROC.h"
 #include "Cal/AliTRDCalDet.h"
@@ -88,6 +88,7 @@ AliTRDdigitizer::AliTRDdigitizer()
   ,fSDigitsManagerList(0)
   ,fTRD(0)
   ,fGeo(0)
+  ,fFee(0)
   ,fEvent(0)
   ,fMasks(0)
   ,fCompress(kTRUE)
@@ -122,6 +123,7 @@ AliTRDdigitizer::AliTRDdigitizer(const Text_t *name, const Text_t *title)
   ,fSDigitsManagerList(0)
   ,fTRD(0)
   ,fGeo(0)
+  ,fFee(0)
   ,fEvent(0)
   ,fMasks(0)
   ,fCompress(kTRUE)
@@ -157,6 +159,7 @@ AliTRDdigitizer::AliTRDdigitizer(AliRunDigitizer *manager
   ,fSDigitsManagerList(0)
   ,fTRD(0)
   ,fGeo(0)
+  ,fFee(0)
   ,fEvent(0)
   ,fMasks(0)
   ,fCompress(kTRUE)
@@ -191,6 +194,7 @@ AliTRDdigitizer::AliTRDdigitizer(AliRunDigitizer *manager)
   ,fSDigitsManagerList(0)
   ,fTRD(0)
   ,fGeo(0)
+  ,fFee(0)
   ,fEvent(0)
   ,fMasks(0)
   ,fCompress(kTRUE)
@@ -229,6 +233,7 @@ Bool_t AliTRDdigitizer::Init()
   fSDigitsManagerList = 0;
   fTRD                = 0;
   fGeo                = 0;
+  fFee                = AliTRDfeeParam::Instance();
 
   fEvent              = 0;
   fMasks              = 0;
@@ -261,6 +266,7 @@ AliTRDdigitizer::AliTRDdigitizer(const AliTRDdigitizer &d)
   ,fSDigitsManagerList(0)
   ,fTRD(0)
   ,fGeo(0)
+  ,fFee(0)
   ,fEvent(0)
   ,fMasks(0)
   ,fCompress(d.fCompress)
@@ -333,6 +339,11 @@ AliTRDdigitizer::~AliTRDdigitizer()
     fTimeStruct2 = 0;
   }
 
+  if (fGeo) {
+    delete fGeo;
+    fGeo = 0;
+  }
+
 }
 
 //_____________________________________________________________________________
@@ -361,6 +372,7 @@ void AliTRDdigitizer::Copy(TObject &d) const
   ((AliTRDdigitizer &) d).fSDigitsManagerList = 0;
   ((AliTRDdigitizer &) d).fTRD                = 0;
   ((AliTRDdigitizer &) d).fGeo                = 0;
+  ((AliTRDdigitizer &) d).fFee                = fFee;
   ((AliTRDdigitizer &) d).fEvent              = 0;
   ((AliTRDdigitizer &) d).fMasks              = 0;
   ((AliTRDdigitizer &) d).fCompress           = fCompress;
@@ -658,8 +670,7 @@ Bool_t AliTRDdigitizer::InitDetector()
   }
 
   // Get the geometry
-  fGeo = fTRD->GetGeometry();
-  AliDebug(1,Form("Geometry version %d",fGeo->IsVersion()));
+  fGeo = new AliTRDgeometry();
 
   // Create a digits manager
   delete fDigitsManager;
@@ -761,7 +772,6 @@ Bool_t AliTRDdigitizer::MakeDigits()
     AliError("No geometry defined");
     return kFALSE;
   }
-  fGeo->ReadGeoMatrices();
 
   AliTRDSimParam    *simParam    = AliTRDSimParam::Instance();
   if (!simParam) {
@@ -858,7 +868,7 @@ Bool_t AliTRDdigitizer::MakeDigits()
       Float_t hittime  = hit->GetTime();
       Int_t   plane    = fGeo->GetPlane(detector);
       Int_t   chamber  = fGeo->GetChamber(detector);
-      padPlane         = commonParam->GetPadPlane(plane,chamber);
+      padPlane         = fGeo->GetPadPlane(plane,chamber);
       Float_t row0     = padPlane->GetRow0ROC();
       Int_t   nRowMax  = padPlane->GetNrows();
       Int_t   nColMax  = padPlane->GetNcols();
@@ -866,7 +876,7 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
       // Find the current volume with the geo manager
       gGeoManager->SetCurrentPoint(pos);
-      gGeoManager->FindNode();
+      gGeoManager->FindNode();      
       if (strstr(gGeoManager->GetPath(),"/UK")) {
        inDrift = 0;
       }
@@ -1169,8 +1179,8 @@ Bool_t AliTRDdigitizer::MakeDigits()
     Int_t plane      = fGeo->GetPlane(iDet);
     Int_t sector     = fGeo->GetSector(iDet);
     Int_t chamber    = fGeo->GetChamber(iDet);
-    Int_t nRowMax    = commonParam->GetRowMax(plane,chamber,sector);
-    Int_t nColMax    = commonParam->GetColMax(plane);
+    Int_t nRowMax    = fGeo->GetRowMax(plane,chamber,sector);
+    Int_t nColMax    = fGeo->GetColMax(plane);
 
     Double_t *inADC  = new Double_t[nTimeTotal];
     Double_t *outADC = new Double_t[nTimeTotal];
@@ -1281,7 +1291,8 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
             for (iTime = 0; iTime < nTimeTotal; iTime++) {   
               // Store the amplitude of the digit if above threshold
-              if (outADC[iTime] > (simParam->GetADCbaseline() + simParam->GetADCthreshold())) {
+              // if (outADC[iTime] > (simParam->GetADCbaseline() + simParam->GetADCthreshold())) {
+              if (outADC[iTime] != 0 ) {   // Now this is enough because there is ZS in raw simulator
                 nDigits++;
                 digits->SetDataUnchecked(iRow,iCol,iTime,((Int_t) outADC[iTime]));
              }
@@ -1385,12 +1396,6 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
     return kFALSE;
   }
   
-  AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
-  if (!commonParam) {
-    AliFatal("Could not get common parameters");
-    return kFALSE;
-  }
-  
   AliTRDcalibDB     *calibration = AliTRDcalibDB::Instance();
   if (!calibration) {
     AliFatal("Could not get calibration object");
@@ -1406,7 +1411,6 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
   Double_t convert      = kEl2fC * chipGain;
   Double_t adcInRange   = simParam->GetADCinRange();
   Double_t adcOutRange  = simParam->GetADCoutRange();
-  Int_t    adcThreshold = simParam->GetADCthreshold();
   Int_t    adcBaseline  = simParam->GetADCbaseline();   
   Int_t    nTimeTotal   = calibration->GetNumberOfTimeBins();
 
@@ -1424,8 +1428,8 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
     Int_t plane      = fGeo->GetPlane(iDet);
     Int_t sector     = fGeo->GetSector(iDet);
     Int_t chamber    = fGeo->GetChamber(iDet);
-    Int_t nRowMax    = commonParam->GetRowMax(plane,chamber,sector);
-    Int_t nColMax    = commonParam->GetColMax(plane);
+    Int_t nRowMax    = fGeo->GetRowMax(plane,chamber,sector);
+    Int_t nColMax    = fGeo->GetColMax(plane);
 
     Double_t *inADC  = new Double_t[nTimeTotal];
     Double_t *outADC = new Double_t[nTimeTotal];
@@ -1497,7 +1501,8 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
 
           for (iTime = 0; iTime < nTimeTotal; iTime++) {
             // Store the amplitude of the digit if above threshold
-            if (outADC[iTime] > (adcBaseline + adcThreshold)) {
+            // if (outADC[iTime] > (adcBaseline + adcThreshold)) {
+           if (outADC[iTime] != 0) {  // now this is ok because there is ZS in raw simulation
               digitsOut->SetDataUnchecked(iRow,iCol,iTime,((Int_t) outADC[iTime]));
              // Copy the dictionary
               for (iDict = 0; iDict < kNDict; iDict++) { 
@@ -1549,12 +1554,6 @@ Bool_t AliTRDdigitizer::MergeSDigits()
     return kFALSE;
   }
   
-  AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
-  if (!commonParam) {
-    AliFatal("Could not get common parameters");
-    return kFALSE;
-  }
-  
   AliTRDcalibDB     *calibration = AliTRDcalibDB::Instance();
   if (!calibration) {
     AliFatal("Could not get calibration object");
@@ -1601,8 +1600,8 @@ Bool_t AliTRDdigitizer::MergeSDigits()
       Int_t plane   = fGeo->GetPlane(iDet);
       Int_t sector  = fGeo->GetSector(iDet);
       Int_t chamber = fGeo->GetChamber(iDet);
-      Int_t nRowMax = commonParam->GetRowMax(plane,chamber,sector);
-      Int_t nColMax = commonParam->GetColMax(plane);
+      Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector);
+      Int_t nColMax = fGeo->GetColMax(plane);
 
       // Loop through the pixels of one detector and add the signals
       digitsA = fSDigitsManager->GetDigits(iDet);