]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSPlaneEffSPD.h
AliITSRecoParam retrieved from the OCDB
[u/mrichter/AliRoot.git] / ITS / AliITSPlaneEffSPD.h
1 #ifndef ALIITSPLANEEFFSPD_H
2 #define ALIITSPLANEEFFSPD_H
3 /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 #include <TH1F.h>
7 #include <TH2I.h>
8 #include "AliITSPlaneEff.h"
9 #include  "AliCDBId.h"
10
11 ///////////////////////////////////////////
12 //                                       //
13 // ITS Plane Efficiency class            //
14 //       for SPD                         //
15 // Origin: Giuseppe.Bruno@ba.infn.it     //
16 ///////////////////////////////////////////
17
18 /* $Id:$ */
19   
20 class AliITSPlaneEffSPD :  public AliITSPlaneEff {
21  public:
22     AliITSPlaneEffSPD(); // default constructor
23     virtual ~AliITSPlaneEffSPD(); // destructror
24     // copy constructor
25     AliITSPlaneEffSPD(const AliITSPlaneEffSPD &source);
26     // ass. operator
27     AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s);
28     // Simple way to add another class (i.e. statistics). 
29     AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
30     // Getters for average Plane efficiency (including dead/noisy)
31     Double_t PlaneEff(const UInt_t mod, const UInt_t chip) const;
32     Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip) const;
33     Double_t PlaneEff(const UInt_t key) const 
34         {return PlaneEff(GetModFromKey(key),GetChipFromKey(key));};
35     Double_t ErrPlaneEff(const UInt_t key) const 
36         {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key));};
37     // Getters for fFound[] and fTried[]
38     Int_t GetFound(const UInt_t key) const; 
39     Int_t GetTried(const UInt_t key) const; 
40     // Methods to update the Plane efficiency (specific of the SPD segmentation) 
41     Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod, const UInt_t chip);
42     Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
43         {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));};
44     //
45     enum {kNModule = 240}; // The number of modules
46     enum {kNChip = 5};     // The number of chips per module
47     enum {kNCol = 32};     // The number of columns per chip
48     enum {kNRow = 256};    // The number of rows per chip (and per module)
49
50     virtual Double_t LivePlaneEff(UInt_t key) const;
51     Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip) const
52        {return LivePlaneEff(GetKey(mod,chip));};
53     virtual Double_t ErrLivePlaneEff(UInt_t key) const;
54     Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip) const
55        {return ErrLivePlaneEff(GetKey(mod,chip));};
56     // Compute the fraction of Live area (of the CHIP for the SPD)
57     virtual Double_t GetFracLive(const UInt_t key) const;
58     // Compute the fraction of bad (i.e. dead and noisy) area (of the CHIP for the SPD)
59     virtual Double_t GetFracBad(const UInt_t key) const;
60     virtual Bool_t WriteIntoCDB() const;
61     virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
62     Bool_t AddFromCDB(AliCDBId *cdbId);   // this method updates Data Members (statistics) from DataBase
63     virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return  AddFromCDB(cdbId);}
64    // method to locate a basic block from Detector Local coordinate (to be used in tracking)
65    // see file cxx for numbering convention.
66    // here idet runs from 0 to 79 for layer 0 and from 0 to 159 for layer 1
67     UInt_t GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic
68                                                               // block of the SPD
69     UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t, Float_t locz) const;
70     UInt_t Nblock() const; // return the number of basic blocks
71     // compute the geometrical limit of a basic block (chip) in detector local coordinate system 
72     Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const;
73   // Methods for dealing with auxiliary histograms
74     // method to set on/off the creation/updates of histograms (Histos are created/destroyed)
75     virtual void   SetCreateHistos(Bool_t his=kFALSE) 
76          //{fHis=his; if(fHis) InitHistos(); else DeleteHistos(); return; }
77          {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
78     //Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]);
79     virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype);
80     virtual Bool_t WriteHistosToFile(TString filename="PlaneEffSPDHistos.root",Option_t* option = "RECREATE");
81     virtual Bool_t ReadHistosFromFile(TString filename="PlaneEffSPDHistos.root"); // histos must exist already !
82                                                                                   // This method increases the
83                                                                                   // statistics of histos by adding 
84                                                                                   // those of the input file. 
85  protected:
86     virtual void Copy(TObject &obj) const;           // copy ALL data members to obj 
87                                                      // both statistics ad histograms)
88     Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const;
89     UInt_t GetModFromKey(const UInt_t key) const;
90     UInt_t GetChipFromKey(const UInt_t key) const;
91     UInt_t GetChipFromCol(const UInt_t col) const;  // get the chip number (from 0 to kNChip)
92     UInt_t GetColFromLocZ(Float_t zloc) const;      // get the Column from the local z
93     Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number,
94                                                     // the latter in the range [0,kNChip*kNCol]
95     Float_t GetLocXFromRow(const UInt_t row) const; // get the local X from the row number
96                                                     // the latter in the range [0,kNRow]
97     void GetModAndChipFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip) const;
98     void GetDeadAndNoisyInChip(const UInt_t key, UInt_t& dead, UInt_t& noisy) const;
99 // 
100     Int_t fFound[kNModule*kNChip];  // number of associated clusters in a given chip
101     Int_t fTried[kNModule*kNChip];  // number of tracks used for chip efficiency evaluation
102
103  private:
104     enum {kNHisto = kNModule}; // The number of histograms: module by module.
105     enum {kNclu = 3};          // Build specific histos of residuals up to cluster size kNclu.
106                                // If you change them, then you must change implementation of
107                                // the method FillHistos.
108
109     virtual void InitHistos(); // create histos by allocating memory for them 
110     virtual void DeleteHistos(); // deletete histos (memory is freed)
111     virtual void CopyHistos(AliITSPlaneEffSPD& target) const; // copy only histograms to target
112
113     TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi)
114     TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z
115     TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z
116     TH2I **fHisClusterSize; //! histos with cluster-size distribution
117     TH1F ***fHisResXclu; //! histos with residual distribution along local X (r-phi) for cluster type
118     TH1F ***fHisResZclu; //! histos with residual distribution along local Z for cluster type
119     TH1F ***fHisResXchip; //! histos with residual distribution along local X (r-phi) chip by chip
120     TH1F ***fHisResZchip; //! histos with residual distribution along local Z chip by chip
121     //TProfile **fProfResXvsLPhi; //! TProfile of X Residuals vs. impact Angle phi (of the track w.r.t. module)
122     //TProfile **fProfResZvsLPhi; //! TProfile of Z Residuals vs. impact Angle phi (of the track w.r.t. module)
123     //TProfile **fProfResXvsLDip; //! TProfile of X Residuals vs. impact dip Angle  (of the track w.r.t. module)
124     //TProfile **fProfResZvsLDip; //! TProfile of Z Residuals vs. impact dip Angle  (of the track w.r.t. module)
125     TH1F **fHisTrackErrX; //! histos with track prediction error on Local X
126     TH1F **fHisTrackErrZ; //! histos with track prediction error on Local Z
127     TH1F **fHisClusErrX; //! histos with Local_X cluster error
128     TH1F **fHisClusErrZ; //! histos with Local_Z cluster error
129
130     ClassDef(AliITSPlaneEffSPD,2) // SPD Plane Efficiency class
131 };
132 //
133 inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
134
135 inline Int_t AliITSPlaneEffSPD::GetFound(const UInt_t key) const {
136  if(key>=kNModule*kNChip) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
137  return fFound[key];
138 }
139 inline Int_t AliITSPlaneEffSPD::GetTried(const UInt_t key) const {
140  if(key>=kNModule*kNChip) {AliWarning("GetTried: you asked for a non existing key"); return -1;}
141  return fTried[key];
142 }
143 //
144 #endif
145