]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSCalibrationSSD.h
Fix bug in the macro to create FastRecPoints from Hits
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSSD.h
index a8d0a6841c26d38065a0033378e0732abb402dac..8e156bf5f60e3ff8ee4e772d7d7e13ee04f359ef 100644 (file)
@@ -1,13 +1,18 @@
 #ifndef ALIITSCALIBRATIONSSD_H
 #define ALIITSCALIBRATIONSSD_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */ 
 #include "AliITSCalibration.h"
-#include "AliITSresponseSSD.h"
+#include "AliITSNoiseSSDv2.h"
+#include "AliITSPedestalSSDv2.h"
+#include "AliITSGainSSDv2.h"
+#include "AliITSBadChannelsSSDv2.h"
 #include "TArrayF.h"
 #include "TArrayI.h"
 
+/* $Id$ */
 //////////////////////////////////////////////
-// Response class for SSD                   //
+// Calibration class for SSD                   //
 //                                          //
 //////////////////////////////////////////////
 class AliITSCalibrationSSD : public AliITSCalibration {
@@ -17,51 +22,47 @@ class AliITSCalibrationSSD : public AliITSCalibration {
     AliITSCalibrationSSD(const char *dataType);
     virtual ~AliITSCalibrationSSD();
 
-    virtual  void   SetNoiseParam(Double_t np, Double_t nn) {
-       // set noise par
-       fNoiseP=np; fNoiseN=nn;
-    }
+    Float_t GetNoiseP(Int_t n) {return fNoise->GetNoiseP(fModule,n); }
+    Float_t GetNoiseN(Int_t n) {return fNoise->GetNoiseN(fModule,n); }
+    void SetNoise( AliITSNoiseSSDv2* noise) {fNoise=noise;}
 
-    virtual void    GetNoiseParam(Double_t &np, Double_t &nn) const {
-       // get noise par
-       np=fNoiseP; nn=fNoiseN;
-    }
+    Float_t GetPedestalP(Int_t n) {return fPedestal->GetPedestalP(fModule,n); }
+    Float_t GetPedestalN(Int_t n) {return fPedestal->GetPedestalN(fModule,n); }
+    void SetPedestal( AliITSPedestalSSDv2* pedestal) {fPedestal=pedestal;}
 
-    // EF
-    void SetNNoiseP(Int_t n) { fNoisP.Set(n); }
-    void AddNoiseP(Int_t c, Float_t n) { fNoisP.AddAt(n,c);}       
-    TArrayF GetNoiseP() const {return fNoisP; }
-    Float_t GetNoiseP(Int_t n) {return fNoisP.At(n); }
-    void SetNNoiseN(Int_t n) { fNoisN.Set(n); }
-    void AddNoiseN(Int_t c, Float_t n) { fNoisN.AddAt(n,c);}
-    TArrayF GetNoiseN() const {return fNoisN; }
-    Float_t GetNoiseN(Int_t n) {return fNoisN.At(n); }
-
-    void SetNGainP(Int_t n) { fGainP.Set(n); }
-    void AddGainP(Int_t c, Float_t n) { fGainP.AddAt(n,c);}       
-    TArrayF GetGainP() const {return fGainP; }
-    Float_t GetGainP(Int_t n) {return fGainP.At(n); }
-    void SetNGainN(Int_t n) { fGainN.Set(n); }
-    void AddGainN(Int_t c, Float_t n) { fGainN.AddAt(n,c);}
-    TArrayF GetGainN() const {return fGainN; }
-    Float_t GetGainN(Int_t n) {return fGainN.At(n); }
-
-    void SetNoisePThreshold(Int_t threshold) { fNoisePThreshold = threshold;}
-    void AddNoisyPChannel(Int_t c, Int_t n) { fNoisyPChannelsList.AddAt(n,c);}
-    TArrayI GetNoisyPChannelsList() const {return fNoisyPChannelsList; }
-    void SetNoiseNThreshold(Int_t threshold) { fNoiseNThreshold = threshold;}
-    void AddNoisyNChannel(Int_t c, Int_t n) { fNoisyNChannelsList.AddAt(n,c);}
-    TArrayI GetNoisyNChannelsList() const {return fNoisyNChannelsList; }
-
-    void SetNDeadPChannelsList(Int_t n) { fDeadPChannelsList.Set(n); }
-    void AddDeadPChannel(Int_t c, Int_t n) { fDeadPChannelsList.AddAt(n,c);}
-    TArrayI GetDeadPChannelsList() const {return fDeadPChannelsList; }
-    void SetNDeadNChannelsList(Int_t n) { fDeadNChannelsList.Set(n); }
-    void AddDeadNChannel(Int_t c, Int_t n) { fDeadNChannelsList.AddAt(n,c);}
-    TArrayI GetDeadNChannelsList() const {return fDeadNChannelsList; }
-    //
+    Float_t GetGainP(Int_t n) {return fGain->GetGainP(fModule,n); }
+    Float_t GetGainN(Int_t n) {return fGain->GetGainN(fModule,n); }
+    void SetGainP(Int_t n, Float_t value) {fGain->AddGainP(fModule,n,value);}
+    void SetGainN(Int_t n, Float_t value) {fGain->AddGainN(fModule,n,value);}
+    void SetGain( AliITSGainSSDv2* gain) {fGain=gain;}
 
+    void   SetBad() {
+      fIsBad = kTRUE;
+      for(Int_t i=0;i<fgkChipsPerModule;i++) fIsChipBad[i]=kTRUE;
+    }
+    virtual Bool_t IsBad() const { return fIsBad; }
+    void   SetChipBad(Int_t nChip) {
+      fIsChipBad[nChip] = kTRUE;
+    }
+    void FillBadChipMap();
+    virtual Bool_t IsChipBad(Int_t nChip) const {
+      return fIsChipBad[nChip];
+    }
+    Int_t ChipsPerModule() const{return fgkChipsPerModule;} // # chips/module
+    Int_t ChannelsPerChip() const{ return fgkChannelsPerChip;}// #channels/chip
+
+    void SetBadChannels( AliITSBadChannelsSSDv2* badchannels) {
+      fBadChannels=badchannels;}
+    Char_t GetBadPChannel(Int_t n) {
+      return fBadChannels->GetBadChannelP(fModule,n); }
+    Char_t GetBadNChannel(Int_t n) {
+      return fBadChannels->GetBadChannelN(fModule,n); }
+    Bool_t IsPChannelBad(Int_t n) {
+      return fBadChannels->GetBadChannelP(fModule,n)&1; }
+    Bool_t IsNChannelBad(Int_t n) {
+      return fBadChannels->GetBadChannelN(fModule,n)&1; }
 
+    //
     virtual  void   SetNDetParam(Int_t npar) {
        // set number of param
        fNPar=npar;
@@ -75,72 +76,53 @@ class AliITSCalibrationSSD : public AliITSCalibration {
     }
     virtual void    GetDetParam(Double_t *dpar) const; 
 
-    virtual void    SetSigmaSpread(Double_t p1, Double_t p2) {
-       // Set sigmas of the charge spread function: Pside-Nside
-       // square of (microns)
-       fSigmaP=p1; fSigmaN=p2;
+    virtual void    SetSigmaSpread(Double_t, Double_t) {
+      NotImplemented("SetSigmaSpread");}
+    
+    virtual void    SigmaSpread(Double_t &, Double_t &) const {
+      NotImplemented("SetSigmaSpread");}
+    
+    void SetModule(Int_t mod){fModule = mod;}
+    void SetModuleIndex(Int_t modId){
+      fModule=modId-500; // temporary patch, 500 is n. of SPD+SDD modules
+      FillBadChipMap();
     }
+    void SetKeVperADC(Double_t a=86.4/120.){fKeVperADC = a;}
+    Double_t ADCToKeV(Double_t adc) const {return adc*fKeVperADC;}
 
-    virtual void    SigmaSpread(Double_t &sP, Double_t &sN) const {
-      // Get sigmas for the charge spread 
-      sP=fSigmaP; sN=fSigmaN;
-    }
+    void SetSSDADCpereV(Double_t a=120./24888.9){fSSDADCpereV = a;}
+    Double_t GetSSDDEvToADC(Double_t eV) const {return eV*fSSDADCpereV;}
+    Int_t GetSSDIEvToADC(Double_t eV) const { 
+                                  return ((Int_t) GetSSDDEvToADC(eV)); }
+
+
+ protected:
+
+    static const Int_t fgkChipsPerModule  = 12;    // Number of chips/module
+    static const Int_t fgkChannelsPerChip = 128;   // Number of channels/chip
 
-    virtual void   SetThresholds(Double_t /* a */, Double_t /* b */)
-      {NotImplemented("SetThresholds");}
-    virtual void   Thresholds(Double_t & /* a */, Double_t & /* b */) const 
-      {NotImplemented("Thresholds");}
-  
-    virtual void SetParamOptions(const char *opt1, const char *opt2) {((AliITSresponseSSD*)fResponse)->SetParamOptions(opt1,opt2);}
-    virtual void GetParamOptions(char *opt1,char *opt2) const {((AliITSresponseSSD*)fResponse)->ParamOptions(opt1,opt2);}
-    virtual void SetADCpereV(Double_t a=200./30000.0) {((AliITSresponseSSD*)fResponse)->SetADCpereV(a);}
-    virtual Double_t GetDEvToADC(Double_t eV) const {return ((AliITSresponseSSD*)fResponse)->DEvToADC(eV);}
-    virtual Int_t IEvToADC(Double_t eV) const {return ((AliITSresponseSSD*)fResponse)->IEvToADC(eV);} 
-
-  virtual Double_t GetCouplingPR() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingPR();}
-  virtual Double_t GetCouplingPL() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingPL();}
-  virtual Double_t GetCouplingNR() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingNR();}
-  virtual Double_t GetCouplingNL() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingNL();}
-  virtual void SetCouplings(Double_t pr, Double_t pl, Double_t nr, Double_t nl) 
-    { ((AliITSresponseSSD*)fResponse)->SetCouplings(pr,pl,nr,nl);}
-
-  virtual Int_t GetZSThreshold() const {return ((AliITSresponseSSD*)fResponse)->GetZSThreshold();}
-  virtual void SetZSThreshold(Int_t zsth) 
-    { ((AliITSresponseSSD*)fResponse)->SetZSThreshold(zsth);}
-
-protected:
-    static const Double_t fgkNoiseNDefault; // default for fNoiseN
-    static const Double_t fgkNoisePDefault; // default for fNoiseP
     static const Int_t fgkNParDefault; // default for fNPar
