]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDdEdxBaseUtils.h
Fixes for wrong use of const causing PW.CAST_TO_QUALIFIED_TYPE defect in Coverity
[u/mrichter/AliRoot.git] / TRD / AliTRDdEdxBaseUtils.h
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 //
16 //
17 //
18 //  Xianguo Lu 
19 //  lu@physi.uni-heidelberg.de
20 //  Xianguo.Lu@cern.ch
21 //
22 /*
23 grep " AliTRDdEdxBaseUtils::" AliTRDdEdxBaseUtils.cxx | grep "=" -v  | grep -v "[6]" | grep -v printf  |wc
24 grep "(" AliTRDdEdxBaseUtils.h | grep ";" | grep -v grep | grep -v ClassDef | grep -v "{" | grep -v typedef | wc
25 */
26
27
28 #ifndef ALITRDDEDXBASEUTILS_H
29 #define ALITRDDEDXBASEUTILS_H
30
31 #ifndef TVECTORD_H
32 #include "TVectorD.h"
33 #endif
34
35 #ifndef THNSPARSE_H
36 #include "THnBase.h"
37 #endif
38
39 #ifndef TTREESTREAM_H
40 #include "TTreeStream.h"
41 #endif 
42
43 class TH1D;
44 class TH2D;
45 class TObjArray;
46
47 class AliESDEvent;
48 class AliESDtrack;
49 class AliTRDcluster;
50 class AliTRDtrackV1;
51 class AliTRDseedV1;
52
53 class AliTRDdEdxBaseUtils
54 {
55  public:
56   //===================================================================================
57   //                                   Math and Histogram
58   //===================================================================================
59   static void BinLogX(TAxis *axis);
60   static void GetCDFCuts(const TH1D *hh, Int_t ncut, Double_t cuts[], const Double_t cdfs[], Double_t thres);
61   static Double_t GetMeanRMS(Double_t nn, Double_t sum, Double_t w2s, Double_t * grms=0x0, Double_t * gerr=0x0);
62   static Double_t TruncatedMean(Int_t nx, const Double_t xdata[], Double_t lowfrac, Double_t highfrac, Double_t * grms=0x0, Double_t * gerr=0x0, Double_t *wws=0x0);
63   static Double_t TruncatedMean(const TH1 *hh, Double_t lowfrac, Double_t highfrac, Double_t * grms=0x0, Double_t * gerr=0x0);
64   static void FitSlicesY(const TH2D *hh, TH1D *&hnor, TH1D *&hmpv, TH1D *&hwid, TH1D *&hres, Double_t thres, Double_t lowfrac, Double_t highfrac);
65
66   //===================================================================================
67   //                                TRD Analysis Fast Tool
68   //===================================================================================
69   static Int_t GetNtracklet(const AliESDEvent *esd);
70   static AliTRDtrackV1 * GetTRDtrackV1(const AliESDtrack * esdtrack);
71   static Bool_t IsInSameStack(const AliTRDtrackV1 *trdtrack);
72   static AliTRDseedV1 * GetFirstTracklet(const AliTRDtrackV1 *trdtrack);
73   static AliTRDseedV1 * GetLastTracklet(const AliTRDtrackV1 *trdtrack);
74   static void GetFirstSectorStackMomentum(const AliTRDtrackV1 *trdtrack, Int_t & isec, Int_t & istk, Double_t & mom);
75   static Double_t GetRedefinedPhi(Double_t phi);
76   static Double_t Getdydx(const AliTRDseedV1 *tracklet);
77   static Double_t Getdzdx(const AliTRDseedV1 *tracklet);
78   static Double_t Getdldx(const AliTRDseedV1 *tracklet);
79
80   //===================================================================================
81   //                                 Detector, Data and Control Constant
82   //===================================================================================
83   
84   static Int_t NTRDchamber(){return 18*5*6;} //540
85   static Int_t NTRDtimebin(){return NTRDchamber()*31;} //16740
86   static Int_t ToDetector(Int_t gtb);
87   static Int_t ToTimeBin(Int_t gtb);
88   static Int_t ToSector(Int_t gtb);
89   static Int_t ToStack(Int_t gtb);
90   static Int_t ToLayer(Int_t gtb);
91
92   static void CheckRunB(TString listrun1kg, Int_t run, TString & type);
93   static TString GetRunType(Int_t run);
94
95   static void SetQ0Frac(Double_t q0){ fgQ0Frac = q0; }
96   static void SetQ1Frac(Double_t q1){ fgQ1Frac = q1; }
97   static void SetTimeBinCountCut(Double_t tbc){ fgTimeBinCountCut = tbc; }
98   static void SetCalibTPCnclsCut(Int_t tpc){ fgCalibTPCnclsCut = tpc; }
99   static void SetExBOn(Bool_t kon){ fgExBOn = kon; }
100   static void SetPadGainOn(Bool_t kon){ fgPadGainOn = kon; }
101   static void SetQScale(Double_t scale){ fgQScale = scale; }
102  
103   static Double_t Q0Frac(){return fgQ0Frac;}
104   static Double_t Q1Frac(){return fgQ1Frac;}
105   static Double_t TimeBinCountCut(){return fgTimeBinCountCut;}
106   static Int_t CalibTPCnclsCut(){return fgCalibTPCnclsCut;}
107   static Bool_t IsExBOn(){return fgExBOn;}
108   static Bool_t IsPadGainOn(){return fgPadGainOn;}
109   static Double_t QScale(){return fgQScale;}
110   
111   static void PrintControl();
112   
113   //===================================================================================
114   //                                 dEdx Parameterization
115   //===================================================================================
116   static void FastFitdEdxTR(TH1 * hh);
117
118   static Double_t ALEPH(const Double_t * xx,  const Double_t * par);
119   static Double_t MeandEdx(const Double_t * xx, const Double_t * par);
120   static Double_t MeanTR(const Double_t * xx, const Double_t * par);
121   static Double_t MeandEdxTR(const Double_t * xx, const Double_t * par);
122
123   static Double_t QMeanTPC(Double_t bg);
124   static Double_t Q0MeanTRDpp(Double_t bg);
125   static Double_t Q1MeanTRDpp(Double_t bg);
126   static Double_t Q0MeanTRDPbPb(Double_t bg);
127   static Double_t Q1MeanTRDPbPb(Double_t bg);
128
129   typedef Double_t (*FFunc)(const Double_t *xx, const Double_t *par);
130   
131   static Double_t MeandEdxLogx(const Double_t * xx, const Double_t * par){return ToLogx(MeandEdx, xx, par);}
132   static Double_t MeanTRLogx(const Double_t * xx, const Double_t * par){return ToLogx(MeanTR, xx, par);}
133   static Double_t MeandEdxTRLogx(const Double_t * xx, const Double_t * par){return ToLogx(MeandEdxTR, xx, par);}
134
135  private:
136   //dEdx Parameterization
137   static Double_t ToLogx(FFunc func, const Double_t * xx, const Double_t * par);
138
139   //Control Constant
140   static Double_t fgQ0Frac; //q0frac
141   static Double_t fgQ1Frac; //q1frac
142   static Double_t fgTimeBinCountCut; //tbcut
143   static Int_t    fgCalibTPCnclsCut; //tpccut
144   static Bool_t   fgExBOn;    //exbon
145   static Bool_t fgPadGainOn; //pad gain
146   static Double_t fgQScale; //Qscale
147
148 };
149
150 #endif