]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSMapSDD.h
Fixing segfault
[u/mrichter/AliRoot.git] / ITS / AliITSMapSDD.h
index b8b31c14dc8f724b51e54344160a29e4a074ba51..5d12b51fe8883ca99c0f2909b348c247286cac06 100644 (file)
@@ -7,13 +7,14 @@
 
 ///////////////////////////////////////////////////////////////////
 //                                                               //
-// Mother class for SDD maps used to correct for                 //
+// Class for SDD maps used to correct for                        //
 // voltage divider shape and doping fluctuations                 //
 // Origin: F.Prino, Torino, prino@to.infn.it                     //
 //                                                               //
 ///////////////////////////////////////////////////////////////////
 
 #include "AliITSsegmentationSDD.h"
+#include "AliITSCorrMapSDD.h"
 #include<TNamed.h>
 #include "AliLog.h"
 class TH1F;
@@ -26,58 +27,38 @@ class AliITSMapSDD : public TNamed {
   AliITSMapSDD(Char_t *mapname);
   virtual ~AliITSMapSDD(){};
 
-  Int_t GetNBinsAnode() const {return fNAnodePts;}
-  Int_t GetNBinsDrift() const {return fNDriftPts;}
-  void SetNBinsAnode(Int_t nbins) {
-    if(nbins<=kMaxNAnodePts) fNAnodePts=nbins;
-    else AliError(Form("Max. number of anode bins = %d",kMaxNAnodePts));
-  }
-  void SetNBinsDrift(Int_t nbins) {
-    if(nbins<=kMaxNDriftPts) fNDriftPts=nbins;
-    else AliError(Form("Max. number of drift bins = %d",kMaxNDriftPts));
-  }
-
-  Bool_t CheckAnodeBounds(Int_t iAn) const {
-    if(iAn<0 || iAn>=fNAnodePts){
-      AliWarning(Form("Cell out of bounds, anode=%d",iAn));
+  void SetMap(TH2F* hmap);
+  Bool_t CheckBounds(Int_t iAn, Int_t iTb) const {
+    if(iAn<0 || iAn>=fgkNAnodPts || iTb<0 || iTb >= fgkNDrifPts){ 
+      AliWarning(Form("Cell out of bounds, anode=%d time-bin=%d",iAn,iTb));
       return kFALSE;
     }
     return kTRUE;
   }
-  Bool_t CheckDriftBounds(Int_t iTb) const {
-    if(iTb<0 || iTb >= fNDriftPts){ 
-      AliWarning(Form("Cell out of bounds, time-bin=%d",iTb));
-      return kFALSE;
-    }
-    return kTRUE;
+  void SetCellContent(Int_t iAn, Int_t iTb, Float_t devMicron){
+    if(CheckBounds(iAn,iTb)) fMap[iAn][iTb]=(Short_t)(devMicron*10.+0.5);
   }
 
-  virtual void Set1DMap(TH1F* /*hmap*/){
-    AliError("Not implemented");
-  }
-  virtual void Set2DMap(TH2F* /*hmap*/){
-    AliError("Not implemented");
+  Float_t GetCellContent(Int_t iAn, Int_t iTb) const {
+    if(CheckBounds(iAn,iTb)) return (Float_t)fMap[iAn][iTb]/10.;
+    else return 0.;
   }
-
-  virtual void ResetMap() = 0;
-  virtual void SetCellContent(Int_t iAn, Int_t iTb, Float_t devMicron) = 0;
-  virtual Float_t GetCellContent(Int_t iAn, Int_t iTb) const = 0;
-
   Float_t GetCorrection(Float_t z, Float_t x, AliITSsegmentationSDD *seg);
+  static Int_t GetNBinsAnode() {return fgkNAnodPts;}
+  static Int_t GetNBinsDrift() {return fgkNDrifPts;}
+  AliITSCorrMapSDD* ConvertToNewFormat() const;
+
   TH2F* GetMapHisto() const;
   TH1F* GetResidualDistr(Float_t dmin=-300., Float_t dmax=300.) const;
 
-
  protected:
-  enum {kMaxNAnodePts=256};// max number of map points along anodes
-  enum {kMaxNDriftPts=291};// max number of map points along drift
-
-  static const Int_t fgkNAnodePtsDefault; // default value for fNAnodePts
-  static const Int_t fgkNDriftPtsDefault; // default value for fNDriftPts
-
-  Int_t fNAnodePts; // number of map points along anodes
-  Int_t fNDriftPts; // number of map points along anodes
+  static const Int_t fgkNAnodPts = 256; // number of map points along anodes
+  static const Int_t fgkNDrifPts = 72; // number of map points along anodes
+  Short_t fMap[fgkNAnodPts][fgkNDrifPts];   // map of deviations
+                                            // stored as Short_t: integer 
+                                            // values from -32000 to 32000
+                                            // in the range -3.2 - 3.2 mm
 
-  ClassDef(AliITSMapSDD,3);
+  ClassDef(AliITSMapSDD,2);
 };
 #endif