]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSresponseSDD.cxx
Fix of parsing bug related to the reading of the calib header. Added consistency...
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.cxx
index a5925e6d5c920218333fb47f55cf12709b2d7500..d4975403176a4eef8bda1f15c02ba0716fb270f5 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                         *
+ *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
  * Contributors are mentioned in the code where appropriate.              *
  *                                                                        *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-#include <TString.h>
+/* $Id$ */
+
+//////////////////////////////////////////////////////
+//  Base response class forITS                      //
+//  It is used to set static data members           //
+//  connected to parameters equal for all           //
+//  the modules                                     //
+//                                                  //
+//                                                  //
+//////////////////////////////////////////////////////
+
+#include <TMath.h>
 
 #include "AliITSresponseSDD.h"
 
+const Int_t AliITSresponseSDD::fgkMaxAdcDefault = 1024;
+const Float_t AliITSresponseSDD::fgkDynamicRangeDefault = 132.;
+const Float_t AliITSresponseSDD::fgkfChargeLossDefault = 0;
+const Float_t AliITSresponseSDD::fgkDiffCoeffDefault = 3.23;
+const Float_t AliITSresponseSDD::fgkDiffCoeff1Default = 30.;
+const TString AliITSresponseSDD::fgkParam1Default = "same";
+const TString AliITSresponseSDD::fgkParam2Default = "same";
+const TString AliITSresponseSDD::fgkOptionDefault = "1D";
+const Float_t AliITSresponseSDD::fgkDriftSpeedDefault = 7.3;
+const Float_t AliITSresponseSDD::fgkTimeOffsetDefault = 55.07;
+const Float_t AliITSresponseSDD::fgkADC2keVDefault = 5.243;
+const Float_t AliITSresponseSDD::fgkNsigmasDefault = 3.;
+const Int_t AliITSresponseSDD::fgkNcompsDefault = 121;
 
-//___________________________________________
-ClassImp(AliITSresponseSDD)    
-
-AliITSresponseSDD::AliITSresponseSDD()
-{
-  // constructor
-   SetMaxAdc();
-   SetDiffCoeff();
-   SetDriftSpeed();
-   SetNSigmaIntegration();
-   // SetClock();
-   SetNoiseParam();
-   SetMagicValue();
-   SetMinVal();
-   SetParamOptions();
-   SetZeroSupp();
-   SetDataType();
-   SetFilenames();
-   SetOutputOption();
-   SetDo10to8();
+ClassImp(AliITSresponseSDD)
 
-}
+//_________________________________________________________________________
+AliITSresponseSDD::AliITSresponseSDD():
+AliITSresponse(),
+fJitterError(0.),
+fDynamicRange(0.),
+fChargeLoss(0.),
+fTimeOffset(fgkTimeOffsetDefault),
+fADC2keV(fgkADC2keVDefault),
+fElectronics(0),
+fMaxAdc(fgkMaxAdcDefault),
+fNsigmas(fgkNsigmasDefault),
+fGaus(),
+fNcomps(0),
+fBitComp(kFALSE),
+fOption(),
+fParam1(),
+fParam2() {
+  // default constructor
+  fGaus = 0;
+  SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default);
+  //  SetNLookUp(fgkNcompsDefault);
 
-//__________________________________________________________________________
-AliITSresponseSDD::AliITSresponseSDD(const AliITSresponseSDD &source){
-  //     Copy Constructor 
-  if(&source == this) return;
-  Int_t i;
-  for(i=0;i<8;i++){this->fCPar[i] = source.fCPar[i];}
-  this->fNoise = source.fNoise;
-  this->fBaseline = source.fBaseline;
-  this->fTopValue = source.fTopValue;
-  this->fTemperature = source.fTemperature;
-  this->fDriftSpeed = source.fDriftSpeed;
-  this->fNsigmas = source.fNsigmas;
-  this->fMaxAdc = source.fMaxAdc;
-  this->fDiffCoeff = source.fDiffCoeff;
-  this->fDiffCoeff1 = source.fDiffCoeff1;
-  this->fZeroSuppFlag = source.fZeroSuppFlag;
-  this->fMinVal = source.fMinVal;
-  this->fWrite = source.fWrite;
-  this->fBitComp = source.fBitComp;
-  this->fOption = source.fOption;
-  this->fParam1 = source.fParam1;
-  return;
+  SetJitterError();
+  SetElectronics();
+  SetDynamicRange(fgkDynamicRangeDefault);
+  SetChargeLoss(fgkfChargeLossDefault);
+  SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data());
+  SetZeroSupp(fgkOptionDefault);
+  SetDo10to8();
+  SetOutputOption();
 }
 
