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