Line data Source code
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 <TProfile.h>
9 : #include "AliITSPlaneEff.h"
10 :
11 : class AliCDBId;
12 :
13 : ///////////////////////////////////////////
14 : // //
15 : // ITS Plane Efficiency class //
16 : // for SPD //
17 : // Origin: Giuseppe.Bruno@ba.infn.it //
18 : ///////////////////////////////////////////
19 :
20 : /* $Id$ */
21 :
22 : class 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);
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, Bool_t FO=kFALSE, const UInt_t BCm4=0) const;
34 : Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip, Bool_t FO=kFALSE, const UInt_t BCm4=0) const;
35 : Double_t PlaneEff(const UInt_t key) const
36 0 : {return PlaneEff(GetModFromKey(key),GetChipFromKey(key),IsForFO(key),GetBCm4FromKey(key));};
37 : Double_t ErrPlaneEff(const UInt_t key) const
38 0 : {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key),IsForFO(key),GetBCm4FromKey(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, Bool_t FO=kFALSE, const UInt_t BCm4=0);
44 : Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
45 0 : {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key),IsForFO(key),GetBCm4FromKey(key));};
46 : //
47 : enum {kNModule = 240}; // The number of modules
48 : enum {kNModuleLy1 = 80}; // The number of modules in Inner Layer
49 : enum {kNChip = 5}; // The number of chips per module
50 : enum {kNCol = 32}; // The number of columns per chip
51 : enum {kNRow = 256}; // The number of rows per chip (and per module)
52 : enum {kNClockPhase = 4}; // The number of clock phases between LHC (40 MHz clock) and SPD (10 MHz clock), for FO studies
53 :
54 : virtual Double_t LivePlaneEff(UInt_t key) const;
55 : Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip) const
56 0 : {return LivePlaneEff(GetKey(mod,chip));};
57 : virtual Double_t ErrLivePlaneEff(UInt_t key) const;
58 : Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip) const
59 0 : {return ErrLivePlaneEff(GetKey(mod,chip));};
60 : // Compute the fraction of Live area (of the CHIP for the SPD)
61 : virtual Double_t GetFracLive(const UInt_t key) const;
62 : // Compute the fraction of bad (i.e. dead and noisy) area (of the CHIP for the SPD)
63 : virtual Double_t GetFracBad(const UInt_t key) const;
64 : virtual Bool_t WriteIntoCDB() const;
65 : virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
66 : Bool_t AddFromCDB(AliCDBId *cdbId); // this method updates Data Members (statistics) from DataBase
67 0 : virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return AddFromCDB(cdbId);}
68 : // method to locate a basic block from Detector Local coordinate (to be used in tracking)
69 : // see file cxx for numbering convention.
70 : // here idet runs from 0 to 79 for layer 0 and from 0 to 159 for layer 1
71 : UInt_t GetKey(const UInt_t mod, const UInt_t chip, const Bool_t FO=kFALSE, const UInt_t BCm4=0) const; // unique key to locate the basic
72 : // block of the SPD for detector and FO efficiency
73 : UInt_t SwitchChipKeyNumbering(UInt_t key) const; // method to switch from offline chip key numbering to online Raw Stream chip numbering
74 : // and viceversa. Used for Fast-Or studies.
75 : UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t, Float_t locz) const;
76 : UInt_t Nblock() const; // return the number of basic blocks
77 : // compute the geometrical limit of a basic block (chip) in detector local coordinate system
78 : Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const;
79 : // Methods for dealing with auxiliary histograms
80 : // method to set on/off the creation/updates of histograms (Histos are created/destroyed)
81 : virtual void SetCreateHistos(Bool_t his=kFALSE)
82 : //{fHis=his; if(fHis) InitHistos(); else DeleteHistos(); return; }
83 0 : {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
84 : virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype, Float_t *angtrkmod);
85 : virtual Bool_t WriteHistosToFile(TString filename="PlaneEffSPDHistos.root",Option_t* option = "RECREATE");
86 : virtual Bool_t ReadHistosFromFile(TString filename="PlaneEffSPDHistos.root"); // histos must exist already !
87 : // This method increases the
88 : // statistics of histos by adding
89 : // those of the input file.
90 : protected:
91 : virtual void Copy(TObject &obj) const; // copy ALL data members to obj
92 : // both statistics ad histograms)
93 : Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const;
94 : UInt_t GetModFromKey(const UInt_t key) const;
95 : UInt_t GetChipFromKey(const UInt_t key) const;
96 : Bool_t IsForFO(const UInt_t key) const;
97 : UInt_t GetBCm4FromKey(const UInt_t key) const; // return the "Bunch Crossing modulo 4" (for Fast Or studies)
98 : UInt_t GetChipFromCol(const UInt_t col) const; // get the chip number (from 0 to kNChip)
99 : UInt_t GetColFromLocZ(Float_t zloc) const; // get the Column from the local z
100 : Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number,
101 : // the latter in the range [0,kNChip*kNCol]
102 : Float_t GetLocXFromRow(const UInt_t row) const; // get the local X from the row number
103 : // the latter in the range [0,kNRow]
104 : void GetModAndChipFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip) const;
105 : void GetDeadAndNoisyInChip(const UInt_t key, UInt_t& dead, UInt_t& noisy) const;
106 : //
107 : Int_t fFound[kNModule*kNChip*(kNClockPhase+1)]; // if(<kNModule*kNChip) is the number of associated clusters in a given chip
108 : Int_t fTried[kNModule*kNChip*(kNClockPhase+1)]; // if(<kNModule*kNChip) is the number of tracks used for chip efficiency evaluation
109 : // if(>=kNModule*kNChip) Same tale but for Fast-Or
110 : // studies (in the 4 phase relationship between LHC and SPD clocks)
111 : Bool_t FillHistosStd(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype, Float_t *angtrkmod);
112 : Bool_t FillHistosFO(UInt_t key, Bool_t found, Float_t *track);
113 :
114 : private:
115 : enum {kNHisto = kNModule}; // The number of histograms: module by module.
116 : enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu.
117 : // If you change them, then you must change implementation of
118 : // the method FillHistos.
119 :
120 : virtual void InitHistos(); // create histos by allocating memory for them
121 : virtual void DeleteHistos(); // deletete histos (memory is freed)
122 : virtual void CopyHistos(AliITSPlaneEffSPD& target) const; // copy only histograms to target
123 :
124 : TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi)
125 : TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z
126 : TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z
127 : TH2I **fHisClusterSize; //! histos with cluster-size distribution
128 : TH1F ***fHisResXclu; //! histos with residual distribution along local X (r-phi) for cluster type
129 : TH1F ***fHisResZclu; //! histos with residual distribution along local Z for cluster type
130 : TH1F ***fHisResXchip; //! histos with residual distribution along local X (r-phi) chip by chip
131 : TH1F ***fHisResZchip; //! histos with residual distribution along local Z chip by chip
132 : TProfile **fProfResXvsPhi; //! TProfile of X Residuals vs. impact Angle phi (of the track w.r.t. module)
133 : //TProfile **fProfResZvsPhi; //! TProfile of Z Residuals vs. impact Angle phi (of the track w.r.t. module)
134 : //TProfile **fProfResXvsDip; //! TProfile of X Residuals vs. impact dip Angle (of the track w.r.t. module)
135 : TProfile **fProfResZvsDip; //! TProfile of Z Residuals vs. impact dip Angle (of the track w.r.t. module)
136 : TProfile ***fProfResXvsPhiclu; //! TProfile of X Residuals vs. impact Angle phi (of the track w.r.t. module) for different clu. type
137 : TProfile ***fProfResZvsDipclu; //! TProfile of Z Residuals vs. impact dip Angle (of the track w.r.t. module) for different clu. type
138 : TH1F **fHisTrackErrX; //! histos with track prediction error on Local X
139 : TH1F **fHisTrackErrZ; //! histos with track prediction error on Local Z
140 : TH1F **fHisClusErrX; //! histos with Local_X cluster error
141 : TH1F **fHisClusErrZ; //! histos with Local_Z cluster error
142 : TH1F ***fHisTrackXFOtrue; //! histos with track prediction along local X (r-phi) if FastOr bit is found
143 : TH1F ***fHisTrackZFOtrue; //! histos with track prediction along local Z if FastOr bit is found
144 : TH1F ***fHisTrackXFOfalse; //! histos with track prediction along local X (r-phi) if FastOr bit is not found
145 : TH1F ***fHisTrackZFOfalse; //! histos with track prediction along local Z if FastOr bit is not found
146 : TH2F ***fHisTrackXZFOtrue; //! histos with track prediction along local X (r-phi) and Z if FastOr bit is found
147 : TH2F ***fHisTrackXZFOfalse; //! histos with track prediction along local X (r-phi) and Z if FastOr bit is not found
148 :
149 118 : ClassDef(AliITSPlaneEffSPD,4) // SPD Plane Efficiency class
150 : };
151 : //
152 0 : inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
153 :
154 : inline Int_t AliITSPlaneEffSPD::GetFound(const UInt_t key) const {
155 0 : if(key>=kNModule*kNChip*(kNClockPhase+1)) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
156 0 : if(key>=kNModule*kNChip)AliWarning("GetFound: you asked for FO efficiency studies");
157 0 : return fFound[key];
158 0 : }
159 : inline Int_t AliITSPlaneEffSPD::GetTried(const UInt_t key) const {
160 0 : if(key>=kNModule*kNChip*(kNClockPhase+1)) {AliWarning("GetTried: you asked for a non existing key"); return -1;}
161 0 : if(key>=kNModule*kNChip)AliWarning("GetTried: you asked for FO efficiency studies");
162 0 : return fTried[key];
163 0 : }
164 : //
165 : #endif
166 :
|