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 */
9 #include "AliITSPlaneEff.h"
13 ///////////////////////////////////////////
15 // ITS Plane Efficiency class //
17 // Origin: Giuseppe.Bruno@ba.infn.it //
18 ///////////////////////////////////////////
22 class AliITSPlaneEffSPD : public AliITSPlaneEff {
24 AliITSPlaneEffSPD(); // default constructor
25 virtual ~AliITSPlaneEffSPD(); // destructror
27 AliITSPlaneEffSPD(const AliITSPlaneEffSPD &source);
29 AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s);
30 // Simple way to add another class (i.e. statistics).
31 AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
32 // Getters for average Plane efficiency (including dead/noisy)
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));};
39 // Getters for fFound[] and fTried[]
40 Int_t GetFound(const UInt_t key) const;
41 Int_t GetTried(const UInt_t key) const;
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);
44 Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
45 {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));};
47 enum {kNModule = 240}; // The number of modules
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)
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
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);}
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
69 UInt_t GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic
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
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;
75 // Methods for dealing with auxiliary histograms
76 // method to set on/off the creation/updates of histograms (Histos are created/destroyed)
77 virtual void SetCreateHistos(Bool_t his=kFALSE)
78 //{fHis=his; if(fHis) InitHistos(); else DeleteHistos(); return; }
79 {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
80 virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype, Float_t *angtrkmod);
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.
87 virtual void Copy(TObject &obj) const; // copy ALL data members to obj
88 // both statistics ad histograms)
89 Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const;
90 UInt_t GetModFromKey(const UInt_t key) const;
91 UInt_t GetChipFromKey(const UInt_t key) const;
92 UInt_t GetChipFromCol(const UInt_t col) const; // get the chip number (from 0 to kNChip)
93 UInt_t GetColFromLocZ(Float_t zloc) const; // get the Column from the local z
94 Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number,
95 // the latter in the range [0,kNChip*kNCol]
96 Float_t GetLocXFromRow(const UInt_t row) const; // get the local X from the row number
97 // the latter in the range [0,kNRow]
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;
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
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.
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
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
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
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
133 ClassDef(AliITSPlaneEffSPD,3) // SPD Plane Efficiency class
136 inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
138 inline 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;}
142 inline 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;}