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 */
8 #include "AliITSPlaneEff.h"
11 ///////////////////////////////////////////
13 // ITS Plane Efficiency class //
15 // Origin: Giuseppe.Bruno@ba.infn.it //
16 ///////////////////////////////////////////
20 class AliITSPlaneEffSPD : public AliITSPlaneEff {
22 AliITSPlaneEffSPD(); // default constructor
23 virtual ~AliITSPlaneEffSPD(); // destructror
25 AliITSPlaneEffSPD(const AliITSPlaneEffSPD &source);
27 AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s);
28 // AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
29 // Simple way to add another class (i.e. statistics).
30 AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
31 // Getters for average Plane efficiency (including dead/noisy)
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));};
38 // Getters for fFound[] and fTried[]
39 Int_t GetFound(const UInt_t key) const;
40 Int_t GetTried(const UInt_t key) const;
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);
43 Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
44 {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));};
46 enum {kNModule = 240}; // The number of modules
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)
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
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);}
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
68 UInt_t GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic
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
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;
74 // Methods for dealing with auxiliary histograms
75 // method to set on/off the creation/updates of histograms (Histos are created/destroyed)
76 virtual void SetCreateHistos(Bool_t his=kFALSE)
77 //{fHis=his; if(fHis) InitHistos(); else DeleteHistos(); return; }
78 {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
79 //Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]);
80 virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype);
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 **fProfResXvsLPhi; //! TProfile of X Residuals vs. impact Angle phi (of the track w.r.t. module)
123 //TProfile **fProfResZvsLPhi; //! TProfile of Z Residuals vs. impact Angle phi (of the track w.r.t. module)
124 //TProfile **fProfResXvsLDip; //! TProfile of X Residuals vs. impact dip Angle (of the track w.r.t. module)
125 //TProfile **fProfResZvsLDip; //! TProfile of Z Residuals vs. impact dip Angle (of the track w.r.t. module)
126 TH1F **fHisTrackErrX; //! histos with track prediction error on Local X
127 TH1F **fHisTrackErrZ; //! histos with track prediction error on Local Z
128 TH1F **fHisClusErrX; //! histos with Local_X cluster error
129 TH1F **fHisClusErrZ; //! histos with Local_Z cluster error
131 ClassDef(AliITSPlaneEffSPD,2) // SPD Plane Efficiency class
134 inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
136 inline Int_t AliITSPlaneEffSPD::GetFound(const UInt_t key) const {
137 if(key>=kNModule*kNChip) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
140 inline Int_t AliITSPlaneEffSPD::GetTried(const UInt_t key) const {
141 if(key>=kNModule*kNChip) {AliWarning("GetTried: you asked for a non existing key"); return -1;}