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