#ifndef ALIITSRESPONSESDD_H
#define ALIITSRESPONSESDD_H
+
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
-#include "TArrayF.h"
-#include <TString.h>
-#include <iostream.h>
-#include "AliITSresponse.h"
+#include <TObject.h>
+#include <AliLog.h>
-// response for SDD
+/* $Id$ */
-class AliITSresponseSDD :
- public AliITSresponse {
-public:
- //
- // Configuration methods
+/////////////////////////////////////////////////////////////
+// Base settings for the ITS response classes. //
+// The data member of this class are static and set once //
+// for all the modules. //
+/////////////////////////////////////////////////////////////
+
+class AliITSresponseSDD : public TObject {
+ public:
+ enum {kVDCorr2Side = BIT(14),kVDCorrMult = BIT(15)}; // if bit set, the object contains separate corrections for 2 sides
//
-
AliITSresponseSDD();
- AliITSresponseSDD(const char *dataType);
-
- virtual ~AliITSresponseSDD();
+ virtual ~AliITSresponseSDD(){};
- void SetElectronics(Int_t p1=1) {
- // Electronics: Pascal (1) or OLA (2)
- fElectronics=p1;
- }
-
- Int_t Electronics() {
- // Electronics: 1 = Pascal; 2 = OLA
- return fElectronics;
- }
-
- void SetMaxAdc(Float_t p1=1024.) {
- // Adc-count saturation value
- fMaxAdc=p1;
- }
- Float_t MaxAdc() {
- // Get maximum Adc-count value
- return fMaxAdc;
- }
-
- void SetChargeLoss(Float_t p1=0.0) {
- // Set Linear Charge Loss Steepness // 0.01 for 20%
- fChargeLoss=p1;
- }
- Float_t ChargeLoss() {
- // Get Charge Loss Coefficient
- return fChargeLoss;
- }
-
- void SetDynamicRange(Float_t p1=132.) {
- // Set Dynamic Range
- fDynamicRange=p1;
+ virtual void SetSideATimeZero(Float_t tzero){
+ SetLayer3ATimeZero(tzero);
+ SetLayer4ATimeZero(tzero);
}
- Float_t DynamicRange() {
- // Get Dynamic Range
- return fDynamicRange;
- }
-
- void SetDiffCoeff(Float_t p1=3.23,Float_t p2=30.) {
- // Diffusion coefficients
- fDiffCoeff=p1;
- fDiffCoeff1=p2;
+ virtual void SetSideCTimeZero(Float_t tzero){
+ SetLayer3CTimeZero(tzero);
+ SetLayer4CTimeZero(tzero);
}
- void DiffCoeff(Float_t&diff,Float_t&diff1) {
- // Get diffusion coefficients
- diff = fDiffCoeff;
- diff1 = fDiffCoeff1;
- }
-
- void SetDriftSpeed(Float_t p1=7.3) {
- // Drift velocity
- fDriftSpeed=p1;
+ virtual void SetLayer3ATimeZero(Float_t tzero){
+ for(Int_t iLad=1; iLad<=kNLaddersLay3; iLad++) SetHalfLadderATimeZero(3,iLad,tzero);
}
- Float_t DriftSpeed() {
- // drift speed
- return fDriftSpeed;
- }
-
- void SetTemperature(Float_t p1=23.) {
- // Temperature
- fTemperature=p1;
+ virtual void SetLayer3CTimeZero(Float_t tzero){
+ for(Int_t iLad=1; iLad<=kNLaddersLay3; iLad++) SetHalfLadderCTimeZero(3,iLad,tzero);
}
- Float_t Temperature() {
- // Get temperature
- return fTemperature;
- }
-
- void SetDataType(const char *data="simulated") {
- // Type of data - real or simulated
- fDataType=data;
+ virtual void SetLayer4ATimeZero(Float_t tzero){
+ for(Int_t iLad=1; iLad<=kNLaddersLay4; iLad++) SetHalfLadderATimeZero(4,iLad,tzero);
}
- const char *DataType() const {
- // Get data type
- return fDataType.Data();
- }
-
- void SetParamOptions(const char *opt1="same",const char *opt2="same"){
- // Parameters: "same" or read from "file"
- fParam1=opt1; fParam2=opt2;
+ virtual void SetLayer4CTimeZero(Float_t tzero){
+ for(Int_t iLad=1; iLad<=kNLaddersLay4; iLad++) SetHalfLadderCTimeZero(4,iLad,tzero);
}
- void ParamOptions(char *opt1,char *opt2) {
- // options
- strcpy(opt1,fParam1.Data()); strcpy(opt2,fParam2.Data());
+ virtual void SetHalfLadderATimeZero(Int_t lay, Int_t lad, Float_t tzero);
+ virtual void SetHalfLadderCTimeZero(Int_t lay, Int_t lad, Float_t tzero);
+ virtual void SetModuleTimeZero(Int_t modIndex, Float_t tzero){
+ if(CheckModuleIndex(modIndex)) fTimeZero[modIndex-kNSPDmods]=tzero;
}
-
- void SetNoiseParam(Float_t n=0., Float_t b=20.){
- // Noise and baseline // 8.3 for ALICE with beam test measurements
- fNoise=n; fBaseline=b;
- }
- void SetNoiseAfterElectronics(Float_t n=0.){
- // Noise after electronics (ADC units) // 1.6 for ALICE from beam test measurements
- fNoiseAfterEl=n;
- }
- void GetNoiseParam(Float_t &n, Float_t &b) {
- // get noise param
- n=fNoise; b=fBaseline;
- }
- Float_t GetNoiseAfterElectronics(){
- // Noise after electronics (ADC units)
- return fNoiseAfterEl;
- }
- void SetDo10to8(Bool_t bitcomp=kTRUE) {
- // set the option for 10 to 8 bit compression
- fBitComp = bitcomp;
+ virtual void SetDeltaVDrift(Int_t modIndex, Float_t dv, Bool_t rightSide=kFALSE) {
+ int ind = GetVDIndex(modIndex,rightSide);
+ if (ind>=0) fDeltaVDrift[ind] = dv;
}
- Bool_t Do10to8() {
- // get 10 to 8 compression option
- return fBitComp;
- }
-
- void SetZeroSupp (const char *opt="1D") {
- // Zero-suppression option - could be 1D, 2D or non-ZS
- fOption=opt;
- }
- const char *ZeroSuppOption() const {
- // Get zero-suppression option
- return fOption.Data();
- }
- void SetMinVal(Int_t mv=4) {
- // Min value used in 2D - could be used as a threshold setting
- fMinVal = mv;
- }
- Int_t MinVal() {
- // min val
- return fMinVal;
- }
-
- void SetFilenames(const char *f1="",const char *f2="",const char *f3="") {
- // Set filenames - input, output, parameters ....
- fFileName1=f1; fFileName2=f2; fFileName3=f3;
- }
- void Filenames(char *input,char *baseline,char *param) {
- // Filenames
- strcpy(input,fFileName1.Data()); strcpy(baseline,fFileName2.Data());
- strcpy(param,fFileName3.Data());
- }
-
-
- void SetOutputOption(Bool_t write=kFALSE) {
- // set output option
- fWrite = write;
- }
- Bool_t OutputOption() {
- // output option
- return fWrite;
+ virtual Float_t GetDeltaVDrift(Int_t modIndex,Bool_t rightSide=kFALSE) const {
+ int ind = GetVDIndex(modIndex,rightSide);
+ return ind<0 ? 0.:fDeltaVDrift[ind];
}
//
- // Compression parameters
- void SetCompressParam(Int_t cp[8]);
- void GiveCompressParam(Int_t *x);
-
- //
- // Detector type response methods
- void SetNSigmaIntegration(Float_t p1=3.) {
- // Set number of sigmas over which cluster disintegration is performed
- fNsigmas=p1;
- }
- Float_t NSigmaIntegration() {
- // Get number of sigmas over which cluster disintegration is performed
- return fNsigmas;
+ Bool_t IsVDCorr2Side() const {return TestBit(kVDCorr2Side);}
+ Bool_t IsVDCorrMult() const {return TestBit(kVDCorrMult);}
+ void SetVDCorr2Side(Bool_t v=kTRUE) {SetBit(kVDCorr2Side,v);}
+ void SetVDCorrMult(Bool_t v=kTRUE) {SetBit(kVDCorrMult,v);}
+ //
+ static Float_t DefaultTimeOffset() {return fgkTimeOffsetDefault;}
+ virtual void SetTimeOffset(Float_t to){fTimeOffset = to;}
+ virtual Float_t GetTimeOffset()const {return fTimeOffset;}
+ virtual Float_t GetTimeZero(Int_t modIndex) const {
+ if(CheckModuleIndex(modIndex)) return fTimeZero[modIndex-kNSPDmods];
+ else return 0.;
}
- void SetNLookUp(Int_t p1=121) {
- // 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++) {
- Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
- (*fGaus)[i] = exp(-((x*x)/2));
- // cout << "fGaus[" << i << "]: " << fGaus->At(i) << endl;
- }
+
+ virtual void SetADC2keV(Float_t conv){fADC2keV=conv;}
+ virtual Float_t GetADC2keV()const {return fADC2keV;}
+ virtual void SetADCtokeV(Int_t modIndex, Float_t conv){
+ if(CheckModuleIndex(modIndex)) fADCtokeV[modIndex-kNSPDmods]=conv;
}
- // Get number of intervals in which the gaussian lookup table is divided
- Int_t GausNLookUp() {return fNcomps;}
-
- Float_t IntPH(Float_t eloss) {
- // Pulse height from scored quantity (eloss)
- return 0.;
+ virtual Float_t GetADCtokeV(Int_t modIndex) const {
+ if(CheckModuleIndex(modIndex)) return fADCtokeV[modIndex-kNSPDmods];
+ else return 0.;
}
- Float_t IntXZ(AliITSsegmentation *) {
- // Charge disintegration
- return 0.;
+
+ virtual void SetChargevsTime(Float_t slope){fChargevsTime=slope;}
+ virtual Float_t GetChargevsTime()const {return fChargevsTime;}
+
+ virtual void SetADCvsDriftTime(Int_t modIndex, Float_t slope){
+ if(CheckModuleIndex(modIndex)) fADCvsDriftTime[modIndex-kNSPDmods]=slope;
}
- Float_t GausLookUp(Int_t i) {
- if(i<0 || i>=fNcomps) return 0.;
- return fGaus->At(i);
+ virtual Float_t GetADCvsDriftTime(Int_t modIndex) const {
+ if(CheckModuleIndex(modIndex)) return fADCvsDriftTime[modIndex-kNSPDmods];
+ else return 0.;
}
- void SetDeadChannels(Int_t nmodules=0, Int_t nchips=0, Int_t nchannels=0);
- Int_t GetDeadModules() { return fDeadModules; }
- Int_t GetDeadChips() { return fDeadChips; }
- Int_t GetDeadChannels() { return fDeadChannels; }
- Float_t Gain( Int_t mod, Int_t chip, Int_t ch)
- { return fGain[mod][chip][ch]; }
+ static Float_t DefaultADC2keV() {return fgkADC2keVDefault;}
+ static Float_t DefaultChargevsTime() {return fgkChargevsTimeDefault;}
+ static Float_t DefaultADCvsDriftTime() {return fgkADCvsDrTimeDefault;}
- // these functions should be move to AliITSsegmentationSDD
- const Int_t Modules() const { return fModules; } // Total number of SDD modules
- const Int_t Chips() const { return fChips; } // Number of chips/module
- const Int_t Channels() const { return fChannels; } // Number of channels/chip
- //********
-
- void PrintGains();
- void Print();
+ static Float_t GetCarlosRXClockPeriod() {return fgkCarlosRXClockPeriod;}
+ void PrintChargeCalibrationParams() const;
+ void PrintTimeZeroes() const;
+ void PrintVdriftCorerctions() const;
-private:
+ protected:
+ //
+ virtual Int_t GetVDIndex(Int_t modIndex, Bool_t rightSide=kFALSE) const {
+ int ind = modIndex - kNSPDmods;
+ if(ind<0 || ind>=kNSDDmods) {AliError(Form("SDD module number %d out of range",modIndex)); return -1;}
+ return (rightSide && IsVDCorr2Side()) ? ind + kNSDDmods : ind;
+ }
- AliITSresponseSDD(const AliITSresponseSDD &source); // copy constructor
- AliITSresponseSDD& operator=(const AliITSresponseSDD &source); // ass. op.
-
-protected:
- // these statis const should be move to AliITSsegmentationSDD
- static const Int_t fModules = 520; // Total number of SDD modules
- static const Int_t fChips = 4; // Number of chips/module
- static const Int_t fChannels = 64; // Number of channels/chip
- //*******
-
- Int_t fDeadModules; // Total number of dead SDD modules
- Int_t fDeadChips; // Number of dead chips
- Int_t fDeadChannels; // Number of dead channels
- Float_t fGain[fModules][fChips][fChannels]; // Array for channel gains
+ virtual Bool_t CheckModuleIndex(Int_t modIndex) const {
+ if(modIndex<kNSPDmods || modIndex>=kNSPDmods+kNSDDmods){ AliError(Form("SDD module number %d out of range",modIndex)); return kFALSE;}
+ return kTRUE;
+ }
- Int_t fCPar[8]; // Hardware compression parameters
- Float_t fNoise; // Noise
- Float_t fBaseline; // Baseline
- Float_t fNoiseAfterEl; // Noise after electronics
- Float_t fDynamicRange; // Set Dynamic Range
- Float_t fChargeLoss; // Set Linear Coefficient for Charge Loss
- Float_t fTemperature; // Temperature
- Float_t fDriftSpeed; // Drift velocity
- Int_t fElectronics; // Electronics
-
- Float_t fMaxAdc; // Adc saturation value
- Float_t fDiffCoeff; // Diffusion Coefficient (scaling the time)
- Float_t fDiffCoeff1; // Diffusion Coefficient (constant term)
- Float_t fNsigmas; // Number of sigmas over which charge disintegration
- // is performed
- TArrayF *fGaus; // Gaussian lookup table for signal generation
- Int_t fNcomps; // Number of samplings along the gaussian
-
- Int_t fMinVal; // Min value used in 2D zero-suppression algo
-
- Bool_t fWrite; // Write option for the compression algorithms
- Bool_t fBitComp; // 10 to 8 bit compression option
+ protected:
- TString fOption; // Zero-suppresion option (1D, 2D or none)
- TString fParam1; // Read baselines from file option
- TString fParam2; // Read compression algo thresholds from file
-
- TString fDataType; // data type - real or simulated
- TString fFileName1; // input keys : run, module #
- TString fFileName2; // baseline & noise val or output coded // signal or monitored bgr.
- TString fFileName3; // param values or output coded signal
-
- ClassDef(AliITSresponseSDD,2) // SDD response
-
- };
-#endif
+ enum {kNSPDmods = 240};
+ enum {kNSDDmods = 260};
+ enum {kNLaddersLay3 = 14};
+ enum {kNLaddersLay4 = 22};
+ static const Float_t fgkTimeOffsetDefault; // default for fTimeOffset
+ static const Float_t fgkADC2keVDefault; // default for fADC2keV
+ static const Float_t fgkChargevsTimeDefault; // default for fChargevsTime
+ static const Float_t fgkADCvsDrTimeDefault; // default for fADCvsDriftTime
+ static const Float_t fgkCarlosRXClockPeriod; // clock period for CarlosRX
+ Float_t fTimeOffset; // Time offset due to electronic delays
+ // --> obsolete, kept for backw. comp.
+ Float_t fTimeZero[kNSDDmods]; // Time Zero for each module
+ Float_t fDeltaVDrift[2*kNSDDmods]; // Vdrift correction (um/ns) for each module left (<kNSDDmods) and right (>=kNSDDmods) sides
+ Float_t fADC2keV; // Conversion factor from ADC to keV
+ // --> obsolete, kept for backw. comp.
+ Float_t fChargevsTime; // --> obsolete, kept for backw. comp.
+ Float_t fADCvsDriftTime[kNSDDmods]; // Correction for zero suppression effect
+ Float_t fADCtokeV[kNSDDmods]; // ADC to keV conversion for each module
+ private:
+ AliITSresponseSDD(const AliITSresponseSDD &ob); // copy constructor
+ AliITSresponseSDD& operator=(const AliITSresponseSDD & /* source */); // ass. op.
+ ClassDef(AliITSresponseSDD,21)
+
+ };
+#endif