]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSresponseSDD.cxx
Coding conventions
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.cxx
index 3c1c2a3ea2c0720997527bf42f02f9cdfe2f0163..b56e192259748cee1f171ab51ff07f5bdf850800 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.                  *
  **************************************************************************/
 
+/* $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 "AliITSgeom.h"
 #include "AliITSresponseSDD.h"
-#include "AliITS.h"
-#include "AliRun.h"
+#include <AliITSgeomTGeo.h>
 
-class AliITS;
+const Float_t AliITSresponseSDD::fgkTimeOffsetDefault = 54.30;
+const Float_t AliITSresponseSDD::fgkADC2keVDefault = 3.34;
+const Float_t AliITSresponseSDD::fgkChargevsTimeDefault = 0.00355;
+const Float_t AliITSresponseSDD::fgkADCvsDrTimeDefault = 0.0101;
+const Float_t AliITSresponseSDD::fgkCarlosRXClockPeriod = 25.;
+ClassImp(AliITSresponseSDD)
 
-//___________________________________________
-ClassImp(AliITSresponseSDD)    
-
-AliITSresponseSDD::AliITSresponseSDD()
+//_________________________________________________________________________
+AliITSresponseSDD::AliITSresponseSDD():
+TObject(),
+  fTimeOffset(fgkTimeOffsetDefault),
+  fADC2keV(fgkADC2keVDefault),
+  fChargevsTime(fgkChargevsTimeDefault)
 {
-  // constructor
-   SetMaxAdc();
-   SetDiffCoeff();
-   SetQref();
-   SetDriftSpeed();
-   // SetClock();
-   SetNoiseParam();
-   SetMagicValue();
-   SetMinVal();
-   SetParamOptions();
-   SetZeroSupp();
-   SetDataType();
-   SetFilenames();
-   SetOutputOption();
-
+  // default constructor
+  for(Int_t i=0; i<kNSDDmods;i++){
+    fTimeZero[i]=fgkTimeOffsetDefault;
+    fDeltaVDrift[i] = fDeltaVDrift[i+kNSDDmods] = 0.;
+    fADCtokeV[i]=fgkADC2keVDefault;
+    fADCvsDriftTime[i]=fgkADCvsDrTimeDefault;
+  }  
+  SetVDCorr2Side(kTRUE); // default for new objects will be separate corrections for 2 sides (bwd compatible)
+  //  SetVDCorrMult(kTRUE); // default for new objects will have multiplicative correction v'=(1+corr)*v (bwd compatible)
 }
-
-//__________________________________________________________________________
-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;
+//_________________________________________________________________________
+void AliITSresponseSDD::SetHalfLadderATimeZero(Int_t lay, Int_t lad, Float_t tzero){
+  // Sets time Zero for all modules of a ladder on side A (Z>0)
+  Int_t minMod,maxMod;
+  if(lay==3){
+    minMod=1; 
+    maxMod=3;
+    if(lad>kNLaddersLay3){
+      AliError(Form("Ladder number %d out of range",lad));
+      return;
+    }
+  }else if(lay==4){
+    minMod=1; 
+    maxMod=4;
+    if(lad>kNLaddersLay4){
+      AliError(Form("Ladder number %d out of range",lad));
+      return;
+    }
+  }else{
+    AliError(Form("Layer number %d out of range",lay));
+    return;
+  }
+  for(Int_t iMod=minMod; iMod<=maxMod; iMod++){
+    Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(lay,lad,iMod);
+    SetModuleTimeZero(modIndex,tzero);
+  }
 }
-
 //_________________________________________________________________________
-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;
-  return *this;
+void AliITSresponseSDD::SetHalfLadderCTimeZero(Int_t lay, Int_t lad, Float_t tzero){
+  // Sets time Zero for all modules of a ladder on side C (Z<0)
+  Int_t minMod,maxMod;
+  if(lay==3){
+    minMod=4; 
+    maxMod=6;
+    if(lad>kNLaddersLay3){
+      AliError(Form("Ladder number %d out of range",lad));
+      return;
+    }
+  }else if(lay==4){
+    minMod=5; 
+    maxMod=8;
+    if(lad>kNLaddersLay4){
+      AliError(Form("Ladder number %d out of range",lad));
+      return;
+    }
+  }else{
+    AliError(Form("Layer number %d out of range",lay));
+    return;
+  }
+  for(Int_t iMod=minMod; iMod<=maxMod; iMod++){
+    Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(lay,lad,iMod);
+    SetModuleTimeZero(modIndex,tzero);
+  }
 }
+//_________________________________________________________________________
+void AliITSresponseSDD::PrintChargeCalibrationParams() const{
+  // Dump charge calibration parameters
 
-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]);
-       
+  printf("ADC vs. drift time corr=%f\n",GetChargevsTime());
+  printf("-------------------------------------\n");
+  printf("Layer 3\n");
+  for(Int_t ilad=1; ilad<=14; ilad++){
+    for(Int_t idet=1; idet<=6;idet++){
+      Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(3,ilad,idet);
+      Float_t tz=GetADCtokeV(modIndex);
+      printf("%7.2f   ",tz);
+    }
+    printf("\n");
+  }
+  printf("\n");
+  printf("Layer 4\n");
+  for(Int_t ilad=1; ilad<=22; ilad++){
+    for(Int_t idet=1; idet<=8;idet++){
+      Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(4,ilad,idet);
+      Float_t tz=GetADCtokeV(modIndex);
+      printf("%7.2f   ",tz);
     }
+    printf("\n");
+  }  
 }
-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::PrintTimeZeroes() const{
+  // Dump time zero values
+
+  printf("Layer 3\n");
+  for(Int_t ilad=1; ilad<=14; ilad++){
+    for(Int_t idet=1; idet<=6;idet++){
+      Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(3,ilad,idet);
+      Float_t tz=GetTimeZero(modIndex);
+      printf("%7.2f   ",tz);
+    }
+    printf("\n");
+  }
+  printf("\n");
+  printf("Layer 4\n");
+  for(Int_t ilad=1; ilad<=22; ilad++){
+    for(Int_t idet=1; idet<=8;idet++){
+      Int_t modIndex=AliITSgeomTGeo::GetModuleIndex(4,ilad,idet);
+      Float_t tz=GetTimeZero(modIndex);
+      printf("%7.2f   ",tz);
     }
+    printf("\n");
+  }
+  
 }
-//______________________________________________________________________________
-void AliITSresponseSDD::Streamer(TBuffer &R__b)
-{
-   // Stream an object of class AliITSresponseSDD.
+//_________________________________________________________________________
+void AliITSresponseSDD::PrintVdriftCorerctions() const{
+  // Dump corrections to vdrift
 
-   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);
-   }
+  for(Int_t iMod=240; iMod<500; iMod++){
+    printf("Module %d   dVleft=%f   dVright=%f\n",iMod,GetDeltaVDrift(iMod,0),GetDeltaVDrift(iMod,1));
+  }
 }