First V0 MC Analysis from H.Ricaud
[u/mrichter/AliRoot.git] / TRD / AliTRDtrigParam.cxx
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 //  TRD trigger parameters class                                             //
19 //                                                                           //
20 //  Request an instance with AliTRDCommonParam::Instance()                   //
21 //  Then request the needed values                                           //
22 //                                                                           //
23 //  Author:                                                                  //
24 //     Bogdan Vulpescu                                                       //
25 //                                                                           //
26 ///////////////////////////////////////////////////////////////////////////////
27
28 #include "AliTRDgeometry.h"
29
30 #include "AliTRDtrigParam.h"
31
32 ClassImp(AliTRDtrigParam)
33
34 AliTRDtrigParam *AliTRDtrigParam::fgInstance = 0;
35 Bool_t AliTRDtrigParam::fgTerminated = kFALSE;
36
37 //_ singleton implementation __________________________________________________
38 AliTRDtrigParam *AliTRDtrigParam::Instance()
39 {
40   //
41   // Singleton implementation
42   // Returns an instance of this class, it is created if neccessary
43   //
44
45   if (fgTerminated != kFALSE) {
46     return 0;
47   }
48
49   if (fgInstance == 0) {
50     fgInstance = new AliTRDtrigParam();
51   }
52
53   return fgInstance;
54
55 }
56
57 //_____________________________________________________________________________
58 void AliTRDtrigParam::Terminate()
59 {
60   //
61   // Singleton implementation
62   // Deletes the instance of this class and sets the terminated flag,
63   // instances cannot be requested anymore
64   // This function can be called several times.
65   //
66
67   fgTerminated = kTRUE;
68
69   if (fgInstance != 0) {
70     delete fgInstance;
71     fgInstance = 0;
72   }
73
74 }
75
76 //_____________________________________________________________________________
77 AliTRDtrigParam::AliTRDtrigParam()
78   :TObject()
79   ,fTime1(2)
80   ,fTime2(22)
81   ,fClusThr(10.0)
82   ,fPadThr(1)
83   ,fSum10(2)
84   ,fSum12(10)
85   ,fTCOn(1)
86   ,fTCnexp(1)
87   ,fFilterType(0)
88   ,fR1(0)
89   ,fR2(0)
90   ,fC1(0)
91   ,fC2(0)
92   ,fPedestal(0)
93   ,fADCnoise(0)
94   ,fDeltaY(2.0)
95   ,fDeltaS(2.5)
96   ,fXprojPlane(0)
97   ,fLtuPtCut(2.3)
98   ,fGtuPtCut(3.0)
99   ,fHighPt(10.0)
100   ,fNPartJetLow(5)
101   ,fNPartJetHigh(3)
102   ,fJetLowPt(3.0)
103   ,fJetHighPt(5.0)
104 {
105   //
106   // AliTRDtrigParam default constructor
107   //
108
109   // PASA.v.4
110   if      (fTCnexp == 1) {
111     fR1 = 1.1563;
112     fR2 = 0.1299;
113     fC1 = 0.0657;
114     fC2 = 0.0000;
115   }
116   else if (fTCnexp == 2) {
117     fR1 = 1.1563;
118     fR2 = 0.1299;
119     fC1 = 0.1141;
120     fC2 = 0.6241;
121   }
122  
123   Init();
124
125 }
126
127 //_____________________________________________________________________________
128 AliTRDtrigParam::AliTRDtrigParam(const AliTRDtrigParam &p)
129   :TObject(p)
130   ,fTime1(p.fTime1)
131   ,fTime2(p.fTime2)
132   ,fClusThr(p.fClusThr)
133   ,fPadThr(p.fPadThr)
134   ,fSum10(p.fSum10)
135   ,fSum12(p.fSum12)
136   ,fTCOn(p.fTCOn)
137   ,fTCnexp(p.fTCnexp)
138   ,fFilterType(p.fFilterType)
139   ,fR1(p.fR1)
140   ,fR2(p.fR2)
141   ,fC1(p.fC1)
142   ,fC2(p.fC2)
143   ,fPedestal(p.fPedestal)
144   ,fADCnoise(p.fADCnoise)
145   ,fDeltaY(p.fDeltaY)
146   ,fDeltaS(p.fDeltaS)
147   ,fXprojPlane(p.fXprojPlane)
148   ,fLtuPtCut(p.fLtuPtCut)
149   ,fGtuPtCut(p.fGtuPtCut)
150   ,fHighPt(p.fHighPt)
151   ,fNPartJetLow(p.fNPartJetLow)
152   ,fNPartJetHigh(p.fNPartJetHigh)
153   ,fJetLowPt(p.fJetLowPt)
154   ,fJetHighPt(p.fJetHighPt)
155 {
156   //
157   // AliTRDtrigParam copy constructor
158   //
159
160 }
161
162 //_____________________________________________________________________________
163 AliTRDtrigParam::~AliTRDtrigParam()
164 {
165   //
166   // AliTRDtrigParam destructor
167   //
168
169 }
170
171 //_____________________________________________________________________________
172 AliTRDtrigParam &AliTRDtrigParam::operator=(const AliTRDtrigParam &p)
173 {
174   //
175   // Assignment operator
176   //
177
178   if (this != &p) ((AliTRDtrigParam &) p).Copy(*this);
179   return *this;
180
181 }
182
183 //_____________________________________________________________________________
184 void AliTRDtrigParam::Copy(TObject &p) const
185 {
186   //
187   // Copy function
188   //
189
190   ((AliTRDtrigParam &) p).fTime1        = fTime1;
191   ((AliTRDtrigParam &) p).fTime2        = fTime2;
192   ((AliTRDtrigParam &) p).fClusThr      = fClusThr;
193   ((AliTRDtrigParam &) p).fPadThr       = fPadThr;
194   ((AliTRDtrigParam &) p).fSum10        = fSum10;
195   ((AliTRDtrigParam &) p).fSum12        = fSum12;
196   ((AliTRDtrigParam &) p).fTCOn         = fTCOn;
197   ((AliTRDtrigParam &) p).fTCnexp       = fTCnexp;
198   ((AliTRDtrigParam &) p).fFilterType   = fFilterType;
199   ((AliTRDtrigParam &) p).fR1           = fR1;
200   ((AliTRDtrigParam &) p).fR2           = fR2;
201   ((AliTRDtrigParam &) p).fC1           = fC1;
202   ((AliTRDtrigParam &) p).fC2           = fC2;
203   ((AliTRDtrigParam &) p).fPedestal     = fPedestal;
204   ((AliTRDtrigParam &) p).fADCnoise     = fADCnoise;
205   ((AliTRDtrigParam &) p).fDeltaY       = fDeltaY;
206   ((AliTRDtrigParam &) p).fDeltaS       = fDeltaS;
207   ((AliTRDtrigParam &) p).fXprojPlane   = fXprojPlane;
208   ((AliTRDtrigParam &) p).fLtuPtCut     = fLtuPtCut;
209   ((AliTRDtrigParam &) p).fGtuPtCut     = fGtuPtCut;
210   ((AliTRDtrigParam &) p).fHighPt       = fHighPt;
211   ((AliTRDtrigParam &) p).fNPartJetLow  = fNPartJetLow;
212   ((AliTRDtrigParam &) p).fNPartJetHigh = fNPartJetHigh;
213   ((AliTRDtrigParam &) p).fJetLowPt     = fJetLowPt;
214   ((AliTRDtrigParam &) p).fJetHighPt    = fJetHighPt;
215
216 }
217
218 //_____________________________________________________________________________
219 void AliTRDtrigParam::Init()
220 {
221   //
222   // Initialize the other parameters
223   //
224
225   Float_t xPlane0;
226   Float_t xPlane5;
227  
228   xPlane0     = AliTRDgeometry::GetTime0(0) 
229               - AliTRDgeometry::CdrHght() 
230               - 0.5*AliTRDgeometry::CamHght(); 
231   xPlane5     = AliTRDgeometry::GetTime0(5) 
232               - AliTRDgeometry::CdrHght()
233               - 0.5*AliTRDgeometry::CamHght();
234   fXprojPlane = 0.5 * (xPlane0 + xPlane5);
235
236 }
237