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 */
8 #include "AliITSPlaneEff.h"
10 ///////////////////////////////////////////
12 // ITS Plane Efficiency class //
14 // Origin: Giuseppe.Bruno@ba.infn.it //
15 ///////////////////////////////////////////
19 class AliITSPlaneEffSDD : public AliITSPlaneEff {
21 AliITSPlaneEffSDD(); // default constructor
22 virtual ~AliITSPlaneEffSDD(); // destructror
24 AliITSPlaneEffSDD(const AliITSPlaneEffSDD &source);
26 AliITSPlaneEffSDD& operator=(const AliITSPlaneEffSDD &s);
27 virtual AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
28 // Simple way to add another class (i.e. statistics).
29 AliITSPlaneEffSDD& operator +=( const AliITSPlaneEffSDD &add);
30 // Getters for average Plane efficiency (icluding dead/noisy)
31 Double_t PlaneEff(const UInt_t mod, const UInt_t chip,
32 const UInt_t wing, const UInt_t subw=0) const;
33 Double_t ErrPlaneEff(const UInt_t mod, const UInt_t chip,
34 const UInt_t wing, const UInt_t subw=0) const;
35 Double_t PlaneEff(const UInt_t key) const
36 {return PlaneEff(GetModFromKey(key),GetChipFromKey(key),
37 GetWingFromKey(key),GetSubWingFromKey(key));};
38 Double_t ErrPlaneEff(const UInt_t key) const
39 {return ErrPlaneEff(GetModFromKey(key),GetChipFromKey(key),
40 GetWingFromKey(key),GetSubWingFromKey(key));};
41 // Methods to update the Plane efficiency (specific of the SDD segmentation)
42 Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod,
43 const UInt_t chip, const UInt_t wing, const UInt_t subw=0);
44 virtual Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t key)
45 {return UpDatePlaneEff(Kfound,GetModFromKey(key),GetChipFromKey(key),
46 GetWingFromKey(key),GetSubWingFromKey(key));};
48 enum {kNModule = 260}; // The number of modules (i.e. detector 7.25*7.53 cm^2)
49 enum {kNChip = 4}; // The number of chips per half module (i.e. per wing, in total 4+4 chips)
50 enum {kNWing = 2}; // The number of wings (this is hardware division of the module)
51 enum {kNSubWing = 1}; // Eventually sub-divide each wing (by 2 ?) to account for different
52 // efficiencies due to different drift times.
53 enum {kNAnode = 64}; // Number of channels/chip (i.e. anodes per chip)
54 //enum {kNTimeBin = 174}; // granularity along drift direction (i.e. segmentation in r-phi)
56 enum {kNHisto = kNModule}; // The number of histograms: module by module.
57 enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu.
58 // If you change them, then you must change implementation of
59 // the method FillHistos.
61 // Plane efficiency for active detector (excluding dead/noisy channels)
62 // access to DB is needed
63 virtual Double_t LivePlaneEff(UInt_t key) const;
64 Double_t LivePlaneEff(const UInt_t mod, const UInt_t chip,
65 const UInt_t wing, const UInt_t subw=0) const
66 {return LivePlaneEff(GetKey(mod,chip,wing,subw));};
67 virtual Double_t ErrLivePlaneEff(UInt_t key) const;
68 Double_t ErrLivePlaneEff(const UInt_t mod, const UInt_t chip,
69 const UInt_t wing, const UInt_t subw=0) const
70 {return ErrLivePlaneEff(GetKey(mod,chip,wing,subw));};
71 // Compute the fraction of Live area (of the CHIP/SubWing for the SDD)
72 virtual Double_t GetFracLive(const UInt_t key) const;
73 // Compute the fraction of bad (i.e. dead and noisy) area (of the CHIP/SubWing for the SDD)
74 virtual Double_t GetFracBad(const UInt_t key) const;
75 virtual Bool_t WriteIntoCDB() const;
76 virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
77 virtual Bool_t AddFromCDB() // this method updates Data Members (statistics) from DataBase
78 {AliError("AddFromCDB: Still To be implemented"); return kFALSE;}
79 // method to locate a basic block from Detector Local coordinate (to be used in tracking)
80 // see file cxx for numbering convention.
81 // here idet runs from 0 to 83 for layer 2 and from 0 to 175 for layer 3
82 UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t locx, Float_t locz) const;
83 UInt_t Nblock() const; // return the number of basic blocks
84 // compute the geometrical limit of a basic block in detector local coordinate system
85 Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const;
86 // Methods for dealing with auxiliary histograms
87 // method to set on/off the creation/updates of histograms (Histos are created/destroyed)
88 void SetCreateHistos(Bool_t his=kFALSE)
89 {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
90 Bool_t FillHistos(UInt_t key, Bool_t found, Float_t trackXZ[2], Float_t clusterXZ[2], Int_t ctXZ[2]);
91 Bool_t WriteHistosToFile(TString filename="PlaneEffSDDHistos.root",Option_t* option = "RECREATE");
92 Bool_t ReadHistosFromFile(TString filename="PlaneEffSDDHistos.root"); // histos must exist already !
93 // This method increases the
94 // statistics of histos by adding
95 // those of the input file.
97 virtual void Copy(TObject &obj) const;
98 void CopyHistos(AliITSPlaneEffSDD& target) const; // copy only histograms to target
99 Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr,
100 UInt_t im, UInt_t ic, UInt_t iw, UInt_t isw=0) const;
102 Int_t fFound[kNModule*kNChip*kNWing*kNSubWing]; // number of associated clusters in a given block
103 Int_t fTried[kNModule*kNChip*kNWing*kNSubWing]; // number of tracks used for efficiency evaluation
104 TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi)
105 TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z
106 TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z
107 TH2I **fHisClusterSize; //! histos with cluster-size distribution
108 TH1F ***fHisResXclu; //! histos with residual distribution along local X (r-phi) for cluster type
109 TH1F ***fHisResZclu; //! histos with residual distribution along local Z for cluster type
110 TProfile **fProfResXvsX; //! TProfile of X Residuals vs. X (of the cluster)
111 TProfile **fProfResZvsX; //! TProfile of Z Residuals vs. X (of the cluster)
112 TProfile **fProfClustSizeXvsX; //! TProfile of cluster_size_X vs. X (of the cluster)
113 TProfile **fProfClustSizeZvsX; //! TProfile of cluster_size_X vs. X (of the cluster)
115 UInt_t GetKey(const UInt_t mod, const UInt_t chip, // unique key to locate the
116 const UInt_t wing, const UInt_t subw=0) const; // basic block of the SDD
117 UInt_t GetModFromKey(const UInt_t key) const;
118 UInt_t GetChipFromKey(const UInt_t key) const;
119 UInt_t GetWingFromKey(const UInt_t key) const;
120 UInt_t GetSubWingFromKey(const UInt_t key) const;
121 // getters for chip and wing numbers, given the anode number [0,511]
122 UInt_t ChipFromAnode(const UInt_t anode) const; // return the chip number (from 0 to kNChip-1)
123 UInt_t WingFromAnode(const UInt_t anode) const; // return the wing number (from 0 to kNWing-1)
124 void ChipAndWingFromAnode(const UInt_t anode,UInt_t& chip,UInt_t& wing) const;
125 // return the Subwing (from 0 to kNSubWing-1) from the cell time bin in the range
126 // [0,ntb] and from the number of time bins
127 UInt_t SubWingFromTimeBin(const Int_t tb, const Int_t ntb) const;
129 void ChipAndWingAndSubWingFromLocCoor(Float_t locx, Float_t locz,
130 UInt_t& chip, UInt_t& wing, UInt_t& subw) const;
132 void GetAllFromKey(const UInt_t key, UInt_t& mod, UInt_t& chip,
133 UInt_t& wing, UInt_t& subw) const;
134 void GetBadInBlock(const UInt_t key, UInt_t& bad) const;
138 ClassDef(AliITSPlaneEffSDD,2) // SDD Plane Efficiency class
141 inline UInt_t AliITSPlaneEffSDD::Nblock() const {return kNModule*kNChip*kNWing*kNSubWing;}