- fixing warnings/coverity
[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"
1cc5cedc 10#include "AliCDBId.h"
4a66240a 11
12///////////////////////////////////////////
13// //
14// ITS Plane Efficiency class //
15// for SPD //
6344adcc 16// Origin: Giuseppe.Bruno@ba.infn.it //
4a66240a 17///////////////////////////////////////////
18
162637e4 19/* $Id$ */
4a66240a 20
21class AliITSPlaneEffSPD : public AliITSPlaneEff {
22 public:
23 AliITSPlaneEffSPD(); // default constructor
24 virtual ~AliITSPlaneEffSPD(); // destructror
25 // copy constructor
26 AliITSPlaneEffSPD(const AliITSPlaneEffSPD &source);
27 // ass. operator
28 AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s);
4a66240a 29 // Simple way to add another class (i.e. statistics).
30 AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
1cc5cedc 31 // Getters for average Plane efficiency (including dead/noisy)
4a66240a 32 Double_t PlaneEff(const UInt_t mod, const UInt_t chip) const;
33 Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip) const;
34 Double_t PlaneEff(const UInt_t key) const
35 {return PlaneEff(GetModFromKey(key),GetChipFromKey(key));};
36 Double_t ErrPlaneEff(const UInt_t key) const
37 {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key));};
1cc5cedc 38 // Getters for fFound[] and fTried[]
39 Int_t GetFound(const UInt_t key) const;
40 Int_t GetTried(const UInt_t key) const;
4a66240a 41 // Methods to update the Plane efficiency (specific of the SPD segmentation)
42 Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod, const UInt_t chip);
1cc5cedc 43 Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
4a66240a 44 {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));};
45 //
46 enum {kNModule = 240}; // The number of modules
5fbd4fd6 47 enum {kNChip = 5}; // The number of chips per module
48 enum {kNCol = 32}; // The number of columns per chip
49 enum {kNRow = 256}; // The number of rows per chip (and per module)
50
4a66240a 51 virtual Double_t LivePlaneEff(UInt_t key) const;
52 Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip) const
53 {return LivePlaneEff(GetKey(mod,chip));};
54 virtual Double_t ErrLivePlaneEff(UInt_t key) const;
55 Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip) const
56 {return ErrLivePlaneEff(GetKey(mod,chip));};
57 // Compute the fraction of Live area (of the CHIP for the SPD)
58 virtual Double_t GetFracLive(const UInt_t key) const;
59 // Compute the fraction of bad (i.e. dead and noisy) area (of the CHIP for the SPD)
60 virtual Double_t GetFracBad(const UInt_t key) const;
61 virtual Bool_t WriteIntoCDB() const;
62 virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
1cc5cedc 63 Bool_t AddFromCDB(AliCDBId *cdbId); // this method updates Data Members (statistics) from DataBase
64 virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return AddFromCDB(cdbId);}
7167ae53 65 // method to locate a basic block from Detector Local coordinate (to be used in tracking)
66 // see file cxx for numbering convention.
67 // here idet runs from 0 to 79 for layer 0 and from 0 to 159 for layer 1
5fbd4fd6 68 UInt_t GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic
69 // block of the SPD
7167ae53 70 UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t, Float_t locz) const;
71 UInt_t Nblock() const; // return the number of basic blocks
aa0de373 72 // compute the geometrical limit of a basic block (chip) in detector local coordinate system
73 Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const;
5fbd4fd6 74 // Methods for dealing with auxiliary histograms
75 // method to set on/off the creation/updates of histograms (Histos are created/destroyed)
1cc5cedc 76 virtual void SetCreateHistos(Bool_t his=kFALSE)
3ebe30ad 77 //{fHis=his; if(fHis) InitHistos(); else DeleteHistos(); return; }
78 {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
879cdb02 79 virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype, Float_t *angtrkmod);
1cc5cedc 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.
4a66240a 85 protected:
5fbd4fd6 86 virtual void Copy(TObject &obj) const; // copy ALL data members to obj
1cc5cedc 87 // both statistics ad histograms)
4a66240a 88 Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const;
4a66240a 89 UInt_t GetModFromKey(const UInt_t key) const;
90 UInt_t GetChipFromKey(const UInt_t key) const;
6344adcc 91 UInt_t GetChipFromCol(const UInt_t col) const; // get the chip number (from 0 to kNChip)
7167ae53 92 UInt_t GetColFromLocZ(Float_t zloc) const; // get the Column from the local z
1cc5cedc 93 Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number,
aa0de373 94 // the latter in the range [0,kNChip*kNCol]
1cc5cedc 95 Float_t GetLocXFromRow(const UInt_t row) const; // get the local X from the row number
aa0de373 96 // the latter in the range [0,kNRow]
4a66240a 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;
1cc5cedc 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
879cdb02 121 TProfile **fProfResXvsPhi; //! TProfile of X Residuals vs. impact Angle phi (of the track w.r.t. module)
122 //TProfile **fProfResZvsPhi; //! TProfile of Z Residuals vs. impact Angle phi (of the track w.r.t. module)
123 //TProfile **fProfResXvsDip; //! TProfile of X Residuals vs. impact dip Angle (of the track w.r.t. module)
124 TProfile **fProfResZvsDip; //! TProfile of Z Residuals vs. impact dip Angle (of the track w.r.t. module)
125 TProfile ***fProfResXvsPhiclu; //! TProfile of X Residuals vs. impact Angle phi (of the track w.r.t. module) for different clu. type
126 TProfile ***fProfResZvsDipclu; //! TProfile of Z Residuals vs. impact dip Angle (of the track w.r.t. module) for different clu. type
1cc5cedc 127 TH1F **fHisTrackErrX; //! histos with track prediction error on Local X
128 TH1F **fHisTrackErrZ; //! histos with track prediction error on Local Z
129 TH1F **fHisClusErrX; //! histos with Local_X cluster error
130 TH1F **fHisClusErrZ; //! histos with Local_Z cluster error
4a66240a 131
879cdb02 132 ClassDef(AliITSPlaneEffSPD,3) // SPD Plane Efficiency class
4a66240a 133};
7167ae53 134//
135inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
1cc5cedc 136
137inline Int_t AliITSPlaneEffSPD::GetFound(const UInt_t key) const {
138 if(key>=kNModule*kNChip) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
139 return fFound[key];
140}
141inline Int_t AliITSPlaneEffSPD::GetTried(const UInt_t key) const {
142 if(key>=kNModule*kNChip) {AliWarning("GetTried: you asked for a non existing key"); return -1;}
143 return fTried[key];
144}
7167ae53 145//
4a66240a 146#endif
147