Plane efficiency framework (Guiseppe)
[u/mrichter/AliRoot.git] / ITS / AliITSPlaneEffSDD.h
CommitLineData
6344adcc 1#ifndef ALIITSPLANEEFFSDD_H
2#define ALIITSPLANEEFFSDD_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 SDD //
13// Origin: Giuseppe.Bruno@ba.infn.it //
14///////////////////////////////////////////
15
16/* $Id$ */
17
18class AliITSPlaneEffSDD : public AliITSPlaneEff {
19 public:
20 AliITSPlaneEffSDD(); // default constructor
21 virtual ~AliITSPlaneEffSDD(); // destructror
22 // copy constructor
23 AliITSPlaneEffSDD(const AliITSPlaneEffSDD &source);
24 // ass. operator
25 AliITSPlaneEffSDD& operator=(const AliITSPlaneEffSDD &s);
26 virtual AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
27 // Simple way to add another class (i.e. statistics).
28 AliITSPlaneEffSDD& operator +=( const AliITSPlaneEffSDD &add);
29 // Getters for average Plane efficiency (icluding dead/noisy)
30 Double_t PlaneEff(const UInt_t mod, const UInt_t chip,
31 const UInt_t wing, const UInt_t subw=0) const;
32 Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip,
33 const UInt_t wing, const UInt_t subw=0) const;
34 Double_t PlaneEff(const UInt_t key) const
35 {return PlaneEff(GetModFromKey(key),GetChipFromKey(key),
36 GetWingFromKey(key),GetSubWingFromKey(key));};
37 Double_t ErrPlaneEff(const UInt_t key) const
38 {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key),
39 GetWingFromKey(key),GetSubWingFromKey(key));};
40 // Methods to update the Plane efficiency (specific of the SDD segmentation)
41 Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod,
42 const UInt_t chip, const UInt_t wing, const UInt_t subw=0);
43 virtual Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
44 {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key),
45 GetWingFromKey(key),GetSubWingFromKey(key));};
46 //
47 enum {kNModule = 260}; // The number of modules (i.e. detector 7.25*7.53 cm^2)
48 enum {kNChip = 4}; // The number of chips per half module (i.e. per wing, in total 4+4 chips)
49 enum {kNWing = 2}; // The number of wings (this is hardware division of the module)
50 enum {kNSubWing = 1}; // Eventually sub-divide each wing (by 2 ?) to account for different
51 // efficiencies due to different drift times.
52 enum {kNAnode = 64}; // Number of channels/chip (i.e. anodes per chip)
7167ae53 53 //enum {kNTimeBin = 174}; // granularity along drift direction (i.e. segmentation in r-phi)
6344adcc 54//
55// Plane efficiency for active detector (excluding dead/noisy channels)
56// access to DB is needed
57 virtual Double_t LivePlaneEff(UInt_t key) const;
58 Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip,
59 const UInt_t wing, const UInt_t subw=0) const
60 {return LivePlaneEff(GetKey(mod,chip,wing,subw));};
61 virtual Double_t ErrLivePlaneEff(UInt_t key) const;
62 Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip,
63 const UInt_t wing, const UInt_t subw=0) const
64 {return ErrLivePlaneEff(GetKey(mod,chip,wing,subw));};
65 // Compute the fraction of Live area (of the CHIP/SubWing for the SDD)
66 virtual Double_t GetFracLive(const UInt_t key) const;
67 // Compute the fraction of bad (i.e. dead and noisy) area (of the CHIP/SubWing for the SDD)
68 virtual Double_t GetFracBad(const UInt_t key) const;
69 virtual Bool_t WriteIntoCDB() const;
70 virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
71 virtual Bool_t AddFromCDB() // this method updates Data Members (statistics) from DataBase
72 {AliError("AddFromCDB: Still To be implemented"); return kFALSE;}
7167ae53 73 // method to locate a basic block from Detector Local coordinate (to be used in tracking)
74 // see file cxx for numbering convention.
75 // here idet runs from 0 to 83 for layer 2 and from 0 to 175 for layer 3
76 UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t locx, Float_t locz) const;
77 UInt_t Nblock() const; // return the number of basic blocks
6344adcc 78
79 protected:
80 virtual void Copy(TObject &obj) const;
81 Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr,
82 UInt_t im, UInt_t ic, UInt_t iw, UInt_t isw=0) const;
83//
84 Int_t fFound[kNModule*kNChip*kNWing*kNSubWing]; // number of associated clusters in a given block
85 Int_t fTried[kNModule*kNChip*kNWing*kNSubWing]; // number of tracks used for efficiency evaluation
86 private:
87 UInt_t GetKey(const UInt_t mod, const UInt_t chip, // unique key to locate the
88 const UInt_t wing, const UInt_t subw=0) const; // basic block of the SDD
89 UInt_t GetModFromKey(const UInt_t key) const;
90 UInt_t GetChipFromKey(const UInt_t key) const;
91 UInt_t GetWingFromKey(const UInt_t key) const;
92 UInt_t GetSubWingFromKey(const UInt_t key) const;
93 // getters for chip and wing numbers, given the anode number [0,511]
94 UInt_t ChipFromAnode(const UInt_t anode) const; // return the chip number (from 0 to kNChip-1)
95 UInt_t WingFromAnode(const UInt_t anode) const; // return the wing number (from 0 to kNWing-1)
96 void ChipAndWingFromAnode(const UInt_t anode,UInt_t& chip,UInt_t& wing) const;
7167ae53 97 // return the Subwing (from 0 to kNSubWing-1) from the cell time bin in the range
98 // [0,ntb] and from the number of time bins
99 UInt_t SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const;
100
101 void ChipAndWingAndSubWingFromLocCoor(Float_t locx, Float_t locz,
102 UInt_t& chip, UInt_t& wing, UInt_t& subw) const;
6344adcc 103 //
104 void GetAllFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip,
105 UInt_t& wing, UInt_t& subw) const;
106 void GetBadInBlock(const UInt_t key, UInt_t& bad) const;
107
108 ClassDef(AliITSPlaneEffSDD,1) // SDD Plane Efficiency class
109};
7167ae53 110//
111inline UInt_t AliITSPlaneEffSDD::Nblock() const {return kNModule*kNChip*kNWing*kNSubWing;}
112//
6344adcc 113#endif
114