]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSPlaneEffSPD.h
Correction of transformation from online to offline numbering (H. Tydesjo)
[u/mrichter/AliRoot.git] / ITS / AliITSPlaneEffSPD.h
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
7 #include "AliITSPlaneEff.h"
8
9 ///////////////////////////////////////////
10 //                                       //
11 // ITS Plane Efficiency class            //
12 //       for SPD                         //
13 // Origin: Giuseppe.Bruno@ba.infn.it     //
14 ///////////////////////////////////////////
15
16 /* $Id$ */
17   
18 class AliITSPlaneEffSPD :  public AliITSPlaneEff {
19  public:
20     AliITSPlaneEffSPD(); // default constructor
21     virtual ~AliITSPlaneEffSPD(); // destructror
22     // copy constructor
23     AliITSPlaneEffSPD(const AliITSPlaneEffSPD &source);
24     // ass. operator
25     AliITSPlaneEffSPD& operator=(const AliITSPlaneEffSPD &s);
26     AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
27     //AliPlaneEff& operator=(const AliPlaneEff &source);
28     // Simple way to add another class (i.e. statistics). 
29     AliITSPlaneEffSPD& operator +=( const AliITSPlaneEffSPD &add);
30     // Getters for average Plane efficiency (icluding dead/noisy)
31     Double_t PlaneEff(const UInt_t mod, const UInt_t chip) const;
32     Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip) const;
33     Double_t PlaneEff(const UInt_t key) const 
34         {return PlaneEff(GetModFromKey(key),GetChipFromKey(key));};
35     Double_t ErrPlaneEff(const UInt_t key) const 
36         {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key));};
37     // Methods to update the Plane efficiency (specific of the SPD segmentation) 
38     Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod, const UInt_t chip);
39     virtual Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
40         {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key));};
41     //
42     enum {kNModule = 240}; // The number of modules
43     enum {kNChip = 5}; // The number of chips per module
44     enum {kNCol = 32}; // The number of columns per chip
45     enum {kNRow = 256}; // The number of rows per chip (and per module)
46 //
47 //  UInt_t GetChip(const UInt_t col) const; // get the chip number (from 0 to kNChip)
48 //  Plane efficiency for active  detector (excluding dead/noisy channels)
49 //  access to DB is needed
50     virtual Double_t LivePlaneEff(UInt_t key) const;
51     Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip) const
52        {return LivePlaneEff(GetKey(mod,chip));};
53     virtual Double_t ErrLivePlaneEff(UInt_t key) const;
54     Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip) const
55        {return ErrLivePlaneEff(GetKey(mod,chip));};
56     // Compute the fraction of Live area (of the CHIP for the SPD)
57     virtual Double_t GetFracLive(const UInt_t key) const;
58     // Compute the fraction of bad (i.e. dead and noisy) area (of the CHIP for the SPD)
59     virtual Double_t GetFracBad(const UInt_t key) const;
60     virtual Bool_t WriteIntoCDB() const;
61     virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
62     virtual Bool_t AddFromCDB()   // this method updates Data Members (statistics) from DataBase
63       {AliError("AddFromCDB: Still To be implemented"); return kFALSE;}
64    // method to locate a basic block from Detector Local coordinate (to be used in tracking)
65    // see file cxx for numbering convention.
66    // here idet runs from 0 to 79 for layer 0 and from 0 to 159 for layer 1
67     UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t, Float_t locz) const;
68     UInt_t Nblock() const; // return the number of basic blocks
69     // compute the geometrical limit of a basic block (chip) in detector local coordinate system 
70     Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const;
71
72  protected:
73     virtual void Copy(TObject &obj) const;
74     Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im, UInt_t ic) const;
75
76 // 
77     Int_t fFound[kNModule*kNChip];  // number of associated clusters in a given chip
78     Int_t fTried[kNModule*kNChip];  // number of tracks used for chip efficiency evaluation
79  private:
80     UInt_t GetKey(const UInt_t mod, const UInt_t chip) const; // unique key to locate the basic 
81                                                               // block of the SPD 
82     UInt_t GetModFromKey(const UInt_t key) const;
83     UInt_t GetChipFromKey(const UInt_t key) const;
84     UInt_t GetChipFromCol(const UInt_t col) const;  // get the chip number (from 0 to kNChip)
85     UInt_t GetColFromLocZ(Float_t zloc) const;      // get the Column from the local z
86     Float_t GetLocZFromCol(const UInt_t col) const; // get the local Z from the column number,  
87                                                     // the latter in the range [0,kNChip*kNCol]
88     Float_t GetLocXFromRow(const UInt_t row) const; // get the local X from the row number  
89                                                     // the latter in the range [0,kNRow]
90     void GetModAndChipFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip) const;
91     void GetDeadAndNoisyInChip(const UInt_t key, UInt_t& dead, UInt_t& noisy) const;
92
93     ClassDef(AliITSPlaneEffSPD,1) // SPD Plane Efficiency class
94 };
95 //
96 inline UInt_t AliITSPlaneEffSPD::Nblock() const {return kNModule*kNChip;}
97 //
98 #endif
99