Fixes for Coverity warnings (M. van Leeuwen)
[u/mrichter/AliRoot.git] / ITS / AliITSPlaneEffSSD.h
CommitLineData
6344adcc 1#ifndef ALIITSPLANEEFFSSD_H
2#define ALIITSPLANEEFFSSD_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 <TH1F.h>
7#include <TH2I.h>
6344adcc 8#include "AliITSPlaneEff.h"
18562610 9
10class AliCDBId;
6344adcc 11
12///////////////////////////////////////////
13// //
14// ITS Plane Efficiency class //
15// for SSD //
16// Origin: Giuseppe.Bruno@ba.infn.it //
17///////////////////////////////////////////
18
2802d754 19/* $Id$ */
6344adcc 20
21class AliITSPlaneEffSSD : public AliITSPlaneEff {
22 public:
23 AliITSPlaneEffSSD(); // default constructor
24 virtual ~AliITSPlaneEffSSD(); // destructror
25 // copy constructor
26 AliITSPlaneEffSSD(const AliITSPlaneEffSSD &source);
27 // ass. operator
28 AliITSPlaneEffSSD& operator=(const AliITSPlaneEffSSD &s);
85f5e9c2 29 // virtual AliITSPlaneEff& operator=(const AliITSPlaneEff &source);
6344adcc 30 // Simple way to add another class (i.e. statistics).
31 AliITSPlaneEffSSD& operator +=( const AliITSPlaneEffSSD &add);
32 // Getters for average Plane efficiency (icluding dead/noisy)
33 Double_t PlaneEff(const UInt_t mod) const;
34 Double_t ErrPlaneEff(const UInt_t mod) const;
41d18cd2 35 // Getters for fFound[] and fTried[]
36 Int_t GetFound(const UInt_t key) const;
37 Int_t GetTried(const UInt_t key) const;
6344adcc 38 // Methods to update the Plane efficiency (specific of the SSD segmentation)
39 Bool_t UpDatePlaneEff(const Bool_t Kfound, const UInt_t mod);
40 //
41 enum {kNModule = 1698}; // The number of modules
42 enum {kNChip = 6}; // The number of chips per side of a module (2 sides: 12 chips)
43 enum {kNSide = 2}; // The number of sides of a module (p and n side)
44 enum {kNStrip = 128}; // The number of strips per chip (in a module 2*768 strips)
45//
6344adcc 46// Plane efficiency for active detector (excluding dead/noisy channels)
47// access to DB is needed
48 virtual Double_t LivePlaneEff(UInt_t mod) const;
49 virtual Double_t ErrLivePlaneEff(UInt_t mod) const;
50 // Compute the fraction of Live area (of the module for the SSD)
51 virtual Double_t GetFracLive(const UInt_t mod) const;
52 // Compute the fraction of bad (i.e. dead and noisy) area (of the module for the SSD)
53 virtual Double_t GetFracBad(const UInt_t mod) const;
54 virtual Bool_t WriteIntoCDB() const;
55 virtual Bool_t ReadFromCDB(); // this method reads Data Members (statistics) from DataBase
1cc5cedc 56 Bool_t AddFromCDB(AliCDBId *cdbId); // this method updates Data Members (statistics) from DataBase
57 virtual Bool_t AddFromCDB() {AliCDBId *cdbId=0; return AddFromCDB(cdbId);}
7167ae53 58 // method to locate a basic block from Detector Local coordinate (to be used in tracking)
59 // see file cxx for numbering convention.
60 // here idet runs from 0 to 747 for layer 4 and from 0 to 949 for layer 5
61 UInt_t GetKeyFromDetLocCoord(Int_t ilay,Int_t idet, Float_t, Float_t locz) const;
62 UInt_t Nblock() const; // return the number of basic blocks
aa0de373 63 // compute the geometrical limit of a basic block (chip) in detector local coordinate system
64 Bool_t GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,Float_t& zmn,Float_t& zmx) const;
3ebe30ad 65 // Methods for dealing with auxiliary histograms
66 // method to set on/off the creation/updates of histograms (Histos are created/destroyed)
1cc5cedc 67 virtual void SetCreateHistos(Bool_t his=kFALSE)
3ebe30ad 68 {fHis=his; if(fHis) {DeleteHistos(); InitHistos();} else DeleteHistos(); return; }
879cdb02 69 virtual Bool_t FillHistos(UInt_t key, Bool_t found, Float_t *track, Float_t *cluster, Int_t *ctype,Float_t*);
1cc5cedc 70 virtual Bool_t WriteHistosToFile(TString filename="PlaneEffSSDHistos.root",Option_t* option = "RECREATE");
71 virtual Bool_t ReadHistosFromFile(TString filename="PlaneEffSSDHistos.root"); // histos must exist already !
3ebe30ad 72 // This method increases the
73 // statistics of histos by adding
74 // those of the input file.
1cc5cedc 75 UInt_t GetKey(const UInt_t mod) const; // unique key to locate the basic
76 // block of the SSD (the module itself)
6344adcc 77 protected:
78 virtual void Copy(TObject &obj) const;
79 Int_t GetMissingTracksForGivenEff(Double_t eff, Double_t RelErr, UInt_t im) const;
1cc5cedc 80 UInt_t GetModFromKey(const UInt_t key) const;
81 void GetBadInModule(const UInt_t mod, UInt_t& bad) const;
6344adcc 82
83//
84 Int_t fFound[kNModule]; // number of associated clusters in a given module
85 Int_t fTried[kNModule]; // number of tracks used for module efficiency evaluation
3ebe30ad 86//
1cc5cedc 87 private:
88 enum {kNHisto = kNModule}; // The number of histograms: module by module.
89 //enum {kNclu = 3}; // Build specific histos of residuals up to cluster size kNclu.
90 // If you change them, then you must change implementation of
91 // the method FillHistos.
92 virtual void InitHistos(); // create histos by allocating memory for them
93 virtual void DeleteHistos(); // deletete histos (memory is freed)
94 void CopyHistos(AliITSPlaneEffSSD& target) const; // copy only histograms to target
95//
3ebe30ad 96 TH1F **fHisResX; //! histos with residual distribution (track-cluster) along local X (r-phi)
97 TH1F **fHisResZ; //! histos with residual distribution (track-cluster) along local Z
98 TH2F **fHisResXZ; //! 2-d histos with residual distribution (track-cluster) along local X and Z
99 TH2I **fHisClusterSize; //! histos with cluster-size distribution
2802d754 100 TH1F **fHisTrackErrX; //! histos with track prediction error on Local X
101 TH1F **fHisTrackErrZ; //! histos with track prediction error on Local Z
102 TH1F **fHisClusErrX; //! histos with Local_X cluster error
103 TH1F **fHisClusErrZ; //! histos with Local_Z cluster error
1cc5cedc 104//
2802d754 105 ClassDef(AliITSPlaneEffSSD,3) // SSD Plane Efficiency class
6344adcc 106};
7167ae53 107//
108inline UInt_t AliITSPlaneEffSSD::Nblock() const {return kNModule;}
aa0de373 109inline Bool_t AliITSPlaneEffSSD::GetBlockBoundaries(const UInt_t key,Float_t& xmn,Float_t& xmx,
110 Float_t& zmn,Float_t& zmx) const {
111// This method return the geometrical boundaries of the active volume of a given
112// basic block, in the detector reference system.
113//
114if(key>=kNModule)
115 {AliWarning("GetBlockBoundaries: you asked for a non existing key"); return kFALSE;}
116const Float_t kDxDefault = 72960.; // For Plane Eff. purpouses, default values
117const Float_t kDzDefault = 40000.; // are precise enough !!!
118const Float_t kconv = 1.0E-04; //converts microns to cm.
119xmn=-kconv*kDxDefault/2.; xmx=kconv*kDxDefault/2.;
120zmn=-kconv*kDzDefault/2.; zmx=kconv*kDzDefault/2.;
121return kTRUE;
122}
7167ae53 123//
41d18cd2 124inline Int_t AliITSPlaneEffSSD::GetFound(const UInt_t key) const {
125 if(key>=kNModule) {AliWarning("GetFound: you asked for a non existing key"); return -1;}
126 return fFound[key];
127}
128inline Int_t AliITSPlaneEffSSD::GetTried(const UInt_t key) const {
129 if(key>=kNModule) {AliWarning("GetTried: you asked for a non existing key"); return -1;}
130 return fTried[key];
131}
132//
6344adcc 133#endif