242b332c |
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 | // // |
19 | // ALICE Reconstruction parameterization: |
20 | // |
21 | // |
22 | // Retrieving paramaters: |
23 | // 0. Read the parameters from database |
24 | // 1. Using the ConfigRecoParam.C script (example : $ALICE_ROOT/macros) |
25 | // 2. Register additional parametes (AliRecoParam::Instance()->RegisterRecoParam(tpcRecoParam); |
26 | // |
27 | // |
28 | // Using the reconstruction parameters |
29 | // AliRecoParam::Instance()->GetRecoParam(detType, eventType) // |
30 | // detType: |
31 | // 1. Detectors - ITS, TPC, TRD, TOF ... |
32 | // 2. Process - V0, Kink, ESDcuts |
33 | |
34 | // // |
35 | /////////////////////////////////////////////////////////////////////////////// |
36 | |
37 | #include "TObjArray.h" |
38 | #include "AliDetectorRecoParam.h" |
39 | |
40 | #include "AliRecoParam.h" |
41 | |
42 | |
43 | ClassImp(AliRecoParam) |
44 | |
45 | |
46 | AliRecoParam* AliRecoParam::fgInstance = 0x0; |
47 | |
48 | |
49 | //_____________________________________________________________________________ |
50 | AliRecoParam* AliRecoParam::Instance() |
51 | { |
52 | // |
53 | // returns AliRecoParam instance (singleton) |
54 | // |
55 | if (!fgInstance) { |
56 | fgInstance = new AliRecoParam(); |
57 | } |
58 | |
59 | return fgInstance; |
60 | } |
61 | |
62 | |
63 | |
64 | AliRecoParam::AliRecoParam(): |
65 | TNamed("ALICE","ALICE"), |
66 | fRecoParamArray(0) |
67 | { |
68 | // |
69 | // |
70 | // |
71 | } |
72 | |
73 | AliRecoParam::~AliRecoParam(){ |
74 | // |
75 | // |
76 | // |
77 | if (fRecoParamArray){ |
78 | fRecoParamArray->Delete(); |
79 | delete fRecoParamArray; |
80 | } |
81 | } |
82 | |
83 | void AliRecoParam::Print(Option_t *option) const{ |
84 | // |
85 | // Print reconstruction setup |
86 | // |
87 | printf("AliRecoParam\n"); |
88 | if (!fRecoParamArray) return; |
89 | Int_t nparam = fRecoParamArray->GetEntriesFast(); |
90 | for (Int_t iparam=0; iparam<nparam; iparam++){ |
91 | AliDetectorRecoParam * param = (AliDetectorRecoParam *)fRecoParamArray->At(iparam); |
92 | if (!param) continue; |
93 | param->Print(option); |
94 | } |
95 | } |
96 | |
97 | void AliRecoParam::RegisterRecoParam(AliDetectorRecoParam* param){ |
98 | // |
99 | // |
100 | // |
101 | if (!fRecoParamArray) fRecoParamArray = new TObjArray; |
102 | fRecoParamArray->AddLast(param); |
103 | } |
104 | |
105 | TObjArray * AliRecoParam::GetRecoParam(const char * detType, Int_t *eventType){ |
106 | // |
107 | // Get the list of Reconstruction parameters for given detector |
108 | // and event type |
109 | // |
110 | if (!fRecoParamArray) return 0; |
111 | TObjArray * array = 0; |
112 | Int_t nparam = fRecoParamArray->GetEntriesFast(); |
113 | for (Int_t iparam=0;iparam<nparam; iparam++){ |
114 | AliDetectorRecoParam * param = (AliDetectorRecoParam *)fRecoParamArray->At(iparam); |
115 | if (!param) continue; |
116 | TString str(param->GetName()); |
117 | if (!str.Contains(detType)) continue; |
118 | if (!array) array = new TObjArray; |
119 | array->AddLast(param); |
120 | } |
121 | return array; |
122 | } |
123 | |
124 | |