-//_________________________________________________________________________
-AliITSresponseSDD& 
-  AliITSresponseSDD::operator=(const AliITSresponseSDD &source) {
-  //    Assignment operator
-  if(&source == this) return *this;
-  Int_t i;
-  for(i=0;i<8;i++){this->fCPar[i] = source.fCPar[i];}
-  this->fNoise = source.fNoise;
-  this->fBaseline = source.fBaseline;
-  this->fTopValue = source.fTopValue;
-  this->fTemperature = source.fTemperature;
-  this->fDriftSpeed = source.fDriftSpeed;
-  this->fNsigmas = source.fNsigmas;
-  this->fMaxAdc = source.fMaxAdc;
-  this->fDiffCoeff = source.fDiffCoeff;
-  this->fDiffCoeff1 = source.fDiffCoeff1;
-  this->fZeroSuppFlag = source.fZeroSuppFlag;
-  this->fMinVal = source.fMinVal;
-  this->fWrite = source.fWrite;
-  this->fBitComp = source.fBitComp;
-  this->fOption = source.fOption;
-  this->fParam1 = source.fParam1;
-  return *this;
+
+//______________________________________________________________________
+AliITSresponseSDD::~AliITSresponseSDD() { 
+
+  if(fGaus) delete fGaus;
 }
 
-void AliITSresponseSDD::SetCompressParam(Int_t  cp[8])
-{
-  // set compression param
 
-    Int_t i;
-    for (i=0; i<8; i++) {
-       fCPar[i]=cp[i];
-       //printf("\n CompressPar %d %d \n",i,fCPar[i]);
-       
-    }
+//______________________________________________________________________
+Int_t AliITSresponseSDD::Convert8to10(Int_t signal) const {
+  // Undo the lossive 10 to 8 bit compression.
+  // code from Davide C. and Albert W.
+
+  if(Do10to8()){  // kTRUE if the compression is active
+    if (signal < 0 || signal > 255) {
+      Warning("Convert8to10","out of range signal=%d",signal);
+      return 0;
+    } // end if signal <0 || signal >255
+
+    if (signal < 128) return signal;
+    if (signal < 192) {
+      if (TMath::Odd(signal)) return (128+((signal-128)<<1));
+      else  return (128+((signal-128)<<1)+1);
+    } // end if signal < 192
+    if (signal < 224) {
+      if (TMath::Odd(signal)) return (256+((signal-192)<<3)+3);
+      else  return (256+((signal-192)<<3)+4);
+    } // end if signal < 224
+    if (TMath::Odd(signal)) return (512+((signal-224)<<4)+7);
+    return (512+((signal-224)<<4)+8);
+  }
+  else {  
+    return signal;
+  }
 }
-void AliITSresponseSDD::GiveCompressParam(Int_t  cp[8])
-{
-  // give compression param
-
-    Int_t i;
-    for (i=0; i<8; i++) {
-       cp[i]=fCPar[i];
-    }
+
+//________________________________________________________________________
+void AliITSresponseSDD::SetNLookUp(Int_t p1){
+  // Set number of sigmas over which cluster disintegration is performed
+  fNcomps=p1;
+  if (fGaus) delete fGaus;
+  fGaus = new TArrayF(fNcomps+1);
+  for(Int_t i=0; i<=fNcomps; i++) {
+    Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
+    (*fGaus)[i] = exp(-((x*x)/2));
+  }
 }