-    static const Double_t fgkSigmaPDefault; //default for fSigmaP
-    static const Double_t fgkSigmaNDefault; //default for fSigmaP
 
+    Int_t fModule;          //! module number (range 0 -> 1697)
+    
     Int_t   fNPar;            // Number of detector param 
     Double_t *fDetPar;         //[fNPar] Array of parameters
 
-    Double_t fNoiseP;          // Noise on Pside
-    Double_t fNoiseN;          // Noise on Nside
-    Double_t fSigmaP;          // Sigma charge spread on Pside
-    Double_t fSigmaN;          // Sigma charge spread on Nside
-    
-    TArrayF fGainP;           // Gain for P side channels
-    TArrayF fGainN;           // Gain for N side channels
-
-    TArrayF fNoisP;           // Noise for P side channels
-    TArrayF fNoisN;           // Noise for N side channels
+    AliITSNoiseSSDv2 *fNoise;
+    AliITSPedestalSSDv2 *fPedestal;
+    AliITSGainSSDv2 *fGain;
+    AliITSBadChannelsSSDv2 *fBadChannels;
 
-    Float_t fNoisePThreshold;     // need to decide if channel is noisy  
-    TArrayI  fNoisyPChannelsList; // list of P side noisy channels
-    Float_t fNoiseNThreshold;     // need to decide if channel is noisy  
-    TArrayI  fNoisyNChannelsList; // list of N side noisy channels
+    Bool_t   fIsBad;                         // module is dead or alive ?
+    Bool_t   fIsChipBad[fgkChipsPerModule];  // chip is dead or alive ?
 
-    TArrayI  fDeadNChannelsList;  // list of P side dead channels
-    TArrayI  fDeadPChannelsList;  // list of N side dead channels
+    Double_t fSSDADCpereV;    // Constant to convert eV to ADC for SSD.
+    Double_t fKeVperADC;       // Constant to convert ADC to keV
 
  private:
     AliITSCalibrationSSD(const AliITSCalibrationSSD &source); // copy constructor
     AliITSCalibrationSSD& operator=(const AliITSCalibrationSSD &source); // ass. op.
 
-    ClassDef(AliITSCalibrationSSD,1) //Response class for SSD
-};
+    ClassDef(AliITSCalibrationSSD,5) //Response class for SSD
+      };
 #endif