]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSresponseSDD.cxx
New detector numbering scheme (common for DAQ/HLT/Offline). All the subdetectors...
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.cxx
index bfcd6ec884f81936747a64c2916c2ee9830dd14e..43167b9d0f107ee778f8fe022eded7bb4e2a8273 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 <TMath.h>
-
-#include "AliITSgeom.h"
 #include "AliITSresponseSDD.h"
-#include "AliITS.h"
-#include "AliRun.h"
+//////////////////////////////////////////////////////
+//  Base response class forITS                      //
+//  It is used to set static data members           //
+//  connected to parameters equal for all           //
+//  the modules                                     //
+//                                                  //
+//                                                  //
+//////////////////////////////////////////////////////
+
+
+const Int_t AliITSresponseSDD::fgkMaxAdcDefault = 1024;
+const Double_t AliITSresponseSDD::fgkDynamicRangeDefault = 132.;
+const Double_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 Double_t AliITSresponseSDD::fgkDriftSpeedDefault = 7.3;
+const Double_t AliITSresponseSDD::fgkNsigmasDefault = 3.;
+const Int_t AliITSresponseSDD::fgkNcompsDefault = 121;
+
+ClassImp(AliITSresponseSDD)
+
+//_________________________________________________________________________
+AliITSresponseSDD::AliITSresponseSDD():AliITSresponse(){
+  // default constructor
+  fGaus = 0;
+  SetMaxAdc(fgkMaxAdcDefault);
+  SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default);
+  SetDriftSpeed(fgkDriftSpeedDefault);
+  SetNSigmaIntegration(fgkNsigmasDefault);
+  SetNLookUp(fgkNcompsDefault);
 
-class AliITS;
+  SetJitterError();
+  SetElectronics();
+  SetDynamicRange(fgkDynamicRangeDefault);
+  SetChargeLoss(fgkfChargeLossDefault);
+  SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data());
+  SetZeroSupp(fgkOptionDefault);
+  SetDo10to8();
+  SetOutputOption();
+}
 
-//___________________________________________
-ClassImp(AliITSresponseSDD)    
 
-AliITSresponseSDD::AliITSresponseSDD()
-{
-  // constructor
-   SetMaxAdc();
-   SetDiffCoeff();
-   SetQref();
-   SetDriftSpeed();
-   // SetClock();
-   SetNoiseParam();
-   SetMagicValue();
-   SetMinVal();
-   SetParamOptions();
-   SetZeroSupp();
-   SetDataType();
-   SetFilenames();
-   SetOutputOption();
+//______________________________________________________________________
+AliITSresponseSDD::~AliITSresponseSDD() { 
 
+  if(fGaus) delete fGaus;
 }
 
-//__________________________________________________________________________
-AliITSresponseSDD::AliITSresponseSDD(const AliITSresponseSDD &source){
-  //     Copy Constructor 
-  Int_t i;
-  if(&source == this) return;
-  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->fMaxAdc = source.fMaxAdc;
-  this->fDiffCoeff = source.fDiffCoeff;
-  this->fQref = source.fQref;
-  this->fZeroSuppFlag = source.fZeroSuppFlag;
-  this->fMinVal = source.fMinVal;
-  this->fWrite = source.fWrite;
-  this->fOption = source.fOption;
-  this->fParam1 = source.fParam1;
-  return;
+//______________________________________________________________________
+AliITSresponseSDD::AliITSresponseSDD(const AliITSresponseSDD &ob) : AliITSresponse(ob) {
+  // Copy constructor
+  // Copies are not allowed. The method is protected to avoid misuse.
+  Error("AliITSresponseSDD","Copy constructor not allowed\n");
 }
 
-//_________________________________________________________________________
-AliITSresponseSDD& 
-  AliITSresponseSDD::operator=(const AliITSresponseSDD &source) {
-  //    Assignment operator
-  Int_t i;
-  if(&source == this) return *this;
-  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->fMaxAdc = source.fMaxAdc;
-  this->fDiffCoeff = source.fDiffCoeff;
-  this->fQref = source.fQref;
-  this->fZeroSuppFlag = source.fZeroSuppFlag;
-  this->fMinVal = source.fMinVal;
-  this->fWrite = source.fWrite;
-  this->fOption = source.fOption;
-  this->fParam1 = source.fParam1;
+//______________________________________________________________________
+AliITSresponseSDD& AliITSresponseSDD::operator=(const AliITSresponseSDD& /* ob */){
+  // Assignment operator
+  // Assignment is not allowed. The method is protected to avoid misuse.
+  Error("= operator","Assignment operator not allowed\n");
   return *this;
 }
 
-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]);
-       
-    }
-}
-void AliITSresponseSDD::GiveCompressParam(Int_t  cp[8])
-{
-  // give compression param
-    Int_t i;
-    for(i=0; i<8; i++) {
-       cp[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::Streamer(TBuffer &R__b)
-{
-   // Stream an object of class AliITSresponseSDD.
 
-   if (R__b.IsReading()) {
-      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-      AliITSresponse::Streamer(R__b);
-      R__b.ReadStaticArray(fCPar);
-      R__b >> fNoise;
-      R__b >> fBaseline;
-      R__b >> fTopValue;
-      R__b >> fTemperature;
-      R__b >> fDriftSpeed;
-      R__b >> fMaxAdc;
-      R__b >> fDiffCoeff;
-      R__b >> fQref;
-      R__b >> fZeroSuppFlag;
-      R__b >> fMinVal;
-      R__b >> fWrite;
-      //R__b.ReadArray(fOption); // Not to be printed out?
-      //R__b.ReadArray(fParam1); // Not to be printed out?
-      //R__b.ReadArray(fParam2); // Not to be printed out?
-      fDataType.Streamer(R__b);
-      fFileName1.Streamer(R__b);
-      fFileName2.Streamer(R__b);
-      fFileName3.Streamer(R__b);
-   } else {
-      R__b.WriteVersion(AliITSresponseSDD::IsA());
-      AliITSresponse::Streamer(R__b);
-      R__b.WriteArray(fCPar, 8);
-      R__b << fNoise;
-      R__b << fBaseline;
-      R__b << fTopValue;
-      R__b << fTemperature;
-      R__b << fDriftSpeed;
-      R__b << fMaxAdc;
-      R__b << fDiffCoeff;
-      R__b << fQref;
-      R__b << fZeroSuppFlag;
-      R__b << fMinVal;
-      R__b << fWrite;
-      //R__b.WriteArray(fOption, __COUNTER__); // Not to be printed out?
-      //R__b.WriteArray(fParam1, __COUNTER__); // Not to be printed out?
-      //R__b.WriteArray(fParam2, __COUNTER__); // Not to be printed out?
-      fDataType.Streamer(R__b);
-      fFileName1.Streamer(R__b);
-      fFileName2.Streamer(R__b);
-      fFileName3.Streamer(R__b);
-   }
+//________________________________________________________________________
+void AliITSresponseSDD::SetNLookUp(Int_t p1){
+  // Set number of sigmas over which cluster disintegration is performed
+  fNcomps=p1;
+  fGaus = new TArrayF(fNcomps+1);
+  for(Int_t i=0; i<=fNcomps; i++) {
+    Double_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
+    (*fGaus)[i] = exp(-((x*x)/2));
+  }
 }